Skip to content
SQL injection Write-up Intermediate

Using HEAD to optimize Time Based SQL Injection

A client website running MS SQL Server was vulnerable to time-based blind SQL injection, but a WAF or keyword filter blocked common payloads and the page's variable load time made timing results unreliable. Switching the request method to HEAD gave a consistent timing pattern, and the author then used Burp Intruder with a short timeout to extract data character by character.

yappare Follow

Published on blog.yappare.com

Was conducted a application pentest on a client site and found that the website is vulnerable to SQL Injection. The DBMS is MS SQL Server.

yappare, on blog.yappare.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application concatenated user input into a SQL query without parameterisation, and the WAF only matched common payload signatures rather than blocking the injection itself.

Impact

An attacker could extract data from the database, such as the version string, one character at a time, though the filter and timing noise made this slow and unreliable until the HEAD trick was used.

What the attacker needed

Target runs MS SQL Server; a WAF or keyword filter is present; ability to send HEAD requests

How it was found

  1. Send the request with the method changed to HEAD so the page body is not returned.
  2. Confirm the response timing becomes consistent enough to measure a deliberate delay.
  3. Set the Burp timeout to just under the delay used in the payload.
  4. Configure Intruder with Cluster Bomb and two payload sets, one numeric and one alphanumeric.
  5. Run the attack and look for results with no status and no length, which indicate the delayed (true) branch.
  6. Sort the results to read out the extracted characters.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The site passed user input into a database query without treating it as data, so an attacker could ask the database yes/no questions and read answers from how long the page took to reply. A filter blocked obvious attack strings, and the page's own loading time added noise, so the author sent HEAD requests (which ask only for headers, not the page body) to get cleaner timing. They then used a tool to try many characters and spot the ones that caused a deliberate delay.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by yappare

View all

14 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.