Reconnaissance
A web application reflected the session ID into an error-reporting JavaScript function that ran on window.error, allowing an attacker to inject script via a crafted error page. By combining a Cloudflare WAF bypass with Google Analytics, the attacker could extract session tokens and achieve one-click account takeover.
sensepost.com
Published on sensepost.com
What seemed like a regular Cross-site Scripting (XSS) vulnerability on an HTTP 500 “Internal Server Error”-page, I managed to turn into a one-click account takeover on an assessment. In this blog post I want to describe the path I took to achieve this leveraging a known Cloudflare WAF bypass and Google analytics to…
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 application placed the session ID into an inline JavaScript error handler without proper encoding, and the page lacked a strict Content Security Policy, allowing script injection.
Impact
An attacker could steal a victim's session token and take over their account with a single click, though the exploit relied on bypassing Cloudflare WAF and using Google Analytics for exfiltration.
What the attacker needed
Victim clicks a link; Cloudflare WAF bypass available; Google Analytics allowed for exfiltration
The fix
The application should encode the session ID before inserting it into JavaScript and implement a strict Content Security Policy to prevent script injection.
How it was found
- Trigger a window.error event on the error page to execute the injected JavaScript.
- Bypass the Cloudflare WAF to deliver the payload.
- Use Google Analytics to exfiltrate the session token.
- Use the stolen session token to take over the account.
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.
When a website has a bug, it sometimes shows an error page. This page included the user's session ID (a secret code that keeps you logged in) inside a piece of JavaScript. An attacker could make the page run their own JavaScript, which then stole that secret code and let them log in as the victim.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.