sqlmap

The standard open-source engine for automated SQL injection detection and database takeover, covering every injection channel across all major DBMS.

What it does

sqlmap automates the full SQLi lifecycle: detecting injectable parameters, fingerprinting the DBMS, choosing an exploitation technique, and enumerating or exfiltrating the database — down to OS-level takeover where the engine and privileges allow (StationX cheat sheet). It supports all five technique families, abbreviated BEUSTQ: Boolean-blind, Error-based, Union, Stacked queries, Time-blind, and in-line Queries, plus out-of-band. It covers MySQL/MariaDB, PostgreSQL, MSSQL, Oracle, SQLite and many more.

Core workflow

  • Targeting — point it at a URL, a saved Burp request file (-r), or crawl a site; it marks parameters to test across query string, body, cookies, headers, JSON, and path (target options).
  • Detection tuning — --level (how many parameters/places to probe, incl. headers/cookies) and --risk (how aggressive the payloads) trade coverage for noise; --technique restricts to specific channels (e.g. boolean-only against a WAF).
  • Fingerprint & enumerate — identify the DBMS/version, then list databases, tables, columns, and dump rows; search for tables/columns by name.
  • Escalation — where the role permits: file read/write and OS shell/command primitives (--os-shell), reproducing the engine-specific paths in SQL Injection to RCE.

Against WAFs and in bug bounty

  • Tamper scripts apply bypass transforms (encoding, comment/space substitution, case) to defeat signature filters; the usual flow is to confirm the injection manually in Burp Repeater, then hand sqlmap the exact request plus the tamper(s) and technique that worked (WAF bypass with sqlmap, WAF Bypass for SQL Injection). A proxy option routes traffic through Burp; a modified User-Agent and --not-string help in filtered/blind contexts.
  • Bug-bounty use — scope it to in-scope hosts, feed saved requests rather than blind crawling, and prefer low --level/--risk first to avoid disruptive payloads (full potential of sqlmap). Pairing content discovery/fuzzing to find candidate parameters, then sqlmap to confirm, is a common fast path (ffuf + sqlmap).

In practice (cases)

  • --level 5 --risk 3 matters. On Georgia DCSS (IBM DB2) defaults found nothing; level 5 / risk 3 unlocked heavy-query time payloads that confirmed the ssn injection ($60k Georgia DHS).
  • Saved request + -p is the standard handoff after manual confirmation: -r req.txt --dbs dumped 22 databases on a Bugcrowd P1 (blind SQLi in a private program); -r request.txt -p q --batch found boolean and time-based blind on SQLite in picoCTF, where --dbs is unsupported so you go straight to --tables, and --threads 10 speeds blind dumping (picoCTF Sql Map1).
  • Burp-captured login form → -r login.req --dbs, then -D <db> -T users --dump recovered admin credentials in the Ghost Render CTF; the author notes reconciling the DB name against the actual output rather than notes (Ghost Render CTF).
  • --technique=B --dbms=... reproduced a hand-built Oracle boolean extraction in one command (SQLi at NASA).

Caveats

Automation misses context-dependent sinks (second-order, identifier-only injection, unusual encodings) that manual testing catches — treat sqlmap as confirmation/extraction, not discovery, for non-trivial targets. Aggressive --risk/--os-shell can modify data or execute commands; use with authorization and care. Alternatives/complements: ghauri, jSQL, BBQSQL, SqliSniper (header-focused time-based), NoSQLMap (NoSQL Injection), surveyed in the detection-tool roundup (SQLi detection tools).

Sources