CVE-2026-42867: Langflow: Path Traversal in Knowledge Bases API via Creation Endpoint
Langflow 1.8.4 and earlier build a knowledge base directory from the user-supplied name in POST /api/v1/knowledge_bases without checking where it lands. A caller can use ../ sequences or an absolute path to create directories and write two JSON files anywhere the server can write. Fixed in Langflow 1.9.0.
Published Jun 16, 2026 · Updated Jul 20, 2026 · Analysis Oct 26, 2026
What an attacker can do
The create_knowledge_base function in src/backend/base/langflow/api/v1/knowledge_bases.py joins the name field to the user's base directory and calls kb_path.mkdir() on the result. It then writes embedding_metadata.json and schema.json into that directory. Nothing restricts the path to the knowledge base root (CWE-22).
The advisory's examples are the name ../victim_user/evil_kb, which reaches another user's space, and the absolute path /tmp/pwned. Any directory the Langflow process can write to is reachable, such as /app/data.
The damage is bounded. The attacker creates directories and writes two files with application-defined content, and can overwrite existing copies of those two files, which corrupts other knowledge bases. The advisory does not claim code execution or file reads, and the CVSS vector rates integrity and availability low and confidentiality none. The vector lists no privileges required, while the advisory text says authenticated; treat any reachable instance as at risk, especially multi-user ones where tenants share one filesystem.
Who is affected
langflow on PyPI, version 1.8.4 and earlier. Every deployment that exposes the Knowledge Bases API is affected, with the greatest risk on shared instances. Check:
pip show langflowlangflow
- Ecosystem
- PyPI
- Affected
- <= 1.8.4
- Fixed in
- 1.9.0
- Check
pip show langflow
How to fix it
Upgrade to langflow 1.9.0 or later:
pip install --upgrade "langflow>=1.9.0"The fix, pull request 12337, adds a _validate_kb_path_containment() helper that uses Path.is_relative_to() rather than startswith(), and runs it before any filesystem operation. Traversal payloads now return 403 Forbidden. The advisory lists no workaround. Until you upgrade, you can block the POST /api/v1/knowledge_bases route for untrusted users at your proxy, and run Langflow as a user with a narrow write scope (my suggestions, not from the advisory).
How to tell if you were hit
Search access logs for POST /api/v1/knowledge_bases requests whose name contains .. or starts with /. On the host, look for embedding_metadata.json and schema.json files in unexpected places, such as /tmp or another user's knowledge base directory, and for directories you did not create. Check existing knowledge bases for those two files having changed unexpectedly.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
Langflow is vulnerable to Path Traversal in the Knowledge Bases API (POST /api/v1/knowledge_bases). This occurs because user-supplied knowledge base names are used directly to create file paths without proper sanitization or containment checks. An authenticated attacker can exploit this flaw to create directories and write files anywhere on the server's filesystem.
Details
The vulnerability exists in the create_knowledge_base function within src/backend/base/langflow/api/v1/knowledge_bases.py.
This function constructs file paths directly from the user-supplied name field without sanitization. The value is concatenated with the user's base directory and passed directly to kb_path.mkdir(). Immediately following the directory creation, the application writes embedding_metadata.json and schema.json into this attacker-controlled path.
PoC (Proof of Concept)
For the Create endpoint, an attacker can supply traversal sequences or absolute paths in the name field:
../victim_user/evil_kb or /tmp/pwned
This forces kb_path.mkdir() to create directories and write specific application files (embedding_metadata.json and schema.json) at any reachable path on the server.
Impact
Any Langflow instance exposing this endpoint to authenticated users is vulnerable. This exposes the server to:
- Cross-user data compromise: Creation of directories and files within another tenant's knowledge base space.
- Arbitrary filesystem manipulation: Directory creation at any path on the server where the application has write permissions (e.g.,
/app/data). - Data overwrite: Overwriting existing
embedding_metadata.jsonandschema.jsonfiles in attacker-targeted paths, potentially corrupting existing knowledge bases.
Fixes
The issue was addressed in PR #12337. The fix introduces the _validate_kb_path_containment() helper function, which uses Path.is_relative_to() instead of startswith() to enforce strict path boundaries and prevent prefix-ambiguity bugs. This helper is applied before any filesystem operations. Regression tests were added to verify that traversal payloads return a 403 Forbidden.
Acknowledgements
Thanks to the security researchers who responsibly disclosed this vulnerability:
- @ddlxstudio
- @nekros1xx
Credited to nekros1xx, Cristhianzl, andifilhohub, AntonioABLima.
Questions
- Does CVE-2026-42867 allow arbitrary file read or code execution?
Not according to the advisory. It describes creating directories and writing or overwriting embedding_metadata.json and schema.json at attacker-chosen paths.
- Which Langflow version fixes it?
1.9.0. Versions up to and including 1.8.4 are affected.
- Does the attacker need an account?
The advisory text says authenticated attacker, but its CVSS vector lists no privileges required. Treat any instance that exposes the endpoint as at risk.
- Is it exploited in the wild?
The sources do not report exploitation, and the entry has no CISA KEV data.
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 Langflow vulnerabilities
All Langflow entriesCVE-2026-105697
Langflow: OS command injection (RCE) via arbitrary command in MCP stdio server configuration
critical9.9Oct 7, 2026CVE-2026-105698
Langflow : Cross-user flow access and vertex execution via deprecated /api/v1/build/{flow_id}/vertices endpoints
medium5.4Oct 7, 2026CVE-2026-105699
Langflow has Authenticated Cross-Project File Disclosure via Unscoped MCP Resource Handlers
high7.1Oct 7, 2026CVE-2026-105741
Langflow: IP Spoofing Bypass via `X-Forwarded-For` Allowing Remote Configuration Write
high7.1Oct 7, 2026CVE-2026-10561
Langflow: PythonREPLComponent executes unsandboxed Python code, enabling authenticated RCE and privilege escalation
critical9.9Oct 6, 2026GHSA-j8f7-x8jm-wmm4
Langflow: SSRF in URL-taking components (protection disabled by default / warn-only, not applied to RSS, SearXNG, Web Search, Home Assistant, Glean, Docling)
medium6.3Oct 6, 2026
