Skip to content
SQL injection Write-up Advanced

{JS-ON: Security-OFF}: Abusing JSON-Based SQL to Bypass WAF

The researchers found that several leading web application firewalls (WAFs) did not understand JSON syntax in SQL queries, so they could craft SQL injection payloads that the WAF failed to flag as malicious. This allowed them to bypass the WAF and exploit a SQL injection vulnerability to exfiltrate sensitive data from a cloud-hosted application.

Noam Moshe Follow

Published on claroty.com

Web application firewalls (WAF) are designed to safeguard web-based applications and APIs from malicious external HTTPs traffic, most notably cross-site scripting and SQL injection attacks that just don’t seem to drop off the security radar.

Noam Moshe, on claroty.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 WAFs' SQL injection detection parsers did not support JSON syntax, creating a mismatch between what the WAF recognised as SQL and what the database engine actually executed.

Impact

Attackers could bypass the WAF's protection and exploit SQL injection vulnerabilities to exfiltrate sensitive data such as session cookies, tokens, SSH keys, and hashed passwords; however, one vendor's WAF (Check Point) was immune, and the bypass required an existing SQL injection vulnerability.

What the attacker needed

An existing SQL injection vulnerability; a WAF that lacks JSON syntax support; ability to send crafted requests

The fix

The affected WAF vendors were notified and updated their products to support JSON syntax in their SQL injection inspection processes.

How it was found

  1. Set up a test web application with a SQL injection vulnerability and configure AWS WAF to protect it.
  2. Send crafted requests containing JSON-based SQL syntax to see if the WAF flags them.
  3. Observe that the WAF does not block requests that use JSON operators, while the database still executes them.
  4. Apply the same JSON-based SQL injection payload to the cloud version of the vulnerable application and confirm data exfiltration.
  5. Test the same technique against WAFs from other vendors (Palo Alto, F5, Cloudflare, Imperva) and find they are also bypassed.

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.

A web application firewall (WAF) is a security filter that inspects incoming web traffic and blocks requests that look like attacks, such as SQL injection. SQL injection is when an attacker sneaks database commands into a web form or URL to make the database reveal or change data. The researchers discovered that if they wrote their database commands using a newer feature called JSON, the WAF did not recognise the commands as dangerous and let them through, while the database still understood and executed them.

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 Noam Moshe

View all

2 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.