The Print Button That Handed Me Your Account: Stored XSS to Full
A stored XSS vulnerability existed in a print/export view that rendered message bodies via innerHTML without sanitisation, unlike the main conversation view. An attacker could execute JavaScript in the app origin, read an OAuth refresh token from sessionStorage, exchange it for an access token, and add a delegation backdoor that persists across password changes.
The target is a secure-email / encrypted-communication platform. Its main web app carefully neutralizes injected HTML in the conversation view — but I found a second, forgotten rendering path that re-injected the exact same stored message body into the DOM with no sanitization at all.
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/export view used innerHTML to render stored message content without applying the same client-side sanitisation as the main conversation view.
Impact
An attacker could execute arbitrary JavaScript in the app origin, steal an OAuth refresh token from sessionStorage, exchange it for a high-privilege access token, and add a delegation backdoor that persists across password changes, giving persistent access to the victim's messages and data.
What the attacker needed
Victim opens print view of malicious message; attacker can send a message with HTML content
How it was found
- Store HTML content through the normal message flow.
- Open the same conversation in the print view.
- The stored content is injected via innerHTML and executes automatically on load.
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.
This is a stored cross-site scripting (XSS) bug: a malicious script saved in a message runs when someone opens a special print view. The script can steal a login token kept in the browser and use it to take over the account, even after the password is changed.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.