Skip to content
XSS Write-up Intermediate

XSS Reflected (filter bypass)

A reflected XSS vulnerability existed in a search field where user input was inserted into a dfn tag without encoding. The attacker bypassed the filter using double URL encoding and a script tag with backticks instead of parentheses to execute JavaScript.

Mohamed Sayed Follow

Published on medium.com

{{media:0}}

Mohamed Sayed, 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 input was reflected into a dfn HTML tag without proper output encoding, and the input filter was insufficient, allowing bypass via double URL encoding and alternative JavaScript syntax.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to session hijacking or other client-side attacks.

What the attacker needed

Victim clicks a crafted link; search field reflects input

The fix

The search input should be properly HTML-encoded before being inserted into the dfn tag, and the filter should be replaced with a robust output encoding mechanism.

How it was found

  1. Enter a test value like a single quote and angle brackets into the search field to see which characters are blocked or encoded.
  2. Observe that the value appears unencoded inside a dfn tag in the page source.
  3. Try a basic XSS payload but note it is blocked or redirected due to angle brackets.
  4. Attempt URL encoding, then double URL encoding, to bypass the filter.
  5. Notice that the equals sign is removed by the filter, so use a script tag with backticks instead of parentheses to execute the payload.

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.

This report describes a cross-site scripting (XSS) bug. When you type something into a search box, the website sometimes puts your text directly into the page's code. If an attacker can make the website show their own code, they can run a script in your browser. Here, the site tried to block dangerous characters, but the attacker found a way around it by encoding the input twice and using a different way to write the script.

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 Mohamed Sayed

View all

5 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.