Escalating RXSS with HttpOnly SameSite Session Cookies
A GET parameter used for redirects was only partially sanitised, allowing an attacker to break out of an attribute and inject an event handler that runs script. Because the session cookies were HttpOnly and SameSite, the author chained the script with same-site settings endpoints and the XSRF token to change the victim's email and take over the account.
Published on medium.com
Recently, I found a reflected XSS (RXSS) bug 🪲 on a well-known API documentation platform. Here’s how I escalated this bug to high severity, leading to an admin account takeover 🔓.
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 redirect parameter was placed into an HTML attribute without properly encoding the double-quote character, letting an attacker close the attribute and add a new event handler.
Impact
An attacker could take over an admin account by changing its email address, though the exploit only worked in Chromium-based browsers.
What the attacker needed
Victim uses a Chromium-based browser; victim loads the crafted URL; attacker knows a same-site email change endpoint
How it was found
- Find a GET redirect parameter that is only partially sanitised.
- Craft a payload that closes the existing attribute and adds an event handler.
- Load the crafted URL in a Chromium-based browser so the handler fires.
- Use the injected script to send a fetch request to the email change endpoint with the XSRF token from cookies.
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 reflected cross-site scripting bug lets an attacker put their own instructions into a page the victim loads, so the victim's browser runs them as if the site wrote them. Normally login cookies are protected so scripts cannot read them, but here the attacker used the script to send requests to other pages on the same site that do accept the cookies. By changing the account email through those requests, the attacker could take over the account.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.