Skip to content
Misconfiguration Write-up Intermediate

AWS WAF Bypass: invalid JSON object and unicode escape sequences

AWS WAF's default handling of invalid JSON (duplicate keys) and its failure to decode Unicode escape sequences in JSON keys allow attackers to bypass WAF rules, such as those blocking malicious payloads or enforcing virtual patching.

Andrea Menin Follow

Published on blog.sicuranext.com

In recent times, the security community has been witnessing an increasing number of reports from researchers highlighting various bypass techniques targeting AWS Web Application Firewall¹. These bypasses have brought to light not only the absence of certain critical features but also the reliance on default…

Andrea Menin (@AndreaTheMiddle), on blog.sicuranext.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 root cause is that AWS WAF's default action for invalid JSON is to allow the request, and its JSON key matching does not normalise Unicode escape sequences, leading to parser discrepancies between the WAF and the backend application.

Impact

An attacker could bypass AWS WAF rules, including virtual patches, to deliver malicious payloads such as SQL injection or path traversal, potentially leading to further exploitation.

What the attacker needed

AWS WAF with JSON body inspection; Default invalid JSON handling; Backend parses duplicate keys or Unicode escapes

The fix

AWS WAF should be configured to block or evaluate as plain text on invalid JSON, and it should decode Unicode escape sequences in JSON keys before matching; alternatively, use a WAF like ModSecurity that handles these cases correctly.

How it was found

  1. Create an AWS WAF rule that blocks requests containing a specific string (e.g., 'etc/passwd') in any JSON body value.
  2. Send a request with a JSON body containing that string; the request is blocked.
  3. Send a request with duplicate JSON keys, one harmless and one containing the malicious string; the request bypasses the rule.
  4. For virtual patching, create a rule that restricts a JSON parameter (e.g., 'id') to numeric values using a JSON Pointer.
  5. Send a request with a non-numeric value in the 'id' parameter; the request is blocked.
  6. Replace a character in the JSON key with its Unicode escape sequence (e.g., '\u0069' for 'i') and send a malicious value; the rule is 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) inspects incoming requests to block attacks. AWS WAF can be configured to check JSON request bodies, but if the JSON is malformed (e.g., has duplicate keys), by default it does not block the request. Also, AWS WAF does not decode escape sequences in JSON keys, so an attacker can use a Unicode escape to hide a key from the WAF while the application still interprets it correctly. This lets attackers slip malicious input past the WAF.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by Andrea Menin

View all

2 more disclosed reports, best first.

More from AWS

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.