/

CVE-2026-33955

Severity:

HIGH RISK

(8.6)

Cross-Site Scripting (XSS) in Notesnook Note History Viewer

CVE-2026-33955

Modified

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79, CWE-94

Impact:

Remote Code Execution via XSS in Electron Desktop Application

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Notesnook's Web/Desktop clients prior to 3.3.11 contain a stored cross-site scripting vulnerability in the note history comparison viewer where attacker-controlled note headers are rendered with dangerouslySetInnerHTML without proper sanitization.

In the Electron-based desktop app, this XSS can escalate to remote code execution because it runs in a context with nodeIntegration: true and contextIsolation: false, allowing injected JavaScript to access Node.js APIs.

Affected context

The vulnerability occurs in the Notesnook note history comparison viewer when rendering note headers that originated from user-controlled content.

It is relevant in contexts where:

  • Notes containing attacker-supplied header content are created, synced, backed up, or restored, and
  • The Web or Electron Desktop client displays historical versions of those notes, and
  • The desktop application is configured with nodeIntegration: true and contextIsolation: false.

Under these conditions, stored script content can execute in the desktop renderer process and gain direct access to Node.js APIs.

Exploit preconditions

  • Attack surface:
  • Notesnook Web UI displaying the note history comparison viewer
  • Notesnook Desktop (Electron) application loading backups or synced notes and opening the history comparison viewer
  • Required access:
  • Ability to create or modify a note such that the note header contains attacker-controlled HTML/JavaScript (e.g., via shared workspace, compromised account, or malicious backup file)
  • Trigger point:
  • A victim opens or previews the affected note in the history comparison viewer, causing the malicious header to be rendered with dangerouslySetInnerHTML
  • Why exploitation is possible:
  • The note header content is treated as trusted HTML and injected into the DOM using dangerouslySetInnerHTML without robust sanitization or encoding.
  • In the desktop application, the Electron configuration (nodeIntegration: true, contextIsolation: false) allows any executed script in the renderer to call Node.js APIs directly, turning an XSS condition into remote code execution.

Why this happens

The core issue is a mismatch between trust assumptions and actual data provenance.

Notesnook's note history comparison viewer uses React's dangerouslySetInnerHTML to render note header content, which is user-controlled and may include embedded HTML or scripts.

Without thorough sanitization or contextual output encoding, this pattern aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting) because untrusted data is injected into the DOM as active HTML/JavaScript.

In the Electron desktop environment, this XSS is further amplified by the security-sensitive configuration of the renderer:

  • nodeIntegration: true exposes Node.js primitives (like require, filesystem access, and process APIs) in the same context as web content.
  • contextIsolation: false removes the boundary between application and untrusted content, letting injected scripts fully interact with the app's privileged context.

When combined, the unsafe DOM injection and permissive Electron configuration upgrade a traditional stored XSS issue into full remote code execution, conceptually intersecting with CWE-94: Improper Control of Generation of Code due to the ability to run arbitrary script with OS-level effects.

Potential impact

  • Execution of arbitrary JavaScript within the Notesnook Web client session
  • Remote code execution on the victim's machine when using the vulnerable Electron Desktop application
  • Access to local files or system resources through Node.js APIs in the desktop app
  • Theft or modification of notes, backups, and account data
  • Installation of additional malware or persistence mechanisms via desktop RCE
  • Lateral movement or credential harvesting if the compromised desktop environment stores sensitive credentials or tokens

General mitigation guidance

Effective mitigation centers on reducing trust in user-supplied content and hardening the desktop runtime environment:

  • Avoid using dangerouslySetInnerHTML where possible; prefer rendering data as text or through well-defined, structured components that do not interpret HTML.
  • When HTML rendering is unavoidable, apply robust, library-backed HTML sanitization that removes scripts, event handlers, and dangerous attributes before injection.
  • Use strict context-aware output encoding to ensure that any user-controlled data is treated as inert content in the browser or webview.
  • In Electron applications, disable nodeIntegration in renderer processes and enable contextIsolation so that web content cannot directly reach Node.js APIs.
  • Apply a default-deny security posture in Electron (e.g., limiting accessible APIs, using preload scripts with a narrow, vetted interface, and disabling remote module usage).
  • Separate highly privileged operations (like filesystem or backup handling) from the DOM-rendering code paths, and gate them behind well-defined IPC interfaces with input validation.

By combining safer rendering patterns with a hardened Electron configuration, the attack surface for XSS and its escalation to RCE is significantly reduced.

How teams detect issues like this

Organizations can adopt multiple layers of detection to spot and prevent similar vulnerabilities:

  • Static analysis and linting:
  • Flag usages of dangerouslySetInnerHTML and other direct HTML injection APIs, especially when the source data is user-influenced.
  • Enforce rules that require sanitization or encoding at the sink for any content derived from user input.
  • Code review practices:
  • Mandate security-focused review of components that render rich content, history views, or diff/compare UIs.
  • Examine Electron configuration files and window creation code for insecure settings like nodeIntegration: true and contextIsolation: false.
  • Look for direct access to Node.js APIs from renderer code that processes or displays user content.
  • Automated tooling:
  • Use SAST tools configured with rules for XSS sinks and Electron security anti-patterns.
  • Integrate dependency and configuration checks into CI to detect insecure Electron defaults or regressions.
  • Runtime monitoring:
  • Implement CSP (Content Security Policy) where applicable to detect or mitigate script injection attempts in web contexts.
  • Log unusual renderer behaviors in the desktop application, such as unexpected filesystem access from UI flows that only display content.

These strategies help identify both the unsafe rendering patterns and insecure runtime configurations that enable XSS-to-RCE chains.

Sources

SourceLink
github.comgithub.com/streetwriters/notesnook/security/advisories/GHSA-45g3-cv93-q59v

Frequently asked

questions

Yes. An attacker who can get a victim to open a malicious note (for example via shared content, compromised account, or crafted backup) can trigger the stored XSS.

In the Electron Desktop application with permissive settings, this can lead to remote code execution on the victim's machine.

The attacker needs a way to influence the content of a note header that will later be displayed in the note history comparison viewer or to supply a crafted backup that the victim imports.

No direct local-system access is required; exploitation can occur once the malicious content is processed by the vulnerable viewer in a logged-in session.

The safest pattern is to eliminate direct HTML injection and treat all user-controlled content as untrusted data.

Render it using text-based components or through a strict sanitization and encoding pipeline, and ensure that the desktop runtime (e.g., Electron) does not expose powerful APIs to web content by default.

Adopt secure-by-default UI patterns that avoid dangerouslySetInnerHTML and similar APIs, enforce code review and linting rules for DOM injection and Electron configuration, and maintain a hardened Electron setup with nodeIntegration disabled and contextIsolation enabled.

Regular security testing, including SAST and targeted reviews of rich-content features and backup/restore paths, can catch similar XSS-to-RCE chains before release.

Find out what's already
exploitable in your codebase.