/

CVE-2026-33749

Severity:

CRITICAL RISK

(9.0)

Cross-Site Scripting (XSS) in n8n Workflows

CVE-2026-33749

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Account Takeover and Privilege Escalation via Stored XSS

Severity:

CRITICAL RISK

(9.0)

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

n8n contained a stored cross-site scripting vulnerability where crafted workflows could generate HTML binary data that the platform served inline without protective HTTP headers.

When a privileged user opened the attacker-controlled binary-data URL, the HTML executed with full same-origin JavaScript access, allowing theft of credentials, workflow data, and potential privilege escalation to admin.

Affected context

This vulnerability arises in n8n instances where authenticated users are allowed to create or modify workflows that emit binary data responses.

If such a workflow produced HTML content without assigning a filename, the /rest/binary-data endpoint returned that content inline on the n8n origin.

In affected versions, these responses lacked Content-Disposition and Content-Security-Policy headers, letting arbitrary HTML and JavaScript execute in the context of the n8n web application when a user followed the generated URL.

Exploit preconditions

  • Attack surface: n8n web interface and /rest/binary-data HTTP endpoint.
  • Required access: An authenticated account with permission to create or modify workflows.
  • Attacker capabilities: Ability to design a workflow that outputs HTML as a binary data object without specifying a filename, and to deliver the resulting binary-data URL to a more privileged user (e.g., via email, chat, or in-app communication).
  • Victim interaction: A higher-privileged user (such as an admin or user with sensitive workflow access) must visit the attacker-controlled binary-data URL while logged into n8n.
  • Why exploitation is possible: The endpoint serves attacker-controlled HTML inline on the same origin as the main application, without Content-Disposition to force download and without a restrictive Content-Security-Policy, allowing untrusted JavaScript to execute with the victim's session context.

Why this happens

The core issue is a stored cross-site scripting flaw where application-generated, user-controlled HTML is treated as trusted content and rendered in the browser under the application's origin.

Binary data objects produced by workflows can contain arbitrary HTML and JavaScript, but the /rest/binary-data handler omitted defensive response headers and did not enforce a safe content delivery pattern.

This maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), because attacker-controlled content is delivered in a way that lets it execute as script within the trusted n8n origin, inheriting authentication and same-origin privileges.

Potential impact

  • Hijacking of active n8n sessions belonging to higher-privileged users.
  • Exfiltration of workflows, credentials, secrets, or other sensitive configuration data accessible to the victim.
  • Unauthorized modification of existing workflows or creation of new malicious workflows.
  • Privilege escalation from a low-privileged user to administrative privileges within n8n.
  • Persistence of malicious automation within the platform, enabling ongoing data exfiltration or tampering.

General mitigation guidance

Long-term mitigation focuses on preventing untrusted HTML from executing in the application's origin and enforcing safer content delivery practices.

Useful defensive patterns include:

  • Serving user-controlled binary or HTML-like content with Content-Disposition: attachment to encourage download instead of inline rendering.
  • Applying a restrictive Content-Security-Policy that disallows inline script execution and limits script sources, so even if HTML is rendered, JavaScript execution is constrained.
  • Isolating untrusted HTML on a separate origin or sandboxed domain (e.g., separate host or subdomain) to break same-origin access to the main application.
  • Normalizing binary-data handling so that workflows cannot implicitly produce active HTML/JS responses under the main application origin.
  • Minimizing the privileges assigned to accounts that can create or modify workflows, applying least-privilege principles and role separation.
  • Reviewing and limiting where user-controlled or workflow-controlled content can influence HTTP response headers or body content sent from sensitive endpoints.

How teams detect issues like this

Detection strategies can combine code-level checks, configuration review, and runtime monitoring:

  • Static analysis and code review:
  • Flag endpoints that return user-controlled or workflow-controlled content without explicit Content-Disposition and Content-Security-Policy headers.
  • Identify places where binary or text content from internal automation pipelines is sent directly as an HTTP response on the primary application origin.
  • Review routing and controller logic around /rest/binary-data (or similar endpoints) for missing output encoding and missing isolation.
  • Security testing:
  • Perform application penetration tests focusing on workflows that generate binary data or HTML-like outputs.
  • Use automated scanners to probe for reflected and stored XSS vectors involving binary and attachment-style endpoints.
  • Runtime and policy enforcement:
  • Employ web application firewalls or security gateways that can detect and alert on suspicious HTML or script patterns in responses from binary-data endpoints.
  • Implement configuration policies requiring that endpoints with user-supplied content set restrictive security headers, enforced via automated CI/CD checks.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-qfc3-hm4j-7q77

Frequently asked

questions

Exploitation is limited to environments where users can create or modify workflows and then persuade a more privileged user to open a crafted binary-data URL while logged into n8n. It is not a fully unauthenticated attack, but once triggered, it can have critical impact.

An attacker needs an authenticated account on the n8n instance with permissions to create or edit workflows. From there, they can generate malicious HTML output and rely on social engineering or in-app placement to get a privileged user to load the URL.

The safest pattern is to ensure that any user-controlled or workflow-generated HTML is never executed in the same origin as the core application. This typically means serving it as a download (Content-Disposition: attachment), applying a strict Content-Security-Policy, and/or isolating such content on a separate, sandboxed origin.

Treat all user-controlled content—including data produced by internal automation or workflows—as untrusted by default. Use robust output encoding, strict CSP, and origin isolation; enforce security headers on endpoints serving arbitrary content; restrict powerful creation/edit permissions; and integrate XSS-focused reviews and automated checks into development and deployment pipelines.

Find out what's already
exploitable in your codebase.