Bypassing AWS WAF CRS with Cross-Site-Scripting (XSS) payload
An application reflected special characters without encoding, making it vulnerable to cross-site scripting, but an AWS WAF with the Core Rule Set blocked ordinary exploit attempts with a 403. By trying different characters before the payload, the author found one that slipped past the WAF and still executed in the browser.
medium.com
Published on medium.com
Earlier this year my colleague has identified an application which was clearly vulnerable to Cross-Site-Scripting as special characters were not encoded.
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 WAF's rule set matched known payload patterns too narrowly, so a slightly altered payload with an unexpected leading character was not recognised as an attack.
Impact
An attacker could execute script in a victim's browser despite the WAF, though the text does not describe any specific harm beyond the bypass itself.
What the attacker needed
Vulnerable app behind AWS WAF with CRS; attacker can send crafted requests
The fix
The WAF rules were updated, as the text states a fix was announced.
How it was found
- Confirm the application reflects special characters without encoding and is vulnerable to XSS.
- Observe that exploit attempts are blocked by the WAF with a 403 error.
- Learn from the application owners that an AWS WAF with the Core Rule Set is in place.
- Try a known public payload, which fails to execute because browsers treat it as a comment.
- Use Burp Intruder to replace the leading character with other hexadecimal values and collect the ones that are not blocked.
- Identify the character that both bypasses the WAF and allows the script to execute 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.
Cross-site scripting (XSS) lets an attacker slip their own script into a page so it runs in a victim's browser. A web application firewall (WAF) is a filter in front of a site that tries to block malicious requests. Here the filter could be tricked by putting an unusual character in front of the script, so the attack got through.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.