ffuf, Gobuster, Nikto and sqlmap in the Lab
Manual testing with a proxy finds the deep bugs; command-line tools cover breadth quickly. Content discovery tools (ffuf, Gobuster, dirsearch, feroxbuster) guess paths from word lists to find pages nobody linked. Server scanners (Nikto) check for thousands of known files, default configurations and outdated software. Injection tools (sqlmap) automate the steps of in-band and blind SQL injection. All of them send large numbers of requests that look hostile in any log, and some (sqlmap in particular) can change or damage data. They belong only in an authorised test, with the target, rate and techniques agreed in writing (Authorization, Scope and Rules of Engagement). This lesson shows each as a lab session against the lab's Juice Shop, then rebuilds the core of a content-discovery tool in your sandbox and looks at it from the defender's log.
Scope for the lab sessions below: an authorised home lab. Target
juice.lab.test(10.10.0.20, OWASP Juice Shop) on the isolated network10.10.0.0/24; tester10.10.0.5; rate limited to 20 requests per second; no destructive techniques. Output is shortened.
ffuf: fuzz a path
FUZZ marks where each word of the list goes; -mc matches status codes, -fs filters out responses of a given size (single-page apps answer every path with the same page, which must be filtered), -rate caps requests per second.
lab-session$ ffuf -u https://juice.lab.test/FUZZ -w ~/lab/wordlists/common.txt -mc 200,301,302,401,403 -fs 3748 -rate 20
ftp [Status: 200, Size: 11072, Words: 1568, Lines: 357]
api-docs [Status: 301, Size: 179, Words: 7, Lines: 11]
metrics [Status: 200, Size: 9421, Words: 389, Lines: 112]
promotion [Status: 200, Size: 6586, Words: 560, Lines: 111]
robots.txt [Status: 200, Size: 28, Words: 3, Lines: 2]
:: Progress: [4750/4750] :: Job [1/1] :: 20 req/sec :: Duration: [0:03:58] :: Errors: 0 ::Gobuster: the same idea, another tool
lab-session$ gobuster dir -u https://juice.lab.test -w ~/lab/wordlists/common.txt -t 4 --exclude-length 3748 --delay 200ms
/ftp (Status: 200) [Size: 11072]
/api-docs (Status: 301) [Size: 179] [--> /api-docs/]
/metrics (Status: 200) [Size: 9421]
/robots.txt (Status: 200) [Size: 28]An exposed /ftp directory listing and a public /metrics endpoint are findings in themselves (API9 inventory, A02 misconfiguration).
Nikto: known files and configuration
lab-session$ nikto -h https://juice.lab.test -Tuning 23b -maxtime 10m
+ Target IP: 10.10.0.20
+ Target Hostname: juice.lab.test
+ /: The site uses TLS and the Strict-Transport-Security HTTP header is not defined.
+ /robots.txt: contains 1 entry which should be manually viewed.
+ /ftp/: Directory indexing found.
+ /: Access-Control-Allow-Origin: * header found. (Cross-domain policy)
+ 6544 requests: 0 error(s) and 4 item(s) reported on remote hostNikto is loud and its findings need triage, but it is a quick way to spot defaults and forgotten files.
sqlmap: confirming injection in scope
sqlmap tests a parameter with boolean, error, UNION, stacked and time-based techniques and, once confirmed, can enumerate the database. Within an engagement, testers keep it to proof: confirm the injection, show the DBMS and the current user, and stop, rather than dumping real data (--level/--risk low, no --os-shell, which the rules of engagement usually forbid).
lab-session$ sqlmap -u "https://juice.lab.test/rest/products/search?q=apple" -p q --batch --level 1 --risk 1 --delay 0.1 --current-user
[INFO] testing connection to the target URL
[INFO] testing if GET parameter 'q' is dynamic
[INFO] heuristic (basic) test shows that GET parameter 'q' might be injectable (possible DBMS: 'SQLite')
[INFO] GET parameter 'q' appears to be 'SQLite AND boolean-based blind - WHERE or HAVING clause' injectable
[INFO] GET parameter 'q' is 'Generic UNION query (NULL) - 9 columns' injectable
GET parameter 'q' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
sqlmap identified the following injection point(s) with a total of 54 HTTP(s) requests:
---
Parameter: q (GET)
Type: boolean-based blind
Type: UNION query
---
[INFO] the back-end DBMS is SQLite
[WARNING] on SQLite it is not possible to enumerate the current userThe two techniques sqlmap names are the ones built by hand earlier in this course; the 54 requests are the boolean probes and the column-count search.
The core of a content-discovery tool, in your sandbox
A word list, a loop, and a filter on status codes: that is ffuf without the speed. The session serves a small site on 127.0.0.1, runs the loop, and then reads the server's own log the way a defender would.
mkdir -p www/admin www/backup && echo home > www/index.html && echo panel > www/admin/index.html
echo "db dump placeholder" > www/backup/db.sql && echo "User-agent: *" > www/robots.txt
python3 -m http.server 8000 --bind 127.0.0.1 --directory www >access.log 2>&1 &
for i in $(seq 50); do curl -s -o /dev/null http://127.0.0.1:8000/ && break; sleep 0.1; done
skip=$(wc -l < access.log) # lines from the readiness check
printf '%s\n' admin api backup backup/db.sql config .env login old robots.txt server-status test uploads > words.txt
echo "== discovery: status and size for each word, 404s hidden"
while read -r w; do
curl -s -o /dev/null -w "%{http_code} %{size_download} /$w\n" "http://127.0.0.1:8000/$w"
done < words.txt | awk '$1 != 404 {printf " /%-15s status %s, %s bytes\n", substr($3, 2), $1, $2}'
kill %1; wait 2>/dev/null
echo "== the defender's view: one client, many 404s in a short time"
tail -n +$((skip + 1)) access.log | grep '"GET ' > requests.log
awk '{print $1, $(NF-1)}' requests.log | sort | uniq -c | awk '{printf " %s requests from %s with status %s\n", $1, $2, $3}'
echo " 404 ratio: $(grep -c '" 404 ' requests.log)/$(wc -l < requests.log)"== discovery: status and size for each word, 404s hidden
/admin status 301, 0 bytes
/backup status 301, 0 bytes
/backup/db.sql status 200, 20 bytes
/robots.txt status 200, 14 bytes
== the defender's view: one client, many 404s in a short time
2 requests from 127.0.0.1 with status 200
2 requests from 127.0.0.1 with status 301
8 requests from 127.0.0.1 with status 404
404 ratio: 8/12
Four of twelve guesses existed, including a database backup nobody linked to. On the server side the pattern is unmistakable: one address, a burst of requests for unrelated paths, two thirds of them 404. Rate-based rules on 404 ratios per client, plus alerts on requests for known sensitive names (.env, backup, .git/, server-status), catch this kind of tool in seconds; a WAF or a tool like fail2ban can then slow or block the source.
How tool-driven scans are detected and handled
- Logs: high request rates, many 404/403s, sequential or dictionary-like paths, tool user agents (
Fuzz Faster U Fool,gobuster,Nikto,sqlmap/1.x; trivially changed, so don't rely on them), sqlmap's characteristic payloads (AND 1234=1234,UNION ALL SELECT NULL,NULL…). - Response: rate limiting and temporary blocks per source; making sure 404s are cheap; not serving backups,
.gitdirectories or.envfiles from the web root in the first place. - For your own tests: tell the operations team in advance, use an agreed source address and user agent, and give them your test window, so a real attack in the same window isn't mistaken for you.
Pitfalls
- Huge word lists at full speed against a small server are a denial-of-service test nobody agreed to: rate-limit.
- Trusting tool output without manual confirmation: soft-404 pages, WAF block pages and SPAs fool status-code filters; check sizes and content.
- sqlmap's
--dumpon a real system copies personal data into your laptop: you now hold it, with all the legal obligations that brings. Prove, don't harvest.
Practice
1. A single-page app answers every path with 200 and the same 3,748-byte page. How do you make ffuf useful?
Filter by size (-fs 3748) or by words/lines (-fw, -fl), or match on content (-mr with a regex only real pages contain). Check a few results by hand.
2. Your WAF log shows User-Agent: sqlmap/1.8 from an unknown address against the search endpoint. What do you do?
Treat it as an attack in progress: block or rate-limit the source, check whether the endpoint is injectable (and fix it), review database and application logs for what was returned, and look for the same payload patterns from other addresses with ordinary user agents.
Test yourself
What does content discovery do?
- Cracks passwords
- Requests paths from a word list to find pages and files nobody linked
- Decrypts TLS
- Scans ports
Why should sqlmap usage in an engagement stop at proof?
- sqlmap is slow
- Dumping real data creates legal and privacy obligations and is usually outside the rules of engagement
- It can't dump data
- Proof is not needed
Which server-side signal reveals the discovery loop in the sandbox?
- One TLS handshake
- One client sending many requests for unrelated paths, most of them 404
- A single 200
- Cookies