Introduction to Blind SQLi

Non-Blind vs Blind SQLi

Non-Blind SQL Injection

The "easy-to-exploit" type where results are returned to the attacker.

Example: Vulnerable search feature

' UNION SELECT table_name, table_schema FROM information_schema.tables;--

Result: Tables listed directly in the response.


Blind SQL Injection

Attacker doesn't see query results - must rely on differences in response to infer data.

Example: Login form uses input in query but doesn't return output.


Two Categories of Blind SQLi

Type
Detection Method

Boolean-based (Content-based)

Differences in response (length, content)

Time-based

Response time differences

Note: All time-based techniques work in boolean-based scenarios. The opposite is not possible.


Boolean-Based SQLi

How It Works

  1. Inject query that evaluates to True or False

  2. Observe response differences

  3. Infer data bit by bit

Detection Signals

True Response
False Response

Longer response

Shorter response

"Email found"

"Email not found"

HTTP 200

HTTP 500

Content differs

Different content


Vulnerable Code Example

Vulnerability Analysis

Issue
Description

No sanitization

$_POST['email'] directly concatenated

String interpolation

Input placed inside SQL string

Different responses

"Found" vs "Not found" = oracle

Exploitation Logic


Time-Based SQLi

How It Works

  1. Inject sleep/delay command

  2. Measure response time

  3. Long response = True, Normal = False

Common Delay Functions

Database
Function

MSSQL

WAITFOR DELAY '0:0:5'

MySQL

SLEEP(5)

PostgreSQL

pg_sleep(5)

Oracle

DBMS_LOCK.SLEEP(5)

Example Payload

Condition
Response Time

1=1 (True)

~5 seconds

1=2 (False)

Immediate


Comparison

Aspect
Boolean-Based
Time-Based

Detection

Response content/length

Response time

Speed

Faster

Slower

Reliability

More reliable

Network latency issues

Stealth

Less detectable

Delays may trigger alerts

Compatibility

Needs visible difference

Works when no visible diff


When to Use Each

Boolean-Based

βœ… Response differs based on query result βœ… Need faster extraction βœ… Stable network conditions

Time-Based

βœ… No visible response difference βœ… Error messages suppressed βœ… Boolean detection not possible


Key Takeaways

  1. Blind SQLi = No direct output, infer from differences

  2. Boolean-based = Content/length differences

  3. Time-based = Response time differences

  4. Root cause = Same as regular SQLi (unsanitized input)

  5. Exploitation = Requires custom scripts for data extraction


Next Steps

Last updated