← All lessons Stage 3 · Lesson 2
25 min

Blind SQLi and time-based extraction

Stage 3 · Lesson 2 · 25 minutes · Requires Lesson 1


The one-line answer

Blind SQL injection is SQL injection where the page never shows query results — the attacker learns the answers one yes/no question at a time, from small differences in the response or in how long it takes.

The boundary: labs and your own local targets only. Blind SQLi testing often means many requests, which can load a real server and is clearly unauthorised testing if you don't have permission.


Why you should care

After Lesson 1, it's tempting to think "if the page doesn't show database errors or data, it's safe." It isn't. Most real-world SQLi today is blind, because modern apps hide errors and don't print query results directly. The bug is the same; only the way you observe it changes.

It's also a great lesson in thinking like a tester: if I can't see the answer, what can I measure instead?


How it actually works

What makes it "blind"

In Lesson 1, injected queries changed what appeared on the page. In blind SQLi, the query still runs with your input, but:

  • the page shows no data from it,
  • errors are hidden behind a generic page,
  • the response looks almost identical every time.

So you need a side channel — some observable difference that depends on whether something in the database is true.

Boolean-based inference (the concept)

Imagine a site that uses a tracking cookie to look you up and shows "Welcome back!" if the cookie matches a row:

SELECT id FROM tracking WHERE cookie_id = 'INPUT'

The page never shows the query result — only whether "Welcome back!" appears. That's one bit of information: yes or no.

If the input reaches the query unsafely, a tester can append a condition:

Appended conditionPage showsMeaning
a condition that's always true (e.g. 1=1)"Welcome back!"Your condition is being evaluated
a condition that's always false (e.g. 1=2)No messageConfirmed: you control part of the query

Once that's confirmed, the tester replaces "always true" with a real question about the data — for example, "is the first character of the administrator's password greater than m?" — and reads the yes/no answer from the page. Ask enough questions and you reconstruct the value, one character at a time. It's like the game 20 Questions.

Time-based inference (the concept)

Sometimes there's no visible difference at all — the page is identical whether the condition is true or false. Then the tester uses time as the signal: most databases have a way to pause, so the injected condition says, in effect, "if this is true, wait 10 seconds before answering."

ConditionResponse timeMeaning
true~10 secondsYes
false~0.2 secondsNo

Recall Stage 2 Lesson 2 — response time is shown at the bottom of Repeater. That number is the whole side channel here.

Slower, but just as serious

Blind SQLi takes far more requests than in-band SQLi — potentially thousands to extract one table. That makes it slow by hand, but the impact is the same: an attacker can eventually read anything the query can reach. Severity doesn't drop because the bug is inconvenient to exploit.

Why automated tools exist

Because blind extraction is repetitive, tools automate it. The best known is sqlmap, an open-source tool that detects and exploits SQLi automatically. Professionals use it on authorised tests to confirm and measure impact. Two points:

  • It is loud — it sends a very large number of requests. Against a site you aren't authorised to test, that's both illegal and easy to detect.
  • Learn the manual method first (PortSwigger labs). If you can't explain what the tool is doing, you can't explain the finding in a report (Lesson 11).

See it yourself

Only on PortSwigger's labs:

  1. Read the Blind SQL injection section of the learning path (link below).
  2. Do the lab on blind SQLi with conditional responses. In Repeater, first confirm the always-true vs always-false difference. Write down exactly what changes in the response.
  3. Do the lab on blind SQLi with time delays. Watch the response time in Repeater for true and false conditions.
  4. Note how many requests each lab needed. That number is why monitoring catches this (see below).

How attackers abuse this

Attackers target any input that reaches the database but shows nothing back — tracking cookies, search filters, sort parameters, API fields. Automated tools then run thousands of yes/no or timing requests until data comes out.

The defensive fix is exactly the same as Lesson 1, because the root cause is the same:

  • Parameterised queries / prepared statements — fix blind SQLi completely. The condition never becomes part of the query.
  • Least-privilege database accounts — limit what any one query can reach.
  • Input validation as a second layer.

And because blind SQLi is so noisy, detection works well:

  • Rate limiting per user or IP.
  • Alerting on many near-identical requests to one endpoint with changing input, or on requests that consistently take unusually long. This is a classic Stage 5 SOC detection.
  • A web application firewall (WAF) can block common patterns — useful, but it's a safety net, not the fix.

Common mistakes

  • "No errors on the page, so no SQLi." Blind SQLi exists precisely when errors are hidden.
  • Testing true/false without a baseline. Always compare against a normal request first.
  • Misreading network lag as a time delay. Repeat time-based tests a few times; a real signal is consistent.
  • Jumping straight to sqlmap. You'll get output you can't explain — and on anything other than an authorised target, a lot of trouble.
  • Treating blind SQLi as low severity because it's slow. Impact, not convenience, sets severity.

Check yourself

  1. What makes an SQL injection "blind"?
  2. On a page that looks identical for true and false conditions, what side channel can still reveal the answer?
  3. Does blind SQLi need a different fix from normal SQLi? Why?
Answers
  1. The application runs the injected query but doesn't show its results or errors in the response, so information must be inferred indirectly.
  2. Time. If a true condition makes the database pause before responding, the response time reveals yes or no.
  3. No. The root cause is identical — input becoming part of the query — so parameterised queries fix both. Monitoring and rate limiting help detect blind attempts because they need many requests.

Your lab

  • PortSwigger Blind SQL injection: https://portswigger.net/web-security/sql-injection/blind

Writeup: the parameter, how you proved true vs false (or timing), how many requests it took, and the fix.


Summary in your language

தமிழில் சுருக்கம்

Blind SQL injection-இல் பக்கம் query முடிவுகளையோ error-களையோ காட்டாது — attacker ஒவ்வொரு ஆம்/இல்லை கேள்விக்கான பதிலையும் response-இல் உள்ள சிறிய வேறுபாட்டிலிருந்தோ, அது எடுக்கும் நேரத்திலிருந்தோ தெரிந்துகொள்கிறார். இது மெதுவானது, ஆனால் பாதிப்பு அதே அளவு தீவிரமானது. sqlmap போன்ற கருவிகள் இதைத் தானியக்கமாக்குகின்றன — அனுமதி பெற்ற சோதனைகளில் மட்டும். தீர்வு அதேதான்: parameterised queries. அதிக request-கள் தேவைப்படுவதால் rate limiting, monitoring மூலம் கண்டறிவது எளிது.

हिंदी में सारांश

Blind SQL injection में page query के नतीजे या errors नहीं दिखाता — attacker हर हाँ/ना सवाल का जवाब response के छोटे फ़र्क से या उसमें लगने वाले समय से निकालता है। यह धीमा है, पर नुकसान उतना ही गंभीर है। sqlmap जैसे tools इसे automate करते हैं — सिर्फ़ authorised testing में। इलाज वही है: parameterised queries। बहुत सारी requests लगने के कारण rate limiting और monitoring से इसे पकड़ना आसान है।

Want this summary in Malayalam, Telugu, Kannada or another language? Tell us — the most requested languages get added next.


What's next

From attacking the database to attacking other users' browsers: XSS: reflected, stored and DOM