/

CVE-2026-118648

Severity:

HIGH RISK

(7.3)

Stored XSS (CWE-79) in n8n Webhook Response Handling

CVE-2026-118648

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Session compromise and unauthorized actions

Severity:

HIGH RISK

(7.3)

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 contains a stored cross-site scripting vulnerability in certain webhook response paths that do not apply the expected sandbox Content-Security-Policy. An authenticated member who can create and activate workflows may serve attacker-controlled HTML from the n8n origin, potentially causing scripts to run with the session privileges of users who open the webhook URL.

n8n contains a stored cross-site scripting vulnerability in certain webhook response paths that do not apply the expected sandbox Content-Security-Policy. An authenticated member who can create and activate workflows may serve attacker-controlled HTML from the n8n origin, potentially causing scripts to run with the session privileges of users who open the webhook URL.

Affected context

The issue affects n8n deployments where authenticated workflow members can create and activate workflows that expose webhook responses. Risk is higher for response paths, including some error responses or responses without headers, that omit the sandbox Content-Security-Policy and therefore allow returned HTML to execute in the n8n origin. A user must open the affected webhook URL for the stored content to affect that user's browser session.

The issue affects n8n deployments where authenticated workflow members can create and activate workflows that expose webhook responses. Risk is higher for response paths, including some error responses or responses without headers, that omit the sandbox Content-Security-Policy and therefore allow returned HTML to execute in the n8n origin. A user must open the affected webhook URL for the stored content to affect that user's browser session.

Exploit preconditions

  • Attack surface: HTTP webhook response handling in n8n
  • Required access: An authenticated account with permission to create and activate workflows
  • Trigger point: A user opens a webhook URL whose response contains attacker-controlled HTML
  • Why exploitation is possible: Certain response paths omit the sandbox Content-Security-Policy, allowing script-capable content to execute in the trusted n8n origin
  • Attack surface: HTTP webhook response handling in n8n
  • Required access: An authenticated account with permission to create and activate workflows
  • Trigger point: A user opens a webhook URL whose response contains attacker-controlled HTML
  • Why exploitation is possible: Certain response paths omit the sandbox Content-Security-Policy, allowing script-capable content to execute in the trusted n8n origin

Why this happens

The underlying flaw is inconsistent application of browser security headers across webhook response paths. When error responses or responses lacking headers bypass the sandbox Content-Security-Policy, workflow-controlled HTML can be returned without the intended execution restrictions. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because untrusted content can be interpreted as active browser markup or script.

The underlying flaw is inconsistent application of browser security headers across webhook response paths. When error responses or responses lacking headers bypass the sandbox Content-Security-Policy, workflow-controlled HTML can be returned without the intended execution restrictions. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because untrusted content can be interpreted as active browser markup or script.

Potential impact

  • A script may execute in the context of the n8n origin
  • Session data or accessible account information could be exposed
  • An attacker could perform actions available to the affected user's session
  • Administrative or workflow data could be modified if the victim has corresponding privileges
  • Additional users could be targeted through shared or distributed webhook URLs
  • A script may execute in the context of the n8n origin
  • Session data or accessible account information could be exposed
  • An attacker could perform actions available to the affected user's session
  • Administrative or workflow data could be modified if the victim has corresponding privileges
  • Additional users could be targeted through shared or distributed webhook URLs

General mitigation guidance

Mitigation should focus on consistently treating workflow-generated webhook output as untrusted browser content.

Common defensive patterns include:

  • Apply a restrictive sandbox Content-Security-Policy to every webhook response path, including errors and responses without custom headers
  • Prefer non-executable response formats and explicit content types where HTML is not required
  • Encode or sanitize user-controlled values before placing them into HTML responses
  • Restrict which workflow members can create and activate externally reachable webhooks
  • Use least-privilege roles and limit sensitive actions available to shared sessions
  • Add regression tests that verify security headers across normal, error, and headerless response paths

Mitigation should focus on consistently treating workflow-generated webhook output as untrusted browser content.

Common defensive patterns include:

  • Apply a restrictive sandbox Content-Security-Policy to every webhook response path, including errors and responses without custom headers
  • Prefer non-executable response formats and explicit content types where HTML is not required
  • Encode or sanitize user-controlled values before placing them into HTML responses
  • Restrict which workflow members can create and activate externally reachable webhooks
  • Use least-privilege roles and limit sensitive actions available to shared sessions
  • Add regression tests that verify security headers across normal, error, and headerless response paths

How teams detect issues like this

Organizations can detect this class of issue through:

  • Static analysis and code review checks for response branches that omit security headers
  • Tests that exercise successful, error, redirect, and no-header webhook responses
  • Dynamic checks confirming that returned HTML is not executable in the n8n origin
  • Monitoring for unusual workflow-created webhook pages and unexpected changes in response content
  • Policy enforcement requiring consistent Content-Security-Policy and content-type headers on browser-facing endpoints
  • Automated security review tools that identify unescaped HTML output and inconsistent response middleware coverage

Organizations can detect this class of issue through:

  • Static analysis and code review checks for response branches that omit security headers
  • Tests that exercise successful, error, redirect, and no-header webhook responses
  • Dynamic checks confirming that returned HTML is not executable in the n8n origin
  • Monitoring for unusual workflow-created webhook pages and unexpected changes in response content
  • Policy enforcement requiring consistent Content-Security-Policy and content-type headers on browser-facing endpoints
  • Automated security review tools that identify unescaped HTML output and inconsistent response middleware coverage

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-mp7q-23hg-35cf
vulncheck.comvulncheck.com/advisories/n8n-before-1.123.85-2.43.5-and-2.44.1-stored-xss-via-webhook-responses-missing-sandbox-policy

Frequently asked

questions

It can be triggered through a webhook URL, but exploitation generally requires an authenticated workflow member to create and activate the malicious workflow and a target user to open the URL.

The attacker needs an authenticated account with permissions to create and activate workflows. The impact also depends on the privileges of users who visit the affected webhook.

Apply a restrictive sandbox Content-Security-Policy consistently across all webhook response paths, and treat workflow-controlled output as untrusted content.

Centralize response-security middleware, enforce safe content types and output encoding, test every response branch, and limit workflow and webhook permissions according to least privilege.

It can be triggered through a webhook URL, but exploitation generally requires an authenticated workflow member to create and activate the malicious workflow and a target user to open the URL.

The attacker needs an authenticated account with permissions to create and activate workflows. The impact also depends on the privileges of users who visit the affected webhook.

Apply a restrictive sandbox Content-Security-Policy consistently across all webhook response paths, and treat workflow-controlled output as untrusted content.

Centralize response-security middleware, enforce safe content types and output encoding, test every response branch, and limit workflow and webhook permissions according to least privilege.

Find out what's already
exploitable in your codebase.