Cloudflare WAF Bypass Leading to Reflected XSS via SVG Injection
A recruitment portal reflected the msg parameter into the page without filtering, allowing HTML injection. Cloudflare blocked a script tag, but an SVG tag with an onload handler bypassed the WAF and executed JavaScript in the victim's browser.
This is Md Saikat a Cyber Securityenthusiast. I’ve completed eJPT, eWPTX,and I spend most of time exploring web applications, breaking things (ethically xD), and learning something new from every of my finding.
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 msg parameter was written into the page without output encoding, and the WAF only matched known script patterns rather than blocking dangerous SVG event handlers.
Impact
An attacker could run JavaScript in a victim's browser through a crafted link, though the report does not demonstrate any data theft or account takeover.
What the attacker needed
Victim clicks a crafted link; Cloudflare WAF present
The fix
The application should HTML-encode the msg parameter before rendering it, and the WAF should be tuned to catch SVG event handlers rather than only script tags.
How it was found
- Visit the recruitment subdomain and notice the error page reflects the msg parameter.
- Send a simple HTML tag in msg and see it rendered in the body.
- Try a script tag and observe Cloudflare blocking it.
- Try an SVG tag with an onload handler and see the JavaScript execute.
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.
Reflected cross-site scripting happens when a website puts something you typed straight back into the page without cleaning it. If that something is code, the browser runs it as if the site itself wrote it. Here the site echoed a message parameter, and a crafted link made the browser run code even though a security filter was in place.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.