/

CVE-2026-33976

Severity:

CRITICAL RISK

(9.6)

XSS in Notesnook Web Clipper Rendering

CVE-2026-33976

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79, CWE-94

Impact:

Stored XSS leading to Remote Code Execution in the desktop application

Severity:

CRITICAL RISK

(9.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 Clipper previously preserved attacker-controlled attributes from clipped pages and rendered them into an unsandboxed, same-origin iframe using contentDocument.write(...), leading to stored cross-site scripting (XSS).

When a crafted clip was opened, event-handler attributes executed JavaScript in the Notesnook origin; in the Electron-based desktop client, this script execution could be escalated to full remote code execution due to nodeIntegration: true and contextIsolation: false.

Affected context

The vulnerability occurs in Notesnook's Web Clipper feature and subsequent note rendering flow.

It is relevant when:

  • Users clip content from arbitrary or untrusted web pages.
  • The clipped HTML, including root element attributes, is stored and later rendered.
  • Notes are displayed in a same-origin iframe without sandboxing or robust HTML sanitization.

In Electron-based desktop builds where Node.js APIs are exposed to web content, successful script execution can be escalated to remote code execution on the user's machine.

Exploit preconditions

  • Attack surface: Notesnook Web Clipper and note rendering UI (web, desktop, mobile).
  • Required attacker capability: Ability to cause a user to clip a malicious web page, or control content on a page that the victim clips (e.g., compromised site, malicious link, injected widget).
  • Stored aspect: Malicious attributes on the source page's root element are preserved into the stored "web-clip" HTML.
  • Trigger point: The victim later opens the stored clip in Notesnook; the app renders the HTML into a same-origin, unsandboxed iframe via contentDocument.write(...).
  • Why exploitation is possible:
  • Attacker-controlled event-handler attributes (onload, onclick, onmouseover, etc.) are not stripped or sanitized.
  • The iframe shares origin with the Notesnook app and is not sandboxed, allowing arbitrary script execution in the app context.
  • In the desktop Electron app, nodeIntegration: true and contextIsolation: false expose Node.js APIs directly to attacker-controlled scripts, enabling RCE.

Why this happens

The core issue is a stored cross-site scripting vulnerability stemming from unsafe handling of HTML captured by the Web Clipper.

The clipper preserves attributes from the source page's root DOM element and embeds them into stored "web-clip" HTML without removing dangerous event-handler attributes or script-capable constructs. Later, when the clip is opened, Notesnook injects this HTML into an iframe via contentDocument.write(...) in a same-origin, unsandboxed context.

This behavior aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting) because attacker-controlled HTML and attributes are rendered as-is in the application origin. In the Electron desktop environment, this XSS chain escalates toward CWE-94: Improper Control of Generation of Code ('Code Injection'), because untrusted script gains access to Node.js APIs due to permissive nodeIntegration and lack of contextIsolation. The abstract insecure pattern is:

  • Treating captured HTML as trusted content.
  • Rendering it dynamically in a privileged, same-origin context without sanitization or sandboxing.

Potential impact

  • Execution of arbitrary JavaScript in the Notesnook web origin when a malicious clip is viewed.
  • Theft of sensitive note content, metadata, or authentication/session tokens accessible to the Notesnook web context.
  • Account takeover or cross-account data access if session or API credentials can be exfiltrated.
  • In the desktop Electron app:
  • Execution of arbitrary OS-level commands via Node.js APIs.
  • File system access, including reading and modifying local notes, configuration files, or other accessible data.
  • Installation of additional malware or establishing persistence on the affected system.
  • Use of the compromised desktop as a foothold for further lateral movement in the user's environment.

General mitigation guidance

Effective mitigation generally requires a combination of safer content handling, sandboxing, and least-privilege runtime configuration:

  • HTML sanitization for clips:
  • Treat all web-clipped HTML as untrusted.
  • Normalize and sanitize stored clip content before saving or rendering, removing event-handler attributes, JavaScript URLs, inline scripts, and other active content.
  • Prefer a whitelist-based sanitizer that only allows a minimal subset of tags and attributes required for display.
  • Safe rendering patterns:
  • Avoid using contentDocument.write(...) with untrusted or semi-trusted HTML.
  • Render clips in sandboxed iframes with restrictive sandbox attributes (e.g., disabling script execution and same-origin access) where feasible.
  • When rich HTML is not strictly necessary, consider rendering a preprocessed, inert representation (e.g., server-side rendered markdown or text-only excerpts).
  • Desktop/Electron hardening:
  • Configure Electron windows with nodeIntegration: false and contextIsolation: true by default, especially for any surface that renders user- or network-sourced HTML.
  • Expose only narrowly scoped, vetted APIs through secure bridges instead of giving direct access to the Node.js runtime.
  • Apply the principle of least privilege to the renderer process to minimize the impact of any XSS that might still occur.
  • Trust minimization and UX:
  • Make it clear in UX and documentation that content clipped from the web is treated as untrusted.
  • Consider adding optional "safe view" modes where clipped content is flattened or stripped of interactivity by default.

How teams detect issues like this

The vulnerability can be surfaced using a mix of static inspection, dynamic testing, and configuration review:

  • Static analysis and code review:
  • Search for uses of contentDocument.write, document.write, or equivalent sink APIs where input can originate from stored or user-controllable HTML.
  • Flag flows where data from browser extensions, web clippers, or synchronized cloud storage is rendered without passing through a sanitizer.
  • Review iframe creation to ensure sandbox attributes and restrictive origins are enforced.
  • In Electron code, audit window construction options for risky flags such as nodeIntegration: true, contextIsolation: false, and broad preload scripts.
  • Automated security scanning:
  • Use web security scanners or browser automation to create and then render notes containing benign <img> or root-level elements with event handlers to check for execution.
  • Incorporate custom rules into linters or SAST tools to flag direct rendering of untrusted HTML into same-origin frames.
  • Policy and build-time checks:
  • Enforce project-wide policies forbidding unsanitized HTML rendering and requiring sandboxing for any semi-trusted content areas.
  • Integrate checks into CI/CD pipelines that fail builds when unsafe Electron configuration patterns or dangerous sink APIs are introduced.
  • Runtime monitoring (where possible):
  • Instrument logging around clip rendering paths to detect unusual script errors or behavior that might indicate malicious content execution.

Sources

SourceLink
github.comgithub.com/streetwriters/notesnook/security/advisories/GHSA-f42f-phvp-43x5

Frequently asked

questions

The vulnerability is broadly exploitable wherever users clip content from web pages that an attacker can influence—this includes malicious sites, compromised legitimate sites, or injected third-party widgets. Once a malicious clip is stored, simply opening that note can trigger the attack. In the desktop app, the same stored payload can escalate to full remote code execution.

Direct access to the victim's account is not required. The attacker mainly needs to control or craft content that the victim will clip (for example, by sending a link, hosting malicious content, or compromising a site the victim visits). After the victim clips the page and later opens the stored note, the attacker's payload executes in the context of the app. If the attacker already has account access, they may also be able to inject or synchronize malicious clips more directly.

The most robust fix pattern combines strict sanitization of all clipped HTML, safe rendering practices, and hardened Electron configuration. This means aggressively stripping or transforming active content from clips, rendering them in sandboxed or less-privileged contexts, and ensuring that even if script execution occurs, it cannot access Node.js primitives or sensitive APIs.

Future features that ingest or display externally sourced HTML should default to a "never trust, always sanitize" stance, relying on well-tested sanitization libraries and least-privilege rendering environments. Security reviews should specifically look for flows where untrusted HTML is rendered, ensure appropriate sandboxing and isolation, and verify that desktop runtimes like Electron are configured to avoid exposing powerful capabilities to web content.

Find out what's already
exploitable in your codebase.