Skip to content
XSS Write-up Intermediate

Reflected XSS in blog search

A reflected cross-site scripting vulnerability existed in the blog search function, where a filter removed certain characters but could be bypassed using URL encoding and JavaScript template literals to execute arbitrary script. An attacker could steal cookies or perform actions in the victim's browser.

mustafamahmvd Follow

Published on medium.com

today i will talk about how i found a tricky reflected XSS in the core blog application in search functionality.

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 input was reflected without proper output encoding, and the blacklist filter was incomplete, allowing bypass via URL encoding and JavaScript template literal evaluation.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially stealing cookies or performing actions on their behalf.

What the attacker needed

Victim clicks a crafted link

How it was found

  1. Inject special characters to test the filter and see what gets removed.
  2. Try URL-encoded tags to see if they bypass the filter.
  3. Use a mixed-case script tag with extra characters to trigger an alert.
  4. Attempt to call confirm with document.cookie but find parentheses are stripped.
  5. Discover that eval.call with a template literal can execute code without parentheses.
  6. Use hex encoding inside the template literal to bypass the filter and execute alert(document.cookie).

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.

The blog's search box echoed back what you typed, but it tried to block dangerous characters. The author found a way around that block, so a malicious link could run code in a visitor's browser and steal their login cookies.

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.