CVE-2026-51884: Langchain-Chatchat: path traversal enables arbitrary file write
CRITICALPoC AVAILABLECISA: ATTENDLangchain-Chatchat 0.3.1 has a path traversal flaw in its temporary document upload endpoint (/knowledge_base/upload_temp_docs) that lets an unauthenticated remote attacker write files to arbitrary locations on the server by crafting malicious filenames. The CVSS score is 9.8 because exploitation needs no credentials, no user interaction and low complexity, and arbitrary file write on a server usually leads to remote code execution, for example by overwriting scripts, cron entries or SSH keys. Current exploitation signals are low: EPSS is 0.5% (59th percentile), the CVE is not in CISA KEV, and no public exploit or Nuclei template is confirmed, but a public gist and a GitHub issue describe the flaw, so a working exploit is trivial to build. Downstream dependents and affected product metadata are unknown, so assume any internet-exposed or internal Chatchat deployment is affected. Inventory Chatchat instances now, remove them from public exposure or put authentication in front of the endpoint, and watch the upstream issue #5466 for a fixed release since no patched version is confirmed.
What is the risk?
High, bordering on critical for exposed instances. The attack vector is network, complexity is low, and no privileges or user interaction are needed (CVSS 9.8: C:H/I:H/A:H). Chatchat is a self-hosted local knowledge-base and RAG chat application, and many deployments run with default settings and no authentication in front of the API. Real-world exploitation likelihood is currently modest (EPSS 0.5%, no KEV, no confirmed public exploit or scanner template), but the public gist and issue lower the effort needed to weaponize it. Because the CWE and affected product versions are not formally listed, scoping relies on the description, which names version 0.3.1 specifically; other versions have not been confirmed safe.
How does the attack unfold?
How severe is it?
What is the attack surface?
What should I do?
1 step1) Check upstream (chatchat-space/Langchain-Chatchat issue #5466) for a fixed release and upgrade beyond 0.3.1 as soon as one is available. 2) Until patched, block or disable the /knowledge_base/upload_temp_docs endpoint at the reverse proxy or WAF, and do not expose the Chatchat API to the internet. 3) Place the service behind authentication (SSO, VPN or mTLS) and restrict network access to trusted users. 4) Run Chatchat as an unprivileged user in a container with a read-only root filesystem and only the data directories writable. 5) Add WAF rules that reject filenames containing ../, ..\, encoded variants (%2e%2e%2f) or absolute paths in multipart uploads. 6) Detection: review web and proxy logs for requests to upload_temp_docs with traversal sequences in the filename field, and monitor for unexpected file creation or modification outside the temp directory (file integrity monitoring, auditd). 7) Rotate LLM provider keys and other secrets stored on hosts where exploitation is suspected.
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-2026-51884?
Langchain-Chatchat 0.3.1 has a path traversal flaw in its temporary document upload endpoint (/knowledge_base/upload_temp_docs) that lets an unauthenticated remote attacker write files to arbitrary locations on the server by crafting malicious filenames. The CVSS score is 9.8 because exploitation needs no credentials, no user interaction and low complexity, and arbitrary file write on a server usually leads to remote code execution, for example by overwriting scripts, cron entries or SSH keys. Current exploitation signals are low: EPSS is 0.5% (59th percentile), the CVE is not in CISA KEV, and no public exploit or Nuclei template is confirmed, but a public gist and a GitHub issue describe the flaw, so a working exploit is trivial to build. Downstream dependents and affected product metadata are unknown, so assume any internet-exposed or internal Chatchat deployment is affected. Inventory Chatchat instances now, remove them from public exposure or put authentication in front of the endpoint, and watch the upstream issue #5466 for a fixed release since no patched version is confirmed.
Is CVE-2026-51884 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2026-51884, increasing the risk of exploitation.
How to fix CVE-2026-51884?
1) Check upstream (chatchat-space/Langchain-Chatchat issue #5466) for a fixed release and upgrade beyond 0.3.1 as soon as one is available. 2) Until patched, block or disable the /knowledge_base/upload_temp_docs endpoint at the reverse proxy or WAF, and do not expose the Chatchat API to the internet. 3) Place the service behind authentication (SSO, VPN or mTLS) and restrict network access to trusted users. 4) Run Chatchat as an unprivileged user in a container with a read-only root filesystem and only the data directories writable. 5) Add WAF rules that reject filenames containing ../, ..\, encoded variants (%2e%2e%2f) or absolute paths in multipart uploads. 6) Detection: review web and proxy logs for requests to upload_temp_docs with traversal sequences in the filename field, and monitor for unexpected file creation or modification outside the temp directory (file integrity monitoring, auditd). 7) Rotate LLM provider keys and other secrets stored on hosts where exploitation is suspected.
What systems are affected by CVE-2026-51884?
This vulnerability affects the following AI/ML architecture patterns: RAG pipelines, LLM application frameworks, Self-hosted knowledge base chat applications, Document ingestion pipelines.
What is the CVSS score for CVE-2026-51884?
CVE-2026-51884 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 0.62%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0036Data from Information RepositoriesAML.T0037Data from Local SystemAML.T0049Exploit Public-Facing ApplicationCompliance Controls Affected
What are the technical details?
Original Advisory
The /knowledge_base/upload_temp_docs temporary document upload endpoint in Langchain Chatchat 0.3.1 is vulnerable to path traversal. By crafting malicious filenames, an attacker can write files to arbitrary locations on the server, bypassing the intended restrictions on the temporary directory.
Exploitation Scenario
An attacker finds an internet-exposed Chatchat instance through Shodan or a port scan. They send a multipart POST to /knowledge_base/upload_temp_docs with a filename such as ../../../../home/app/.ssh/authorized_keys or a path pointing to a Python module that the server imports or a cron directory. The server writes the attacker-controlled content outside the temp directory. The attacker then logs in over SSH or waits for the overwritten script or module to be executed, gaining code execution as the Chatchat service account. From there they read .env files and config containing LLM API keys, exfiltrate the private knowledge base, and use the host as a pivot into the internal network.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HReferences
Timeline
Related Vulnerabilities
CVE-2025-5952810.0Flowise: Unauthenticated RCE via MCP config injection
Same attack type: Code ExecutionCVE-2024-291210.0BentoML: RCE via insecure deserialization (CVSS 10)
Same attack type: Code ExecutionCVE-2023-376510.0MLflow: path traversal allows arbitrary file read
Same attack type: Data LeakageCVE-2025-512010.0smolagents: sandbox escape enables unauthenticated RCE
Same attack type: Data LeakageCVE-2026-2185810.0n8n: Input Validation flaw enables exploitation
Same attack type: Code Execution