Skip to main content
Vulnerability Database/CVE-2025-52478

CVE-2025-52478: N8n Workflow Automation XSS Vulnerability

CVE-2025-52478 is a stored Cross-Site Scripting flaw in N8n workflow automation platform affecting versions 1.77.0 to 1.98.1. Attackers can exploit Form Trigger nodes to steal session data and take over accounts. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

Published:

CVE-2025-52478 Overview

n8n is an open-source workflow automation platform used to build integrations and business processes. CVE-2025-52478 is a stored Cross-Site Scripting (XSS) vulnerability in the Form Trigger node's HTML form element [CWE-79]. Affected versions range from 1.77.0 up to but not including 1.98.2. An authenticated attacker can inject malicious HTML through an <iframe>srcdoc payload or a <video>/<source> combination using an onerror handler. Victims who load the crafted form execute attacker-controlled JavaScript in their browser session. The vendor released a fix in version 1.98.2.

Critical Impact

Successful exploitation allows exfiltration of the n8n-browserId value and session cookies, enabling full account takeover, including email changes when 2FA is not enabled.

Affected Products

  • n8n versions 1.77.0 through 1.98.1 (Node.js distribution)
  • n8n Form Trigger node HTML form element
  • Deployments where authenticated users can create or edit Form Trigger workflows

Discovery Timeline

  • 2025-08-19 - CVE-2025-52478 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-52478

Vulnerability Analysis

The Form Trigger node renders user-supplied HTML into forms served to end users. Input sanitization in the Form node relied on sanitize-html but did not adequately restrict tags and attributes that can execute JavaScript. An authenticated attacker with permission to edit or create workflows can inject two known payload patterns. The first uses an <iframe> with a srcdoc attribute containing arbitrary HTML and JavaScript. The second uses a <video> element containing a <source> child whose onerror handler fires when the source fails to load. Both payloads execute in the origin of the n8n instance when a victim opens the crafted form.

Root Cause

The root cause is insufficient allowlist configuration in the sanitizeHtml wrapper inside the Form node's utilities. Tags such as iframe, video, and source and event-handler attributes such as onerror were not stripped before the HTML reached the browser DOM. Because forms are served from the n8n origin, injected script runs with access to browser-scoped authentication material.

Attack Vector

Exploitation requires an authenticated user to publish a Form Trigger workflow with a malicious HTML payload. A second authenticated user then visits the form URL, at which point the script executes and reads cookies and the n8n-browserId storage value. Exfiltration typically occurs via an outbound fetch() call to an attacker-controlled endpoint. With the stolen tokens, the attacker impersonates the victim, changes the primary email address, and locks the account when multi-factor authentication is not enforced.

typescript
// Security patch: packages/nodes-base/nodes/Form/utils/utils.ts
// fix(n8n Form Node): Prevent XSS with video and source tags (#16329)
} from 'n8n-workflow';
import sanitize from 'sanitize-html';

-import type { FormTriggerData, FormTriggerInput } from './interfaces';
-import { FORM_TRIGGER_AUTHENTICATION_PROPERTY } from './interfaces';
-import { getResolvables } from '../../utils/utilities';
-import { WebhookAuthorizationError } from '../Webhook/error';
-import { validateWebhookAuthentication } from '../Webhook/utils';
+import { getResolvables } from '../../../utils/utilities';
+import { WebhookAuthorizationError } from '../../Webhook/error';
+import { validateWebhookAuthentication } from '../../Webhook/utils';
+import { FORM_TRIGGER_AUTHENTICATION_PROPERTY } from '../interfaces';
+import type { FormTriggerData, FormTriggerInput } from '../interfaces';

export function sanitizeHtml(text: string) {
    return sanitize(text, {

Source: GitHub commit 7940384

Detection Methods for CVE-2025-52478

Indicators of Compromise

  • Form Trigger workflow definitions containing <iframe, srcdoc=, <video, <source, or onerror= substrings in HTML fields
  • Outbound HTTP requests from browsers loading n8n form URLs to unrecognized third-party hosts carrying cookie values or n8n-browserId identifiers
  • Unexpected changes to user email addresses or account settings shortly after a form was accessed
  • Workflow audit logs showing new or edited Form Trigger nodes by non-administrative users

Detection Strategies

  • Inspect stored workflow JSON in the n8n database for dangerous HTML tags and event-handler attributes within Form Trigger node parameters
  • Monitor web server access logs for form URL requests followed by outbound requests to external domains in short time windows
  • Correlate account setting changes with recent authentication events from unusual IP addresses or user agents

Monitoring Recommendations

  • Enable and centrally collect n8n audit logs and browser session events
  • Alert on creation or modification of Form Trigger nodes by users outside a defined workflow author group
  • Track failed and successful authentication events per user to detect session reuse from new locations

How to Mitigate CVE-2025-52478

Immediate Actions Required

  • Upgrade n8n to version 1.98.2 or later without delay
  • Enforce multi-factor authentication for all n8n users to limit impact of stolen session material
  • Audit existing Form Trigger workflows for suspicious HTML content and remove untrusted markup
  • Rotate active sessions and invalidate cached n8n-browserId values after upgrading

Patch Information

The vendor addressed the vulnerability in n8n 1.98.2. Refer to GitHub Security Advisory GHSA-hfmv-hhh3-43f2, pull request #16329, and commit 7940384 for implementation details. The patch tightens the sanitize-html allowlist and refactors the Form node utilities to consistently sanitize HTML that reaches the DOM.

Workarounds

  • Restrict workflow creation and edit permissions to a minimal set of trusted users until the upgrade is applied
  • Place n8n behind a reverse proxy that enforces a strict Content Security Policy on form endpoints
  • Disable or remove Form Trigger nodes that accept custom HTML if they are not required
bash
# Upgrade n8n via npm to the patched release
npm install -g n8n@1.98.2

# Or pull the patched Docker image
docker pull n8nio/n8n:1.98.2
docker stop n8n && docker rm n8n
docker run -d --name n8n -p 5678:5678 n8nio/n8n:1.98.2

# Verify installed version
n8n --version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.