Web Recon
Basic Scanning
nmap
https://github.com/jai-the-seeker/CTF-OSCP/blob/master/utilities/nmap.md#basic-scans
curl
https://github.com/jai-the-seeker/CTF-OSCP/blob/master/utilities/curl.md#http-response-headers
Directory Listing
Metasploit
Dirb
curl
and bash script
Using We can use curl to check for all the directories listed in the wordlist. This can be done by a following wrapper bash script https://github.com/jai-the-seeker/CTF-OSCP/blob/master/scripts/bash_scripts.md#directory-listing
Authentication
Basic authentication
curl
https://github.com/jai-the-seeker/CTF-OSCP/blob/master/utilities/curl.md#http-basic-authentication
metasploit
http_login
module
Digest Authentication
https://github.com/jai-the-seeker/CTF-OSCP/blob/master/utilities/curl.md#digest-authentication
Token Authentication
Hydra and metasploit http_login
module doesn’t support token authentication.
We have to set the token in headers for token auth to work.
We have to write a custom wrapper around this command. In the script, we will rely on the fact that on using the correct token, we will get something else than "Unauthorized Access".
You can refer this script https://github.com/jai-the-seeker/CTF-OSCP/blob/master/scripts/bash_scripts.md#authorization-token
After performing the dictionary attack we will get the password, which can be used to set the token in the headers
Hydra
http-get
This is the basic example
Options : -l
single LOGIN name or -L
FILE having list of LOGIN names,
-p
single PASSWORD or -P
FILE having list of passwords,
-t
Number of threads per target (default: 16)
http-post-form
Ref
- https://redteamtutorials.com/2018/10/25/hydra-brute-force-https/
- https://www.youtube.com/watch?v=fFnEdoCyVhk&list=PLYmlEoSHldN7HJapyiQ8kFLUsk_a7EjCw&index=63
syntax
Example:
ssh
ncrack
Refs:
Use verbose mode (-v
), read a list of IP addresses (-iL
win.txt), and attempt to login with the username victim (--user
victim) along with the passwords in a dictionary (-P
passes.txt) using the RDP protocol (-p
rdp) with a one connection at a time (CL=1
):
ssh
medusa
ssh
Ref
-h
: target hostname,
-u
: username,
-P
: a dictionary file,
-M
: the module to execute like SSH, FTP etc,
-n
: port number wrt to module
Header Fuzzing and Manipulation
Fetch Header
wfuzz
Official Website
There are two db wordlists associated with wfuzz
which can be obtained from
Fuzzing User Agent String
We can use wfuzz
to check for various valid strings of the User-Agent
by passing it a wordlist containing possible user agents strings.
The word list can of user-agents can be obtained from https://github.com/fuzzdb-project/fuzzdb/blob/master/discovery/UserAgent/UserAgentListCommon.txt
output
Here response code of 200
indicates that the user-agent-string
is valid. The same can now be used with curl
to verify and access the webpage
Fuzzing Missing Header
Refs:
In case we see some message like Access Denied : Header Missing
, it seems that it's expecting a certain header parameter. We can use wfuzz
to try and determine what it might be looking for. So we can create a list of all the HTTP header responses from here. So we have some header types to fuzz now we just need our target. We were given a hint earlier that we had some files stored on a 192.168.4.28 address. We can generate a list of every IP in that scope and use that. This is what our total command will look like:
Command:
A quick breakdown of the above command:
-c
will output with colors, I like colors.
-w
specifies a wordlist.
--hs
will hide responses of the type following it. In this case "Header Missing".
--sc
will show response codes of the type following it. In this case 200.
-H
specifies header parameters.
FUZZ:FUZ2Z
These are the two header parameters we are fuzzing. FUZZ
is for the first wordlist specified. FUZ2Z
is for the second word list specified. So we have something like this in the header of our request: "Acces-Control-Allow-Origin:192.168.4.44"
http://10.10.10.167/admin.php
Lastly, the target URL.
Fuzzing Parameter for LFI
Wordlist:
Here,
--hw 100
will hide responses with number of words less than 100,
-b
is for specifying the cookie for the request