How I bypassed Cloudflare WAF to get my First Bug
A reflected cross-site scripting flaw existed in a search field, but a Cloudflare WAF blocked basic payloads. The author bypassed the WAF with an SVG payload using an onload handler, causing the browser to execute script.
I am new to bug bounty and was trying to find my first bug, learning about vulnerabilities, etc these days. Along with learning, I tested websites for vulnerabilities like XSS(Cross-Site Scripting).
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 input was reflected into the page without proper output encoding, and the WAF's filter could be evaded with an alternative SVG event-handler payload.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser when the victim visits a crafted link, potentially leading to session theft or other client-side attacks.
What the attacker needed
Victim clicks a crafted link; target has a search field
How it was found
- Find a blog page with a search bar.
- Enter strings and check if they are reflected in the source code.
- Try basic XSS payloads, which are blocked by Cloudflare WAF.
- Try URL-encoded payloads, which also do not work.
- Use an SVG payload with an onload handler to bypass the WAF.
- Observe the XSS popup and confirm execution in the source code.
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 make a website run their own JavaScript in a victim's browser. Here, the search box echoed the input back into the page without proper cleaning, so a crafted input could run code. A web application firewall (WAF) is a filter that tries to block such attacks, but it can sometimes be bypassed.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.