Microsoft Edge - Universal XSS
Microsoft Edge's print preview feature saved a modified copy of the page to a temporary file and used an attribute to set the document's origin. An attacker could inject JavaScript via the onbeforeprint event, create a fake print document with a spoofed origin, and execute script as any website, leading to universal XSS.
leucosite.com
Published on leucosite.com
The universal XSS (uXSS) is a coveted bug in browsers, it gives you the ability to execute Javascript as any website. It's like having an XSS in all websites which is pretty interesting.
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 print preview context trusted the __IE_DisplayURL attribute to set the document's origin without proper validation, allowing an attacker to spoof any origin via a Blob URL.
Impact
An attacker could execute JavaScript as any website, potentially stealing cookies or performing actions on behalf of the user, though the exploit required the user to initiate printing.
What the attacker needed
Victim uses Microsoft Edge; victim triggers print() on attacker page
The fix
The vulnerability was fixed by Microsoft, as indicated by the CVE reference.
How it was found
- Inject an iframe with a javascript: URL via the onbeforeprint event.
- Call window.print() to trigger print preview.
- The injected JavaScript creates a Blob URL containing a fake print document with a spoofed __IE_DisplayURL attribute.
- Redirect the top frame to the Blob URL.
- The print preview context sets the document origin to the spoofed site.
- The fake print document contains another javascript: iframe that executes as the target site.
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 you print a webpage in Edge, the browser makes a temporary copy of the page and re-renders it. The researcher found that this copy trusts a special attribute that tells it which website the page came from. By injecting a fake print document with a forged attribute, they could make the browser believe the page came from any site, allowing them to run malicious JavaScript as that site.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.