Skip to content
XSS Write-up Intermediate

From iframe Injection to Account Takeover (Full Exploit Chain)

A page rendered a URL taken from a query parameter inside an iframe, so a javascript: value in that parameter executed script in the site's origin. The author used this to steal a victim's access token and device ID from localStorage and then replay them against the API to take over the account.

0xRedFox29 Follow

Published on medium.com

Assalamualaikum bug hunter, di write ini saya menemukan celah iframe injection yang bisa dieskalasi ke XSS hingga menyebabkan Account Takeover.

0xRedFox29, 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 placed an attacker-controlled URL parameter directly into an iframe source without validating the scheme, allowing javascript: URLs to execute in the site's origin.

Impact

An attacker who gets a logged-in user to open a crafted link could steal that user's token and device ID and use them to access the account without the password.

What the attacker needed

Victim is logged in; victim opens a crafted link; attacker has a payload-hosting service

The fix

The site should validate the URL parameter and restrict allowed schemes, add a Content-Security-Policy frame-ancestors directive, sandbox the iframe, and mark session cookies HttpOnly and Secure.

How it was found

  1. Prepare two accounts and log in to each in a different browser
  2. Set up a payload-hosting service and choose a payload that loads a remote script
  3. Log in as the victim account and open the crafted promo link with the javascript: value
  4. Read the captured access token and device ID from the service's activity log
  5. In the proxy tool, find the login/profile request for the second account and send it to Repeater
  6. Replace the token and device ID with the victim's values, send the request, and observe the victim's profile data in the response

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 can show another page inside a box on its own page; that box is called an iframe. Here the address of the page shown in the box came straight from a link parameter, and the browser also accepts a special 'javascript:' address that runs code instead of loading a page. Because that code ran as if it belonged to the real site, it could read the logged-in user's stored login token, which the attacker then reused to act as that user.

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 0xRedFox29

View all

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