Bypassing Cloudflare WAF to Trigger Reflected XSS on a Major Heal
A search parameter on a health information website reflected user input into the page without proper encoding, allowing script execution. The site's Cloudflare WAF blocked a straightforward SVG payload, but a malformed attribute plus a null byte slipped past the filter and the browser still ran the onload handler.
Published on medium.com
While testing the search functionality of a major consumer-facing health information website, I discovered a Reflected Cross-Site Scripting (XSS) vulnerability. Though protected by Cloudflare’s Web Application Firewall (WAF), I was able to bypass its filtering using malformed attributes and a null byte injection…
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 search parameter was reflected into the HTML response without output encoding, and the WAF's parser could be confused by a null byte and a fake attribute so it did not recognise the real event handler.
Impact
An attacker could run script in a victim's browser in the context of a widely trusted health site, though the report only demonstrates an alert and does not show theft of data or sessions.
What the attacker needed
Victim visits a crafted search link; WAF present but bypassable
How it was found
- Send a search request with a simple SVG onload payload in the query parameter.
- Observe Cloudflare returning a 403 and blocking the request at the edge.
- Resend with a fake attribute and a null byte inserted before the real event handler.
- Observe the request is no longer blocked and the browser executes the handler, showing an alert with the domain.
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 reflected cross-site scripting bug means the site takes something you typed, such as a search term, and puts it straight into the page it sends back. If the text contains code, the browser runs it as if the site itself had written it. Here a firewall meant to catch such code was fooled by an odd character and a fake attribute, so the code still ran.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.