Lessons Learned From Exposing Unusual XSS Vulnerabilities
Two cross-site scripting flaws were found: a chat widget authorised postMessage traffic with a secret token that leaked because it was sent to the direct parent window with a wildcard origin, and an AI platform opened user-uploaded SVG files from Blob URLs in a new tab, letting embedded script run on its own domain. An attacker could run JavaScript in the victim's session and steal account API keys.
Misunderstood browser APIs are often at the core of many web security issues. With the rapid expansion of web APIs, keeping up with security best practices can be challenging.
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 two mistakes: the widget sent its secret token to window.parent with a wildcard origin instead of window.top with a fixed origin, and the platform rendered attacker-supplied SVG content from a Blob URL without sanitising it.
Impact
An attacker could run JavaScript in the victim's session on the affected sites and steal their API key, though the chat widget flaw required the victim to visit an attacker-controlled page that embeds the widget.
What the attacker needed
Victim visits attacker page with widget; victim uploads and clicks a crafted SVG; attacker can send files to the victim
The fix
The vulnerabilities were responsibly disclosed and are now patched; the lessons are to fix the postMessage origin and target window, and to sanitise user-uploaded content opened from Blob URLs.
How it was found
- Embed a site containing the chat widget so the token sent to the parent window can be intercepted.
- Use the leaked token to send a crafted iframe-resize message to the widget.
- Send a malicious SVG to the target and ask them to test it on a model that accepts images.
- The user sees a fake error message and clicks it.
- The script in the SVG runs and exfiltrates the user's account API key.
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.
Cross-site scripting (XSS) means an attacker gets their own JavaScript to run inside a trusted website, so it can act as the logged-in user. Here, one site trusted messages from any page that embedded its chat widget, and another opened uploaded image files in a way that let the file's own code run on the site. In both cases the attacker's code could read the victim's account secrets.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.