Skip to content
XSS Write-up Advanced

Fuzzing and Bypassing the AWS WAF

The AWS WAF's managed rule sets failed to block a cross-site scripting payload that used the experimental onbeforetoggle event to trigger JavaScript execution. An attacker could inject this payload into a vulnerable application to execute arbitrary scripts in a victim's browser.

Daniele Linguaglossa Follow

Published on sysdig.com

Subscribe to Threat Research

Daniele Linguaglossa, on sysdig.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 AWS WAF's managed rules did not include the experimental onbeforetoggle event in their detection patterns, allowing a payload using that event to bypass filtering.

Impact

If exploited, this vulnerability could allow attackers to inject malicious scripts into a vulnerable application, potentially compromising sensitive user data and system integrity; however, the bypass was specific to AWS WAF, as F5 WAF and ModSecurity blocked the payload.

What the attacker needed

AWS WAF with managed rule sets; vulnerable application allowing HTML injection; victim uses a browser supporting onbeforetoggle

The fix

AWS deployed a fix on 13 December 2023, after the vulnerability was reported.

How it was found

  1. Set up a test environment with an EC2 instance, a load balancer with AWS WAF, and the common, known bad inputs, and SQLi managed rule sets.
  2. Build a fuzzer (Wafer) that generates payloads from tags and attributes, checks for execution using Selenium, and simulates user interactions.
  3. Run the fuzzer and wait for results.
  4. Review the fuzzer output to find a payload using the onbeforetoggle event that was not blocked.
  5. Confirm that the payload executes JavaScript (e.g., an alert) in the browser.

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 filter that tries to block malicious requests before they reach a website. The researchers found that AWS's WAF did not recognise a newer browser feature called onbeforetoggle, so a script hidden in that feature slipped through. This means an attacker could still run harmful code in a victim's browser even though the WAF was supposed to stop it.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from AWS

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.