AgentbeamBeta
AI agent vulnerability · n8n

CVE-2025-52478: Stored XSS in n8n Form Trigger allows Account Takeover via injected iframe and video/source

highCVSS 3.1 8.7GHSA-hfmv-hhh3-43f2

n8n 1.77.0 up to 1.98.1 has a stored cross-site scripting flaw in the Form Trigger node. A low-privileged user can build a form with an injected iframe or video tag that runs JavaScript when a victim opens it, which can lead to account takeover. Upgrade to 1.98.2.

Published Aug 19, 2025 · Analysis Nov 10, 2026

What an attacker can do

The Form Trigger node's HTML element does not neutralize attacker-supplied HTML. An authenticated user can inject an iframe with a srcdoc payload that holds JavaScript, or a video tag with a source element whose onerror handler runs script.

When a victim opens the crafted form, the script can steal the n8n-browserId cookie and session cookies. The attacker then acts as the victim and can change account details such as the email address, which gives full account control. The risk is higher where two-factor authentication is off.

The attacker needs an account that can create workflows with forms, and the victim must visit the form, so user interaction is required. On a shared n8n instance, that means any editor can target an admin. The advisory scores it 8.7 (high).

Who is affected

The npm package n8n, versions from 1.77.0 up to but not including 1.98.2. This applies to self-hosted instances that let more than one person build workflows. Check:

npm ls -g n8n

For Docker, look at the image tag. The version also shows in the n8n UI help menu.

n8n

Ecosystem
npm
Affected
>= 1.77.0, < 1.98.2
Fixed in
1.98.2
Check
npm ls n8n

How to fix it

Upgrade to 1.98.2 (pull request 16329). The advisory also gives workarounds for those who cannot upgrade yet:

  • Serve webhook requests from a separate domain through a reverse proxy.
  • Disable or restrict the Form Trigger's HTML element type.
  • Apply a Content Security Policy that blocks inline scripts and srcdoc.

How to tell if you were hit

Review Form Trigger nodes in your workflows for HTML elements that contain iframe, srcdoc, video, source or onerror. Check for account email changes you did not expect, new sessions from unfamiliar addresses, and workflows edited by low-privileged users that contain forms.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

A stored Cross-Site Scripting (XSS) vulnerability was identified in 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. 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].
  • 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

Credited to dana-gill, pfelilpe, agustedone, ffaggiani, LucianoSorrentino95.

Questions

Does CVE-2025-52478 need user interaction?

Yes. A victim has to open the crafted form. The attacker also needs a low-privileged account that can create forms.

Is n8n 1.98.2 affected?

No. 1.98.2 is the fixed version. Affected versions run from 1.77.0 up to below 1.98.2.

What can an attacker steal?

The script can read the n8n-browserId and session cookies, which lets the attacker impersonate the victim and change account details such as the email address.

Is there a workaround besides upgrading?

Yes. Serve webhooks from a separate domain, restrict the Form Trigger HTML element type, or set a CSP that blocks inline scripts and srcdoc.

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 entries