Detecting web message misconfigurations for crossdomain credential theft
A web page sends a URL containing a secret token to a different origin via postMessage, allowing an attacker who embeds the page in an iframe to read the token. The post demonstrates a tool feature for detecting such misconfigurations.
portswigger.net
Published on portswigger.net
We released a new version of Burp recently on the Early Adopter channel that updates DOM Invader to help find cross-domain secrets. In this post we are going to show you how to use DOM Invader to detect URL tokens in misconfigured cross-domain web messages.
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 page sends a message containing URL parameters to a different origin without validating the target origin, allowing any embedded frame to receive the data.
Impact
An attacker could steal a secret token from the URL if the page can be embedded in an iframe, but the post notes this requires manual inspection and is not foolproof.
What the attacker needed
Victim visits attacker's page; target page can be embedded in an iframe
How it was found
- Enable post message interception and click Detect cross-domain leaks in DOM Invader.
- Visit the cross-domain secrets test case.
- Observe that DOM Invader reports a low issue for a message containing a URL with a secret parameter.
- Create a web message event listener and an iframe pointing to the target URL to read the secret.
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 uses postMessage to send data to another website, it should check the recipient's origin. If it doesn't, an attacker can embed the page in an iframe and listen for the message, stealing any secrets in it. This post shows a tool that helps find such mistakes.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.