How I Chained Template Injections Across Pages to Trigger Reflec
The signup and confirm pages embedded the 'next' URL parameter into templates without sanitisation, allowing an attacker to inject a javascript: URI into an href attribute. Clicking the resulting link executed arbitrary JavaScript in the victim's browser.
Disclaimer:This content is foreducational purposes only. The author isnot responsible for any use or misuseof the information provided.
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
The application rendered the user-controlled 'next' parameter directly into HTML and JavaScript template contexts without escaping or validating the URL scheme.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser after the victim clicks a crafted link, but the report only demonstrates an alert and notes there was no CSP to stop it.
What the attacker needed
Victim clicks a crafted link
The fix
The application should whitelist safe redirect URLs, reject javascript: and data: schemes in href attributes, and escape template variables according to their context.
How it was found
- Visit the signup page with a 'next' value that is a javascript: URI.
- The page renders that value as the href of the 'Next' link.
- Click the link to execute the JavaScript.
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.
A web page took a value from the address bar and put it straight into the page without cleaning it. Because that value ended up inside a link, an attacker could make the link start with 'javascript:' so that clicking it runs code. This is called cross-site scripting, or XSS: running an attacker's code in someone else'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.