Tool Documentation:
sqlmap Usage Example
Attack the given URL (-u “http://192.168.1.250/?p=1&forumaction=search”) and extract the database names (–dbs):
root@kali:~# sqlmap -u "http://192.168.1.250/?p=1&forumaction=search" --dbs
___
__H__
___ ___[)]_____ ___ ___ {1.2.11#stable}
|_ -| . ["] | .'| . |
|___|_ ["]_|_|_|__,| _|
|_|V |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting at 13:37:00
[13:37:00] [INFO] testing connection to the target URL
Testing a captured HTTP request
During an authorized web application assessment, it is often more accurate to give sqlmap the exact HTTP request captured in Burp Suite than to reconstruct the URL, POST body, and session cookies manually.
Save the request from Burp to a text file such as request.txt. A minimal example looks like this:
POST /products.php HTTP/1.1
Host: app.example.test
Cookie: session=YOUR_AUTHORIZED_SESSION
Content-Type: application/x-www-form-urlencoded
id=10&view=detail
Run sqlmap against the saved request and select only the parameter being assessed:
sqlmap -r request.txt -p id --batch --level=1 --risk=1
The -r option loads the raw HTTP request, while -p id limits testing to the named parameter. The example keeps the default testing depth and risk settings; it does not enumerate or dump database contents.
For a POST request supplied directly on the command line, use --data and select the parameter in the same way:
sqlmap -u 'https://app.example.test/login' \
--data='username=test&password=test' \
-p username --batch --level=1 --risk=1
Reviewing and refreshing a test
When diagnosing a result, compare the selected parameter with the original request and review the HTTP behavior before increasing test coverage. The --flush-session option clears the stored session data for the current target and forces sqlmap to run the tests again:
sqlmap -r request.txt -p id --flush-session --batch --level=1 --risk=1
The --batch switch only answers interactive prompts automatically; it is not a safety control. Obtain explicit authorization, keep the test within the agreed scope, and coordinate potentially disruptive checks with the application owner. Avoid increasing --risk or running data extraction against production systems unless the rules of engagement explicitly permit it.
Packages and Binaries:
sqlmap
Automatic SQL injection tool
sqlmap goal is to detect and take advantage of SQL injection
vulnerabilities in web applications. Once it detects one or more SQL
injections on the target host, the user can choose among a variety of
options to perform an extensive back-end database management system
fingerprint, retrieve DBMS session user and database, enumerate users,
password hashes, privileges, databases, dump entire or user’s specific
DBMS tables/columns, run his own SQL statement, read specific files on
the file system and more.
Installed size: 13.00 MB
How to install: sudo apt install sqlmap
Dependencies:
- python3
- python3-magic
sqlmap
Automatic SQL injection tool
root@kali:~# sqlmap -h
___
__H__
___ ___[,]_____ ___ ___ {1.10.9#stable}
|_ -| . [,] | .'| . |
|___|_ [.]_|_|_|__,| _|
|_|V... |_| https://sqlmap.org
Usage: python3 sqlmap [options]
Options:
-h, --help Show basic help message and exit
-hh Show advanced help message and exit
--version Show program's version number and exit
-v VERBOSE Verbosity level: 0-6 (default 1)
Target:
At least one of these options has to be provided to define the
target(s)
-u URL, --url=URL Target URL (e.g. "http://www.site.com/vuln.php?id=1")
-g GOOGLEDORK Process Google dork results as target URLs
Request:
These options can be used to specify how to connect to the target URL
--data=DATA Data string to be sent through POST (e.g. "id=1")
--cookie=COOKIE HTTP Cookie header value (e.g. "PHPSESSID=a8d127e..")
--random-agent Use randomly selected HTTP User-Agent header value
--proxy=PROXY Use a proxy to connect to the target URL
--tor Use Tor anonymity network
--check-tor Check to see if Tor is used properly
Injection:
These options can be used to specify which parameters to test for,
provide custom injection payloads and optional tampering scripts
-p TESTPARAMETER Testable parameter(s)
--dbms=DBMS Force back-end DBMS to provided value
Detection:
These options can be used to customize the detection phase
--level=LEVEL Level of tests to perform (1-5, default 1)
--risk=RISK Risk of tests to perform (1-3, default 1)
Techniques:
These options can be used to tweak testing of specific SQL injection
techniques
--technique=TECH.. SQL injection techniques to use (default "BEUSTQ")
Enumeration:
These options can be used to enumerate the back-end database
management system information, structure and data contained in the
tables
-a, --all Retrieve everything
-b, --banner Retrieve DBMS banner
--current-user Retrieve DBMS current user
--current-db Retrieve DBMS current database
--passwords Enumerate DBMS users password hashes
--dbs Enumerate DBMS databases
--tables Enumerate DBMS database tables
--columns Enumerate DBMS database table columns
--schema Enumerate DBMS schema
--dump Dump DBMS database table entries
--dump-all Dump entries of all DBMS database tables
-D DB DBMS database to enumerate
-T TBL DBMS database table(s) to enumerate
-C COL DBMS database table column(s) to enumerate
Operating system access:
These options can be used to access the back-end database management
system underlying operating system
--os-shell Prompt for an interactive operating system shell
--os-pwn Prompt for an OOB shell, Meterpreter or VNC
General:
These options can be used to set some general working parameters
--batch Never ask for user input, use the default behavior
--flush-session Flush session files for current target
Miscellaneous:
These options do not fit into any other category
--wizard Simple wizard interface for beginner users
[!] to see full list of options run with '-hh'
sqlmapapi
Automatic SQL injection tool, api server
root@kali:~# sqlmapapi -h
Usage: sqlmapapi [options]
Options:
-h, --help show this help message and exit
-s, --server Run as a REST API server
-c, --client Run as a REST API client
-H HOST, --host=HOST Host of the REST API server (default "127.0.0.1")
-p PORT, --port=PORT Port of the REST API server (default 8775)
--adapter=ADAPTER Server (bottle) adapter to use (default "wsgiref")
--database=DATABASE Set IPC database filepath (optional)
--username=USERNAME Basic authentication username
--password=PASSWORD Basic authentication password
Learn more with OffSec
Want to learn more about sqlmap? get access to in-depth training and hands-on labs:
Updated on: 2026-Nov-10