Skip to content
XSS Write-up Advanced

Remote Code Execution in Tutanota Desktop due to Code Flaw

A parser differential between the browser's HTML parser (used by DOMPurify) and the Linkify library allowed an attacker to smuggle malicious HTML into the DOM of Tutanota's desktop client. Combined with a CSP bypass via file:// URLs and an IPC blocklist bypass, an attacker could execute arbitrary code on the victim's machine.

Paul Gerste Follow

Published on sonarsource.com

Our last two articles discussed the risks of end-to-end encrypted mail providers and showcased the details of two Cross-Site Scripting vulnerabilities we found in Proton Mail and in Skiff.

Paul Gerste, on sonarsource.com

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 root cause was that the HTML was modified after sanitization by a different parser (Linkify) that interpreted the markup differently from the browser, creating a parser differential that reintroduced malicious HTML.

Impact

An attacker could steal decrypted emails, impersonate the victim, and execute arbitrary code on the victim's machine if they use the desktop client.

What the attacker needed

Victim uses Tutanota Desktop client; victim opens the malicious email; victim performs two clicks anywhere

The fix

The vulnerability was fixed by moving the sanitizer pass after all modifications, introducing a Shadow DOM, handling the blocklist bypass, loading the app from a special asset:// protocol, and randomizing attachment paths.

How it was found

  1. Send an email containing a crafted HTML payload that exploits the parser differential.
  2. The victim opens the email in the Tutanota Desktop client.
  3. The payload uses CSS to make the Save Attachment button transparent and cover the UI.
  4. The victim clicks anywhere, unknowingly saving the attachment to a predictable path.
  5. The saved file is loaded as a script via an iframe, bypassing the CSP.
  6. The script uses IPC calls to download and open a malicious executable, bypassing the blocklist.

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.

Tutanota is an email app that tries to keep your messages private. The app cleans up emails to remove dangerous code, but a mistake in how it cleaned up links let attackers sneak in harmful code. Because the desktop version of the app had extra weaknesses, that code could run programs on your computer.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Paul Gerste

View all

7 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.