Skip to content
SQL injection Disclosed report Intermediate

Blind SQL Injection

The User-Agent header of a web application was inserted into a back-end SQL statement without filtering, so an attacker could inject SQL. By using time-based sleep queries the attacker could confirm the injection and infer information from the database through response delays.

mido0x0x Follow

Originally disclosed on HackerOne

  • Triaged in under an hour
  • Fixed in 18 days
  • Disclosed after 2.3 years

###Bug is : Blind Sql injection

SQL injection is a vulnerability that allows an attacker to alter back-end SQL statements by manipulating the user input. An SQL injection occurs when web applications accept user input that is directly placed into a SQL statement and doesn't properly filter out dangerous characters.


###Vulnerability in : https://███/ via User-Agent: I've confirmed the vulnerability using sleep SQL queries with various arithmetic operations. The sleep command combined with the arithmetic operations will cause the server to sleep for various amounts of time depending on the result of the arithmetic operation.


###Proof of concept : 1- open https://███/ and intercept data 2- put this payload in user agent parameter if(now()=sysdate(),sleep(10),0)/*'XOR(if(now()=sysdate(),sleep(10),0))OR'"XOR(if(now()=sysdate(),sleep(10),0))OR"*/ like poc 1 and as you see in poc 1 make sleep order for 10 sec 3- and if we change order to make sleep for 5 sec if(now()=sysdate(),sleep(5),0)/*'XOR(if(now()=sysdate(),sleep(5),0))OR'"XOR(if(now()=sysdate(),sleep(5),0))OR"*/ like poc 2


###Fix : Your script should filter metacharacters from user input. Check detailed information for more information about fixing this vulnerability

Impact

An attacker can manipulate the SQL statements that are sent to the MySQL database and inject malicious SQL statements. The attacker is able to change the logic of SQL statements executed against the database.

The original report as published on HackerOne, by mido0x0x. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 the raw User-Agent header value into a SQL query instead of using parameterised queries or filtering metacharacters.

Impact

An attacker could change the logic of SQL statements run against the MySQL database.

What the attacker needed

Ability to send a crafted User-Agent header

The fix

The script should filter metacharacters from user input.

How it was found

  1. Open the target site and intercept the request.
  2. Place a time-based SQL payload in the User-Agent header.
  3. Observe the server delaying for ten seconds.
  4. Change the payload to a five-second delay and observe the shorter delay.

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.

When a website builds a database query by pasting in text the user supplied, a malicious user can add extra database instructions. Here the text came from the browser's User-Agent header, which is easy to change. The tester made the database pause for a set number of seconds to prove the injected instructions were actually running.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by mido0x0x

View all

1 more disclosed report, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.