How I Found a 0-Day in an Electron App’s Email Viewer
An Electron desktop app rendered attacker-controlled email HTML directly into an unsandboxed iframe without sanitisation, and the renderer could reach a broad privileged API exposed through the preload bridge. An attacker who sent a crafted email could therefore run code in the email view and reach wallet, account and file-related functionality.
medium.com
Published on medium.com
Most people think 0-days are found in glamorous places: cryptography, kernel code, browser internals, or some deeply obfuscated subsystem that looks impossible to understand.
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 app rendered remote email HTML without sanitisation in an unsandboxed srcDoc iframe, and exposed a broad privileged API to that renderer through the Electron preload bridge.
Impact
An attacker could send an email that executes code in the app's renderer and reach privileged wallet, account and file-related functionality; the text does not show a full end-to-end exploit against a victim.
What the attacker needed
Victim receives a crafted email; app renders email HTML in the viewer; no user interaction beyond viewing
The fix
The vendor added HTML sanitisation before rendering the email body and sandboxed the iframe, which broke the chain; the text says this was fixed in version 0.3.17.
How it was found
- Trace how email content is fetched and displayed in the app.
- Observe that parsed email HTML is passed straight into an iframe srcDoc.
- Build a small local harness to test whether code in the frame can reach window.top.api.
- Confirm the frame can enumerate the exposed capability groups.
- Query wallet and account functions with redacted output to prove sensitive values are reachable.
- Test further API exposure with benign markers to show the issue is architectural.
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.
Email bodies are written by strangers, so an app must treat them as untrusted. Here the app pasted that HTML into a small embedded web page (an iframe) with no cleaning and no restrictions, and that embedded page could reach powerful app functions meant for the main window. So a malicious email could act with the app's own privileges.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.