Skip to content
SQL injection Disclosed report Beginner

Time-based blind SQL injection

The sortBy parameter of a document search page was inserted into a SQL query without proper handling, so a crafted value could make the database pause before answering. An attacker could use those timing differences to confirm the injection and then guess database contents one character at a time.

leofmlopes Follow

Originally disclosed on HackerOne

  • Triaged in 13 hours
  • Fixed in 3 months
  • Disclosed after 4 months

Description: A time-based blind SQL injection vulnerability was discovered at https://█████/app/SearchDocs.aspx?doctypes=19&filename=*&sdate=&edate=&content=&sortBy=1%20WAITFOR%20DELAY%20%270%3a0%3a5%27--%20udTV&sortOrder=&custom={%22customFields%22%3A[]}, when this request is sent, it is possible to manipulate the server's response time. This type of vulnerability can potentially be exploited to extract sensitive information from the database or even gain full control over the application's backend. The vulnerable parameter is the sortBy parameter.

References

OWASP SQL Injection https://owasp.org/www-community/attacks/SQL_Injection

Similar report https://hackerone.com/reports/2312334

Impact

This vulnerability allows an attacker to:

  • Confirm the existence of SQL injection by observing server response delays
  • Potentially extract sensitive information from the database, such as usernames, passwords, or other critical data.

The sensitive information could be extracted by sending payloads like "IF (SUBSTRING(DB_NAME(), 1, 1) = 'A') WAITFOR DELAY '00:00:05'; --". In this example, if the response is delayed, the attacker would know that the database name starts with 'A', then they would keep sending more payloads until they discover the full database name. They could also discover more information using the same method, like table names, column names and records stored in the database

System Host(s)

██████████

Steps to Reproduce

  1. Open a browser
  • The vulnerability can be tested directly in the browser by altering the URL parameters
  1. Insert the following URL:

https://███/app/SearchDocs.aspx?doctypes=19&filename=*&sdate=&edate=&content=&sortBy=1%20WAITFOR%20DELAY%20%270%3a0%3a5%27--%20udTV&sortOrder=&custom={%22customFields%22%3A[]}

  • This request is injecting a delay in the sortBy parameter. After sending the request, notice the server's response is delayed by 5 seconds
  1. Insert the following URL:

https://███████/app/SearchDocs.aspx?doctypes=19&filename=*&sdate=&edate=&content=&sortBy=1%20WAITFOR%20DELAY%20%270%3a0%3a0%27--%20udTV&sortOrder=&custom={%22customFields%22%3A[]}

  • This request has no delay, it returns immediately
  1. These two requests have different response times, which confirms the presence of a time-based blind SQL injection vulnerability

In the following video, I recorded a demontration of the vulnerability using Burp Suite. First, a request with a 5-second delay is sent. Then another one with a 0-second delay is sent. The difference in response times can be clearly seen ██████

Suggested Mitigation/Remediation Actions

  • Implement input validation to prevent SQL queries from being executed. User-supplied data should be validated and sanitized to remove potentially harmful characters, such as single quotes ('), semicolons (;), and SQL keywords
  • Use prepared statements and parameterized queries. User-supplied data should not be concatenated in SQL queries

The original report as published on HackerOne, by leofmlopes. 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 sortBy parameter was concatenated directly into a SQL query instead of being bound as a parameter, letting injected SQL run.

Impact

An attacker could confirm the injection through response delays and could potentially extract sensitive data such as usernames, passwords, table names and records, though the report only demonstrates the timing confirmation.

What the attacker needed

Reachable search page; no authentication stated

The fix

The parameter should be handled with prepared statements and parameterised queries so user input is never concatenated into SQL, with input validation as an extra layer.

How it was found

  1. Open a browser and load the document search page.
  2. Send a request whose sortBy value contains a five-second delay instruction.
  3. Observe that the server response is delayed by about five seconds.
  4. Send the same request with a zero-second delay and see it return immediately.
  5. Compare the two response times to confirm 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.

A database query is a question the website asks its database, and the site builds that question partly from what you type in the address bar. Here the sortBy value was pasted straight into the question, so the attacker could add their own database instruction that makes the server wait five seconds. Because the page never shows the data, the attacker learns answers by timing how long the reply takes.

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 leofmlopes

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.