CVE-2026-25051: n8n's Improper CSP Enforcement in Webhook Responses May Allow Stored XSS
n8n webhook responses can skip the Content Security Policy sandbox that isolates HTML output. A user who can create or edit workflows can plant a script that runs with same-origin privileges when another user opens the crafted workflow's page. That can lead to session hijacking and account takeover. Fixed in n8n 1.122.5 and 1.123.2.
Published Feb 4, 2026 · Analysis Nov 1, 2026
What an attacker can do
n8n sends a CSP sandbox header with HTML webhook responses so that attacker-controlled markup cannot reach the n8n origin. The function that decides whether a response is HTML, isHtmlRenderedContentType in packages/core/src/html-sandbox.ts, did not trim whitespace from the content type. A value with a leading space, such as " text/html", was judged not to be HTML, so the sandbox header was not applied while a browser still rendered the page.
The attacker needs an authenticated account with permission to create or change workflows, and another user must interact with the crafted workflow. The script then runs in the n8n origin with that user's session. The CVSS 4.0 vector has user interaction as passive and high confidentiality and integrity impact. On a shared instance, an editor could take over an administrator's account this way.
The advisory ties the risk to workflows that take input from webhooks, forms or MCP servers, since those are the ways another party's content ends up in a response.
Who is affected
n8n below 1.122.5, and the 1.123 line below 1.123.2 (from 1.123.0). Instances where several people can build workflows are most exposed. Check your version:
npm ls n8nFor Docker or cloud installs, read the version shown in the n8n UI under help and about.
n8n
- Ecosystem
- npm
- Affected
- >= 1.123.0, < 1.123.2
- Fixed in
- 1.123.2
- Check
npm ls n8n
n8n
- Ecosystem
- npm
- Affected
- < 1.122.5
- Fixed in
- 1.122.5
- Check
npm ls n8n
How to fix it
Upgrade to n8n 1.122.5 or 1.123.2, or later. The fix commit makes isHtmlRenderedContentType trim whitespace before it lowercases the content type, and adds a test for padded values. The CSP itself is unchanged.
Temporary mitigations from the advisory, which it says do not fully remove the risk:
- Limit workflow creation and editing to fully trusted users.
- Never run untrusted workflows.
- Review workflows that receive data from webhooks, forms or MCP servers before running them manually.
How to tell if you were hit
Review workflows with webhook, form or respond-to-webhook nodes for responses that set a Content-Type header with leading or extra spaces, or that return HTML with script tags. Check who edited those workflows recently. In access logs, look at webhook responses delivered without a Content-Security-Policy header. The sources give no log signature for a successful attack. If an editor account is untrusted or compromised, treat sessions of users who opened its workflows as exposed and rotate them.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
A Cross-site Scripting (XSS) vulnerability has been identified in the handling of webhook responses and related HTTP endpoints. Under certain conditions, the Content Security Policy (CSP) sandbox protection intended to isolate HTML responses may not be applied correctly.
An authenticated user with permission to create or modify workflows could abuse this to execute malicious scripts with same-origin privileges when other users interact with the crafted workflow. This could lead to session hijacking and account takeover.
Patches
The issue has been fixed in n8n versions 1.122.5 and 1.123.2. Users should upgrade to these versions or later to remediate the vulnerability.
Workarounds
If upgrading is not immediately possible, administrators should consider the following temporary mitigations:
- Limit workflow creation and editing permissions to fully trusted users only.
- Never execute untrusted workflows.
- Review workflows that receive data from via webhooks, forms, or MCP servers to ensure they are communicating with trusted entities before executing them manually.
These workarounds do not fully remediate the risk and should only be used as short-term mitigation measures.
--- n8n has adopted CVSS 4.0 as primary score for all security advisories. CVSS 3.1 vector strings are provided for backward compatibility.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N
Credited to weblover12.
Questions
- Does CVE-2026-25051 need a logged-in attacker?
Yes. The attacker needs permission to create or modify workflows. Another user must then interact with the crafted workflow.
- What does the attack get?
Script execution with same-origin privileges in n8n, which the advisory says can lead to session hijacking and account takeover.
- Which n8n versions fix it?
1.122.5 on the 1.122 line and 1.123.2 on the 1.123 line. Later versions are also fixed.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More n8n vulnerabilities
All n8n entriesCVE-2026-86073
n8n: Per-Resource OAuth Consent Bypass via Unbound Refresh Token Resource Substitution
medium5.9Sep 10, 2026CVE-2026-86074
n8n: Instance AI Credential Setup Accepts Unvalidated Probe URL from Fetched Content
medium5.9Sep 10, 2026CVE-2026-86075
n8n: Unauthenticated Persistent Storage Exhaustion via OAuth Dynamic Client Registration Endpoint
high8.7Sep 10, 2026CVE-2026-86076
n8n: Expression Sandbox Escape via Class-Field Sanitizer Rebinding Can Lead to Code Execution
high8.7Sep 10, 2026CVE-2026-86077
n8n: Anonymous Approval-Gate Bypass via Reused resumeToken over the Chat WebSocket
medium6.3Sep 10, 2026CVE-2026-86078
n8n: Prototype Pollution via Workflow Structure Summary Can Lead to Denial of Service
medium6.0Sep 10, 2026
