Skip to content
RCE Write-up Advanced

Evernote RCE: From PDF.js font-injection to All-platform Electron exposed ipcRenderer with listened BrokerBridge Remote-Code Execution

A JavaScript injection in the PDF.js font handling used by Evernote allowed arbitrary script to run when a shared note with an embedded malicious PDF was opened. Because the client exposed the Electron ipcRenderer bridge and a main-process listener named BrokerBridge, the injected script could reach a file-download-and-open routine and execute commands on the victim's machine.

Patrick Peng Follow

Published on 0reg.dev

Just this week, I discovered a critical Javascript Injection -> Remote-Code Execution in the Evernote app. By simply clicking the shared sugar-coated note with embedded font-injection malicious PDF, the attacker can arbitrary execute command & files spontaneously while invisibly by exploiting the preloaded-and-exposed…

Patrick Peng (@retr0reg), on 0reg.dev

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 PDF.js glyph compiler passed font matrix values into a dynamically constructed Function without sanitising them, and Evernote exposed a broad ipcRenderer bridge plus a main-process listener that could be driven from renderer script.

Impact

An attacker could execute arbitrary commands and files on the victim's machine after the victim simply opened a shared note, with no further interaction.

What the attacker needed

Victim opens a shared note; note contains an embedded PDF; Evernote desktop client

How it was found

  1. Create a PDF whose font object carries a crafted FontMatrix value containing script.
  2. Embed that PDF in a note and share the note with the victim.
  3. The victim opens the note, the PDF is rendered, and the injected script runs in the app://evernote origin.
  4. The script uses the exposed electronApi.ipcRenderer to send messages to the main process.
  5. The messages reach the BrokerBridge listener and the openFileAttachment routine, which downloads and opens a file.

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.

A PDF can carry its own font data, and the PDF viewer builds small JavaScript functions from that data to draw the letters. The author found a way to slip extra JavaScript into that font data so it runs as soon as the PDF is opened. Evernote's desktop app then gave that script a bridge to the app's more powerful background process, which could download and open files, so the script could run programs on the computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from Evernote

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.