Skip to content
XSS Write-up Intermediate

Remote Code Execution Through Cross-Site Scripting In Electron Apps

The zonote Electron app rendered user-supplied HTML without sanitisation, allowing an attacker to inject JavaScript that executed in the renderer. Because Node.js integration was enabled, the injected script could access the Node.js API and run arbitrary system commands, escalating the cross-site scripting to remote code execution.

Héctor Martos Follow

Published on infosecwriteups.com

For those unfamiliar with the term, CVE stands for Common Vulnerability and Exposure.Each CVE record contains a standard identifier, a brief description, and references to related vulnerability reports and advisories. MITRE corporation keeps a list of records with all publicly disclosed vulnerabilities that is free…

Héctor Martos, on infosecwriteups.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 app rendered note content as HTML without sanitisation and had Node.js integration enabled in the renderer, allowing injected JavaScript to access the Node.js API.

Impact

An attacker could execute arbitrary code on the victim's computer, leading to high impact on confidentiality, integrity, and availability; the proof-of-concept required user interaction (hovering), but the author notes that a payload could execute automatically when the note is processed.

What the attacker needed

Victim opens a malicious note; user interaction (hover) for the PoC payload

The fix

The owner expressed no intention of fixing the vulnerability, so the app should be fixed by disabling Node.js integration in the renderer and sanitising user-supplied HTML.

How it was found

  1. Create a new note in zonote.
  2. Insert an XSS payload that executes code on mouse hover.
  3. Hover over the link to trigger the payload and confirm script execution.
  4. Modify the payload to require the Electron shell module and list exposed methods.
  5. Use the shell module to open the Calculator app as a proof of concept.
  6. Export the note with the payload and import it into zonote on Windows to confirm cross-platform exploitation.

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) is when a program displays user content as if it were part of the app, so an attacker can sneak in JavaScript code that runs in the victim's app. In this note-taking app, a note could contain HTML that ran code when the user hovered over it. Because the app also allowed that code to use the computer's own commands (Node.js integration), the attacker could do anything the user could do, like open programs or install malware.

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 Héctor Martos

View all

6 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.