Diagnostic playbook
Blind SQL injection (boolean-based and time-based)
Injection / SQL Injection
Knowledge identity
Definition and taxonomy
Summary
Blind SQL injection where the application reveals no query data and suppresses errors, but the query result (row exists or not) or execution delay is attacker-controlled, giving a binary oracle for extracting data.
Severity rationale
Demonstrated full boolean oracle (exists vs missing) and 3-second time-based delay in an authorized lab. Blind data extraction of the seeded users table is possible one character at a time. In a real app this leads to full database read; impact limited here to read-only seeded data.
Aliases
Boolean-based blind SQLi, Time-based blind SQLi
Standards
CWE-89 CAPEC-7 A03:2021-Injection
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N
1. First Signal
What should make an agent suspicious
Symptoms
No row data ever returned; only 'User ID exists in the database.' vs 'User ID is MISSING from the database.'; injecting AND 1=1 keeps 'exists', AND 1=2 flips to 'missing'; SLEEP(3) inflates response time to ~3s.
Prerequisites
Authorized lab session. Parameter reaches an SQL WHERE clause. Application gives boolean feedback (exists/missing) or executes injected functions affecting timing. No query output and errors suppressed.
2. Recognition Logic
How to recognize this next time
If a parameter does not echo data but changes an exists/missing message with boolean conditions, it is a boolean blind oracle. If timing responds to SLEEP(), use time-based extraction. Try the same payload in GET, POST, and cookie contexts because the input transport changes by level.
3. Diagnostic Procedure
Safe checks, in order
- Confirm authorized scope. 2. Baseline a real id and confirm the exists message. 3. Send AND 1=1 vs AND 1=2 (quoted context: AND '1'='1) and confirm the message flips. 4. Send AND SLEEP(3) and measure response time. 5. Enumerate data one character at a time only if needed, using the oracle. 6. Run negative control with a non-existent id. 7. Record context (quote type, numeric vs string, transport) since payloads differ.
4. Proof
Evidence
DVWA sqli_blind: low GET id=1' AND '1'='1 -> exists, id=1' AND '1'='2 -> missing, id=1' AND SLEEP(3)# -> 3.01s. Medium POST id=1 AND 1=1 -> exists, AND 1=2 -> missing, AND SLEEP(3) -> 3.02s. High Cookie id=1' AND SLEEP(3)# -> 3.01s.
5. Controls
Negative checks
id=999 always returns MISSING; SLEEP probe without the injection context returns immediately (<0.01s); at impossible level (prepared statements) the same probes do not flip the message.
6. Avoid Bad Memory
False positives and traps
A parameter that echoes data is not blind. Timing noise from network can mimic time-based SQLi; verify by repeating SLEEP with different values. An exists/missing message that does not change with injected boolean is not an oracle.
7. Why It Matters
Impact
Full read of the target database one bit at a time: usernames, password hashes, schema. High severity in real apps; in this lab limited to read-only seeded data.
8. Why It Happened
Root cause
User input concatenated into SQL WHERE clause without prepared statements. The app suppresses direct output and errors but still evaluates the injected boolean/timing expression, exposing a side-channel oracle.
9. Fix
Remediation and prevention
Use parameterized queries/prepared statements everywhere. Never evaluate user input inside SQL. Disable SLEEP/BENCHMARK functions or restrict DB privileges. Add generic error pages and rate limiting for probing.
10. Re-test
Verification steps
- After fix, send AND 1=1 and AND 1=2 - both should return the same result for a real id. 2. Send SLEEP(3) and confirm response is fast. 3. Confirm errors remain generic. 4. Add regression tests asserting no message flip and no timing difference.
Reference
Tools and sources
Tools used
curl for requests and timing, docker exec for read-only source review
References
OWASP Blind SQL Injection; CWE-89; PortSwigger Blind SQLi testing guide
Intelligence
Products and history
Technologies
PHP, MariaDB, Apache
Affected products / versions
DVWA (Damn Vulnerable Web Application) current master
History
First documented in DVWA sqli_blind module across low/medium/high in the 2026-08 benchmark run.
Exploit knowledge
Variants and references
Attack surface
User-controllable id parameter (GET query, POST body, or cookie) concatenated into a WHERE clause; application only reveals boolean success/failure or timing.
Exploit maturity
proof-of-concept
Known variants
Boolean-based blind (row exists vs missing text), Time-based blind (SLEEP/BENCHMARK delay), Cookie/session-based blind input (high level), Numeric-context blind bypassing mysqli_real_escape_string (medium level)
Defensive signatures
Repeated id requests with crafted AND/OR boolean conditions, SLEEP() functions in query parameters or cookies, measurable response-time differences between true and false conditions, existence text that flips with the injected condition
Reproduction commands
Boolean oracle (DVWA low, quoted context): curl -s -b $JAR "http://127.0.0.1:4280/vulnerabilities/sqli_blind/?id=1%27%20AND%20%271%27=%271&Submit=Submit" # User ID exists curl -s -b $JAR "http://127.0.0.1:4280/vulnerabilities/sqli_blind/?id=1%27%20AND%20%271%27=%272&Submit=Submit" # User ID is MISSING Time-based (low, quoted): curl -s -b $JAR -w "%{time_total}s" "http://127.0.0.1:4280/vulnerabilities/sqli_blind/?id=1%27%20AND%20SLEEP(3)%23&Submit=Submit" # ~3.0s Numeric context (medium, POST): curl -s -b $JAR -d "id=1 AND 1=1&Submit=Submit" http://127.0.0.1:4280/vulnerabilities/sqli_blind/ Cookie context (high): curl -s -b $JAR --cookie "id=1%27%20AND%20SLEEP(3)%23" http://127.0.0.1:4280/vulnerabilities/sqli_blind/
Exploit references
No external references stored; all evidence is from the authorized local lab.
Case provenance