Skip to content

Lesson 3 of 9 · 27m

Blind and Time-Based Injection: When Nothing Is Printed

Boolean inference, timing side channels, chunked extraction, and why blind injection is still high impact even when no data is reflected.

Most serious SQL injection findings are blind. The application does not print SQL errors or query results; it merely behaves differently. That is enough. If a predicate you control can influence the response, you can ask the database yes/no questions and reconstruct data one bit or byte at a time.

Boolean-based inference

Imagine a stock lookup that returns “in stock” when the predicate is true and nothing when it is false:

AND (SELECT ASCII(SUBSTRING(password_hash,1,1)) FROM users WHERE username='admin') > 77

If the response differs when the comparison is true, the application has become an oracle. Testers binary-search character values instead of guessing all 256 possibilities. This is slow and noisy, but deterministic enough against stable applications.

Time-based inference

Sometimes boolean output is too inconsistent. Then a conditional delay becomes the signal:

-- PostgreSQL concept example
AND (CASE WHEN ascii(substring(current_database(),1,1)) > 100
     THEN pg_sleep(3) ELSE pg_sleep(0) END) IS NOT NULL

Vendor syntax varies widely. MySQL commonly uses SLEEP(3) inside conditional expressions; SQL Server uses WAITFOR DELAY '0:0:3', though it is not always trivially injectable inside every expression. A senior tester treats exact syntax as database-specific detail, not trivia to memorize blindly.

Measurement beats vibes

A single slow response proves nothing. Networks jitter, workers restart, and caches warm. Build a baseline:

10 control requests: median 84 ms, p95 112 ms
10 true-condition requests: median 3018 ms, p95 3210 ms
10 false-condition requests: median 89 ms, p95 118 ms

That separation is evidence. One request that took three seconds is an anecdote.

Reducing noise and blast radius

  • Extract only the minimum artifact needed to prove impact, such as current_user or database version length.
  • Use low concurrency; parallel timing probes distort each other.
  • Prefer deterministic boolean behavior when available; reserve timing for cases with no cleaner oracle.
  • Test rate limits and application timeouts before deciding that “it does not work.”

Automated help with discipline

sqlmap -u 'https://target.internal/search?q=test'   --technique=T --time-sec=2 --threads=1 --batch   --dbms=mysql --current-user

Use tooling to accelerate repetition, but inspect what it sends. Blind testing can generate thousands of requests, and “the scanner did it” is not a defense when you exhaust a connection pool.

Field notes

  • A missing response is not proof of safety. Blind injection often looks like ordinary validation failure.
  • Timing below one second is usually unreliable on shared infrastructure; use clear separation or do not claim the result.
  • Prepared statements break these techniques because input never becomes grammar, not because the payloads are filtered.
  • Blind extraction against production can become a denial-of-service issue. Rules of engagement should cap request count and duration.

Was this lesson helpful?

Sign in to rate