highAgent ThreatFramework Vulnerability

n8n HTML Preview DOM-Based XSS via Unsandboxed iframe srcdoc

First seen Jul 22, 2026 · Updated Jul 22, 2026

n8nxssdom-basediframe-sandboxworkflow-automationsession-hijackcsp-bypassASI09 · Human Trust ExploitationSurface: Human InterfacePropagation: Single Hop

n8n's HTML preview feature renders workflow output into an iframe without a sandbox attribute, allowing a sanitizer bypass to execute attacker-controlled script in the same origin as the editor. Since n8n orchestrates automated workflows and often integrates with AI agents and external data sources, this could let an attacker with low-privilege access (global:member) hijack an authenticated user's session to call privileged APIs. The vendor has released patched versions and interim mitigations via CSP hardening.

Technical Analysis

The vulnerability arises because n8n renders execution output (e.g., from HTML nodes or binary HTML previews) into an iframe using the srcdoc attribute without the sandbox attribute, meaning injected content executes in the same origin as the parent editor application rather than in an isolated context. An attacker who can influence workflow output (e.g., via an HTML node processing external or agent-supplied data) can bypass the sanitizer and inject script that executes when a victim views the preview. Because the injected script runs same-origin, it can access the victim's authenticated session and invoke n8n's internal APIs, effectively enabling privilege escalation from a low-privileged 'global:member' account to actions available to the viewing user. This crosses trust boundaries between workflow-generated content (potentially agent- or tool-produced) and the trusted editor UI, turning a data-rendering surface into a code-execution vector.

Affected Systems

n8n

Detection Signatures

  • Monitor for iframe srcdoc usage without sandbox attribute in n8n HTML/binary preview rendering paths
  • Look for anomalous script tags or event handler attributes in workflow output data destined for HTML preview nodes
  • Audit CSP headers for missing 'script-src' inline restrictions (N8N_CONTENT_SECURITY_POLICY not set or permissive)
  • Review access logs for global:member accounts triggering unusual authenticated API calls shortly after opening HTML previews
  • Inspect workflows that render externally-controlled input directly into HTML/binary preview nodes

Remediation Steps

  1. 1

    Upgrade n8n

    Update to patched versions 1.123.64, 2.29.8, 2.30.1, or later which fix the unsandboxed iframe srcdoc issue.

  2. 2

    Restrict instance access

    Limit n8n access to fully trusted users until upgraded, especially those with global:member or higher privileges.

  3. 3

    Harden CSP

    Set N8N_CONTENT_SECURITY_POLICY to a strict policy that blocks inline script execution as a temporary mitigation.

  4. 4

    Avoid exposing risky nodes

    Do not expose workflows that render externally-controlled input via HTML nodes or binary HTML previews to untrusted or low-privileged users.

  5. 5

    Sandbox iframe rendering

    Verify post-patch behavior enforces the sandbox attribute on preview iframes and validate sanitizer effectiveness through testing.

CVE / Advisory IDs

CVE-2026-65597GHSA-p3rg-hrf9-w9gj

Industries Most Exposed

softwaretechnologyworkflow-automationdevopsany industry using n8n for AI-driven or business process automation

Sources

Respond to this threat

Pro subscribers get a full AI-generated incident-response playbook for this threat — detection, containment, eradication, and recovery steps — plus an unlimited AI Threat Advisor for questions about your environment.