XSS — Bypassing WAF with Hex Overflow
The target's URL decoder mishandled malformed percent-encoded sequences, allowing characters such as '=' to be produced in unexpected ways. This let the author bypass an F5 BIG-IP WAF's blocking of event handlers and the alert function, achieving reflected XSS.
medium.com
Published on medium.com
Hello, I’m Syed Mushfik Hasan Tahsin aka SMHTahsin33. A 20 Y/O Cyber Security Enthusiast from Bangladesh.
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 a malformed URL decoder that accepted out-of-range hex digits and produced unintended ASCII characters, letting an attacker construct blocked characters such as '=' without using their normal encoding.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser, though the text does not describe any specific harm beyond the XSS itself.
What the attacker needed
Reflected input on the target; F5 BIG-IP WAF in front of the app; victim visits a crafted URL
How it was found
- Confirm the input is unsanitised by submitting a simple SVG onload payload, which the WAF blocks.
- Probe to find that the onload= part with the equal sign is what gets blocked.
- Discover that malformed percent sequences such as %3= are decoded to '=' by the target's decoder.
- Use the alternate encoding for '=' in an SVG onload payload, which is still blocked because alert() is filtered.
- Replace alert() with optional chaining alert?.() to bypass the function filter and trigger the script.
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 input such as script code. Here the filter was fooled because the site's own URL decoder turned strange percent-encoded text into characters the filter did not expect, so a script tag slipped through.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.