Skip to content
SQL injection Write-up Advanced

Exploiting “Google BigQuery” SQLI

A POST parameter was not sanitised, causing a SQL query exception that revealed table and column names. An attacker could bypass the Akamai Kona WAF using a division-by-zero technique to perform blind SQL injection and extract data from a Google BigQuery database.

Duc Nguyen Follow

Published on hackemall.live

Hi guys, long time no write. As some previous articles in my blog only focus on CTF writeups, so in this time and maybe the next time, I want to write another topic about my research also doing bug bounty hunter.

Duc Nguyen (@ducnt_), on hackemall.live

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 directly into a SQL query without parameterisation, and the WAF was bypassed using a division-by-zero error to create a boolean oracle.

What the attacker needed

Access to the vulnerable endpoint; ability to send POST requests

The fix

The vulnerability was fixed the next day after the report, according to the vendor.

How it was found

  1. Send a POST request with a double quote in the location parameter to trigger a SQL error that reveals table and column names.
  2. Attempt a UNION SELECT payload and observe a 403 WAF block.
  3. Probe which keywords and functions are blocked by the WAF.
  4. Use a payload with a division-by-zero condition to create a true/false signal based on string length.
  5. Blind the length of the target column value by adjusting the subtracted number until the error appears.
  6. Use the STRPOS function with division by zero to determine each character's position and extract the value.

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 website took user input and put it directly into a database query without cleaning it, which is called SQL injection. This let the attacker see error messages that revealed database structure, and then use a trick to ask yes/no questions and slowly extract data despite a firewall blocking normal attacks.

What is SQL injection?

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

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.