CVE-2025-52478: N8n Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-hfmv-hhh3-43f2
CVSS 8.7
CWE-79
Published
Advisory Summary

CVE-2025-52478 is a HIGH (CVSS 8.7) remote code execution vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting N8n libraries in the npm ecosystem. The issue involves stored xss in n8n form trigger allows account takeover via injected iframe and video/source. Remediation is available by upgrading affected packages to version 1.98.2.

CVE-2025-52478 at a Glance

CVE Identifier CVE-2025-52478
GHSA Identifier GHSA-hfmv-hhh3-43f2
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product N8n
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2025-52478

To remediate this vulnerability, upgrade all affected N8n dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

n8n fixed: 1.98.2
npm install n8n@1.98.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls n8n

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-52478, inspect your project dependencies using npm:

npm ls n8n

Analyze the terminal output to locate any version of N8n in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.98.2), your application is affected.

Note: The npm ls n8n command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In N8n, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact A stored **Cross-Site Scripting (XSS)** vulnerability was identified in [n8n](https://github.com/n8n-io/n8n), specifically in the **Form Trigger** node's **HTML form element**. An authenticated attacker can inject malicious HTML via an `<iframe>` with a `srcdoc` payload that includes arbitrary JavaScript execution. The attacker can also inject malicious Javascript by using `<video>` coupled `<source>` using an `onerror` event. While using `iframe` or a combination of `video` and `source` tag, this vulnerability allows for Account Takeover (ATO) by exfiltrating `n8n-browserId` and session cookies from authenticated users who visit a maliciously crafted form. Using these tokens and cookies, an attacker can impersonate the victim and change account details such as email addresses, enabling full control over the account—especially if 2FA is not enabled. ### Patches The issue was addressed in [PR #16329](https://github.com/n8n-io/n8n/pull/16329). Users should upgrade to version >=1.98.2. ### Workarounds Apart from updating to the fixed version, n8n instance administrators can: - Configure a reverse proxy to **serve webhook requests from a different domain** [[docs](https://docs.n8n.io/hosting/configuration/configuration-examples/webhook-url/)]. - Disable or restrict use of the **Form Trigger node**, particularly the **HTML** element type. - Use a Content Security Policy (CSP) to block execution of inline scripts and disallow use of `srcdoc`. ### References - [OWASP XSS Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/XSS_Prevention_Cheat_Sheet.html) - [MDN: iframe `srcdoc` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-srcdoc) - [HTML: `onerror` attribute](https://html.spec.whatwg.org/multipage/webappapis.html#handler-onerror)

CVE-2025-52478 Affected N8n Versions

1 component(s)
Fixed Versions:
1.98.2
Product / Package Ecosystem Affected Versions Fixed Version
n8n
npm
≥ 1.77.0
< 1.98.2
1.98.2

References

Frequently Asked Questions

What is CVE-2025-52478?
CVE-2025-52478 is a security vulnerability in N8n involving Stored XSS in n8n Form Trigger allows Account Takeover via injected iframe and video/source under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which N8n versions are affected?
Affected versions include releases prior to 1.98.2 across affected packages: n8n.
What version fixes CVE-2025-52478?
Upgrading to 1.98.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is n8n affected?
Yes, n8n is affected in releases prior to 1.98.2. Upgrade your dependency to 1.98.2 or later.
What is the CVSS score of CVE-2025-52478?
CVE-2025-52478 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2025-52478?
CVE-2025-52478 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2025-52478?
Run the dependency tree command: 'npm ls n8n'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hfmv-hhh3-43f2",
  "modified" : "2025-08-19T20:58:33Z",
  "published" : "2025-08-19T15:33:35Z",
  "aliases" : [ "CVE-2025-52478" ],
  "summary" : "Stored XSS in n8n Form Trigger allows Account Takeover via injected iframe and video/source",
  "details" : "### Impact\n\nA stored **Cross-Site Scripting (XSS)** vulnerability was identified in [n8n](https://github.com/n8n-io/n8n), specifically in the **Form Trigger** node's **HTML form element**. An authenticated attacker can inject malicious HTML via an `<iframe>` with a `srcdoc` payload that includes arbitrary JavaScript execution. The attacker can also inject malicious Javascript by using `<video>` coupled `<source>` using an `onerror` event.\n\nWhile using `iframe` or a combination of `video` and `source` tag, this vulnerability allows for Account Takeover (ATO) by exfiltrating `n8n-browserId` and session cookies from authenticated users who visit a maliciously crafted form. Using these tokens and cookies, an attacker can impersonate the victim and change account details such as email addresses, enabling full control over the account—especially if 2FA is not enabled.\n\n### Patches\nThe issue was addressed in [PR #16329](https://github.com/n8n-io/n8n/pull/16329). Users should upgrade to version >=1.98.2.\n\n### Workarounds\nApart from updating to the fixed version, n8n instance administrators can:\n- Configure a reverse proxy to **serve webhook requests from a different domain** [[docs](https://docs.n8n.io/hosting/configuration/configuration-examples/webhook-url/)].\n- Disable or restrict use of the **Form Trigger node**, particularly the **HTML** element type.\n- Use a Content Security Policy (CSP) to block execution of inline scripts and disallow use of `srcdoc`.\n\n### References\n- [OWASP XSS Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/XSS_Prevention_Cheat_Sheet.html)\n- [MDN: iframe `srcdoc` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-srcdoc)\n- [HTML: `onerror` attribute](https://html.spec.whatwg.org/multipage/webappapis.html#handler-onerror)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "n8n"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.77.0"
      }, {
        "fixed" : "1.98.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/n8n-io/n8n/security/advisories/GHSA-hfmv-hhh3-43f2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-52478"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/n8n-io/n8n/pull/16329"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/n8n-io/n8n/commit/7940384a85041a1890b1203d69c092c887312500"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/n8n-io/n8n"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-19T15:33:35Z",
    "nvd_published_at" : "2025-08-19T17:15:40Z"
  }
}