Skip to content
XSS Write-up Advanced

Advanced WAF Bypass Reflected XSS in search bar

A reflected cross-site scripting vulnerability existed in the search bar, where user input was reflected without sanitisation. A web application firewall blocked many payloads, but the author found a bypass using an obscure event handler and optional chaining to execute JavaScript, allowing script execution in the victim's browser.

mustafamahmvd Follow

Published on medium.com

Our discussion tonight will dive into a detailed explanation how i bypassed the strongest WAF i’ve ever seen that blocks every known and unknown bypassingtechniques.

aiden0x, on medium.com

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 blocklist could be bypassed with an unusual event handler and JavaScript syntax.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser by tricking them into visiting a crafted URL, potentially stealing data or performing actions on their behalf, though the report only demonstrates an alert popup.

What the attacker needed

Victim clicks a crafted link

The fix

The search input should be properly HTML-encoded before being reflected into the page, and the WAF should not rely solely on blocklists.

How it was found

  1. Test the search parameter with a harmless HTML tag to see if it is reflected.
  2. Try a standard XSS payload and observe that the WAF blocks it.
  3. Remove parts of the payload to identify which keywords trigger the WAF.
  4. Discover that an obscure event handler (oncontentvisibilityautostatechange) is not blocked.
  5. Use optional chaining (Function?.()) to call the Function constructor without triggering the WAF.
  6. Place the JavaScript payload in an input element's value and retrieve it via the DOM to execute it.

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 inject JavaScript into a page that other users view, so their browser runs the attacker's code. Here the search box echoed back whatever was typed without cleaning it, and although a firewall tried to block common attack patterns, the researcher found a way around it. The result is that a crafted link could run code in a victim's browser.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by mustafamahmvd

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.