How a Shared Host Search Template Led to Widespread Reflected XSS
A shared search template offered by a hosting provider reflected user input into a JavaScript template literal without sanitisation, allowing script injection. An attacker could run arbitrary JavaScript in the context of any customer site using the template, and the researcher found over 30 vulnerable domains.
Published on medium.com
In this write-up, I’ll share how I discovered a Reflected XSS vulnerability in a shared search template used by a large number of websites — resulting in over 30 vulnerable domains.
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 shared template inserted the search parameter directly into a JavaScript template literal without escaping backticks or other special characters.
Impact
Any visitor to a customer site using the template could have script run in their browser, and the researcher identified over 30 vulnerable domains, though the provider treated the report as out of scope.
What the attacker needed
Victim visits a crafted search URL; site uses the shared template
The fix
The shared template should escape or encode user input before placing it inside JavaScript, and the provider should update the template for all customers.
How it was found
- Enumerate subdomains of the hosting provider and filter for live ones.
- Visit a live subdomain and test the search input by injecting a test string.
- Observe that the search value is reflected inside a JavaScript template literal.
- Craft a payload that closes the template literal and runs script, then confirm it executes.
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.
Many websites let you search, and the search term is often shown back on the page. Here the site put the search term inside a piece of JavaScript code without cleaning it first. That meant a crafted search term could break out of the code and run the attacker's own script in a visitor's browser, which is called reflected cross-site scripting (XSS).
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.