SQLMap is a Python-based SQLi detection and exploitation engine. It fingerprints the backend, tries every applicable payload class, and — when privileges allow — escalates straight to a file read or OS shell. Point it at a URL or a Burp request and let the defaults run.

Install

Pre-installed on most pentest distros and the HTB Pwnbox.

# Debian/Kali
sudo apt install sqlmap
 
# Manual (latest dev)
git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
cd sqlmap-dev
python sqlmap.py -h

Help

sqlmap -h      # basic options
sqlmap -hh     # full option list

Supported Databases

Full support covers MySQL, PostgreSQL, Microsoft SQL Server, Oracle, SQLite, MariaDB, IBM DB2, Sybase, SAP MaxDB, Firebird, Informix, HSQLDB, H2, CockroachDB, TiDB, MemSQL, Amazon Redshift, Vertica, Presto, Greenplum, CrateDB, Apache Derby, MonetDB, Cubrid, and many more.

Supported SQLi Techniques — BEUSTQ

B — Boolean-based blind     (AND 1=1 style differential)
E — Error-based             (surfaces data via forced DBMS errors)
U — UNION query             (fastest — whole table in one request)
S — Stacked queries         (; DROP ... — needs stacked-queries support)
T — Time-based blind        (AND IF(..., SLEEP(5), 0))
Q — Inline queries          (rare; nested SELECT inside original)

Default is all six. Restrict with --technique=:

sqlmap -u "http://target/?id=1" --technique=BEU      # skip slow time-based
sqlmap -u "http://target/?id=1" --technique=E        # error-based only

Also supported: Out-of-band via DNS exfiltration — the attacker runs SQLMap on the authoritative DNS server for a domain under control and reads the exfiltrated query results from inbound DNS queries.

First Run

sqlmap -u "http://www.example.com/vuln.php?id=1" --batch
  • -u — target URL
  • --batch — auto-answer every prompt with the default (skip prompts)

SQLMap will test connection stability, confirm the parameter is dynamic, run a heuristic probe, fingerprint the DBMS, and iterate through payload classes. A successful run ends with a block listing every confirmed injection point, its type, title, and payload.

Output Directory

Results live under:

~/.sqlmap/output/<target>/
├── log              # confirmed injection points
├── session.sqlite   # cached findings (reused on next run)
├── dump/            # --dump output (CSV by default)
└── files/           # --file-read results

Use --flush-session

SQLMap aggressively caches findings in session.sqlite. If a prior run cached a false positive or you changed the target behavior, pass --flush-session to force a fresh scan.

Key Log Messages

MessageMeaning
target URL content is stableResponses are consistent — clean baseline for diffing
parameter appears to be dynamicValue changes response — good sign
heuristic (basic) test shows that GET parameter 'id' might be injectableError-triggered — not proof, but worth pursuing
reflective value(s) found and filtering outPayload echoed in response — noise filter engaged
parameter appears to be ... injectable (with --string="...")Pinned a TRUE signal — fewer false positives
parameter is vulnerableConfirmed exploitable — final proof
fetched data logged to text files under ...Where your output lives

Boundaries + Vector

Every SQLMap payload is boundary + vector. The boundary (prefix/suffix) breaks out of the surrounding SQL context; the vector is the actual injection. SQLMap’s default boundary list handles almost every case, but you can force one with --prefix="')" and --suffix="-- -" when fingerprinting goes sideways.