Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-65597

CVE-2026-65597: n8n DOM-Based XSS Vulnerability

CVE-2026-65597 is a DOM-based XSS flaw in n8n that allows attackers to execute scripts in the HTML preview via sanitizer bypass. This post covers the technical details, affected versions, impact, and mitigation.

Published:

CVE-2026-65597 Overview

CVE-2026-65597 is a DOM-based cross-site scripting (XSS) vulnerability in n8n, an open-source workflow automation platform. The flaw resides in the HTML preview component, which renders execution output into an iframe srcdoc without the sandbox attribute. A sanitizer bypass allows attacker-controlled script to execute in the same origin as the editor. An authenticated user with global:member privileges can trigger the issue against a victim who opens the preview. The injected script can then invoke authenticated APIs using the victim's session, enabling account takeover and workflow tampering.

Critical Impact

Same-origin script execution in the n8n editor context enables hijacking of authenticated API sessions, including those belonging to administrators.

Affected Products

  • n8n versions before 1.123.64
  • n8n 2.x versions before 2.29.8
  • n8n versions before 2.30.1

Discovery Timeline

  • 2026-07-22 - CVE-2026-65597 published to NVD
  • 2026-07-22 - Last updated in NVD database

Technical Details for CVE-2026-65597

Vulnerability Analysis

The vulnerability is categorized under [CWE-79] (Improper Neutralization of Input During Web Page Generation). n8n renders workflow execution output through an HTML preview feature. The preview writes untrusted content into an iframe using the srcdoc attribute. Because the iframe is created without the sandbox attribute, script executing inside the iframe runs in the same origin as the n8n editor. A sanitizer intended to strip active content contains a bypass, allowing crafted payloads to survive filtering and execute as JavaScript.

Exploitation requires an authenticated account with global:member privileges and user interaction from a victim who opens the affected preview. Once triggered, the injected script inherits the victim's authenticated session and can issue calls to any n8n API endpoint the victim is authorized to reach.

Root Cause

Two defects combine to enable the attack. First, the iframe hosting execution output lacks the sandbox attribute, so the iframe shares the editor's origin instead of executing in an isolated null origin. Second, the HTML sanitizer applied to the preview content contains a bypass that fails to neutralize script-carrying constructs. The absence of a defense-in-depth boundary means a single sanitizer flaw yields full same-origin script execution.

Attack Vector

An attacker with global:member access crafts a workflow whose execution output contains a payload that bypasses the n8n sanitizer. When another user, such as an administrator, opens the HTML preview of that execution, the payload executes in the editor origin. The script can call authenticated n8n APIs to exfiltrate credentials stored in workflows, modify or create workflows, invoke webhooks, or escalate privileges through administrative endpoints.

No verified public exploit code is available. Refer to the GitHub Security Advisory and the VulnCheck Advisory on XSS for vendor technical details.

Detection Methods for CVE-2026-65597

Indicators of Compromise

  • Unexpected workflows, credentials, or user accounts created shortly after a global:member user submitted a new execution.
  • n8n API calls to sensitive endpoints originating from browser sessions immediately after opening an execution HTML preview.
  • Execution output records containing HTML with encoded <script> fragments, on* event handlers, or javascript: URIs.

Detection Strategies

  • Inventory n8n deployments and compare running versions against the fixed releases 1.123.64, 2.29.8, and 2.30.1.
  • Review audit logs for workflow modifications, credential access, or user role changes performed by administrator sessions shortly after opening a preview.
  • Inspect stored execution outputs for HTML content produced by low-privilege users and flag payloads that contain script-like constructs.

Monitoring Recommendations

  • Enable and centralize n8n audit logging, and forward events to a SIEM for correlation with browser and network telemetry.
  • Monitor outbound traffic from n8n hosts for anomalous webhook invocations or credential retrieval patterns.
  • Alert on newly created global:owner or global:admin accounts and on privilege changes to global:member users.

How to Mitigate CVE-2026-65597

Immediate Actions Required

  • Upgrade n8n to 1.123.64, 2.29.8, 2.30.1, or later according to the branch in use.
  • Restrict global:member role assignments to trusted users until patching is complete.
  • Rotate credentials stored in n8n and invalidate active editor sessions after upgrading.

Patch Information

The n8n maintainers released fixes in versions 1.123.64, 2.29.8, and 2.30.1. The patches add the sandbox attribute to the HTML preview iframe and address the sanitizer bypass. Full remediation details are documented in the GitHub Security Advisory GHSA-p3rg-hrf9-w9gj.

Workarounds

  • Disable use of the HTML preview feature for execution output until the upgrade is applied.
  • Limit workflow authoring privileges so only trusted operators can produce executions viewed by administrators.
  • Enforce a strict Content Security Policy on the reverse proxy fronting n8n to constrain inline script execution in the editor origin.
bash
# Upgrade n8n via npm to a patched release
npm install -g n8n@1.123.64

# Or pull a patched Docker image
docker pull n8nio/n8n:1.123.64
docker stop n8n && docker rm n8n
docker run -d --name n8n -p 5678:5678 n8nio/n8n:1.123.64

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.