Skip to content
XSS Write-up Intermediate

Day 1: Defeating the HttpOnly Flag for Account Takeover via RXSS

A reflected XSS vulnerability in a base64-encoded email parameter allowed script execution, but the session cookie was HttpOnly. The attacker bypassed this by using the victim's browser to fetch an API endpoint that returned PII and a session ID, then exfiltrated that data to achieve account takeover.

danielbelay Follow

Published on medium.com

Today, I explored a powerful technique for escalating a reflected XSS (RXSS) vulnerability into full account takeover (ATO), even when the HttpOnly flag is set on session cookies. This method, detailed in a write-up by Mohamed Tarek, highlights how a simple XSS bug can be weaponized to steal user session data.

dani3l, 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 application reflected user input without sanitisation, and an API endpoint exposed sensitive session data to any authenticated request, allowing bypass of HttpOnly.

Impact

An attacker could steal PII and session data to achieve full account takeover, despite the HttpOnly flag.

What the attacker needed

Victim clicks a malicious link; victim is logged in

How it was found

  1. Find a base64-encoded email parameter in a verification URL that is reflected on the page.
  2. Inject a script into the parameter to achieve reflected XSS.
  3. Discover an API endpoint that returns PII and session ID.
  4. Use fetch() with credentials to request the API from the victim's browser.
  5. Exfiltrate the response to an attacker-controlled server.
  6. Deliver the payload via an img tag to the victim.

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 website had a flaw where a malicious link could run code in a victim's browser. Normally this lets an attacker steal the login cookie, but here the cookie was protected so scripts couldn't read it. Instead, the attacker used the victim's browser to ask another part of the site for personal data and a session ID, then sent that to their own server, taking 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.

More by danielbelay

View all

7 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.