SQLmap
Dumping tables
Examples
Target the http://target.server.com URL using the -u flag:
Specify POST requests by specifying the -data flag:
Target a vulnerable parameter in an authenticated session by specifying cookies using the -cookie flag:
Drop all Set-Cookie requests from the target web server using the -drop-set-cookie flag:
Perform in-depth and risky attacks using the -level and -risk flags:
Specify which POST or GET parameter to target using the -p flag:
Choose a random User-Agent request header using the –random-agent flag:
Target a certain database service using the –dbms flag:
Read a request (stored via Burpsuite) target the user parameter (and no other parameters), run risky queries, and dump users and passwords:
Attempt privilege escalation on the target database
Dump everything in the database, but wait one second in-between requests.
Post-Exploit
Error-Based SQLi, dump all data from a MSSQL Database :
Flags
Here are some useful options for your pillaging pleasure:
-r req.txt Specify a request stored in a text file, great for saved requests from BurpSuite.
--force-ssl Force SQLmap to use SSL or TLS for its requests.
--level=1 only test against the specified parameter, ignore all others.
--risk=3 Run all exploit attempts, even the dangerous ones (could damage database).
--delay Set a delay in-between requests, great for throttled connections.
--proxy Set to http://127.0.0.1:8080 to pipe requests through BurpSuite for inspection.
--privesc Attempt to elevate the privileges of the database service account.
--all Enumerate everything inside the target database.
--hostname Print the target database’s hostname.
--passwords Find and exfiltrate all users and their password hashes or digests.
--dbs Enumerate all databases accessible via the target webserver.
--comments Enumerate all found comments inside the database.
--sql-shell Return a SQL prompt for interaction.
--os-cmd Attempt to execute a system command.
--os-shell Attempt to return a command prompt or terminal for interaction.
--reg-read Read the specified Windows registry key value.
--file-write Specify a local file to be written to the target server.
--file-dest Specify the remote destination to write a file to.
--technique= Specify a letter or letters of BEUSTQ to control the exploit attempts:
B: Boolean-based blindE: Error-basedU: Union query-basedS: Stacked queriesT: Time-based blindQ: Inline queries
Last updated
Was this helpful?