{"id":"CVE-2026-42867","aliases":["CVE-2026-42867","GHSA-79ph-745m-6wxq","PYSEC-2026-2566"],"related":[],"kind":"vulnerability","state":"published","title":"Langflow: Path Traversal in Knowledge Bases API via Creation Endpoint","summary":"Langflow is a tool for building and deploying AI-powered agents and workflows. Prior to 1.9.0, 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. This vulnerability is fixed in 1.9.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Langflow is a tool for building and deploying AI-powered agents and workflows. Prior to 1.9.0, 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. This vulnerability is fixed in 1.9.0.","source":"cvelist"},{"lang":"en","text":"## Summary\nLangflow 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.\n\n## Details\nThe vulnerability exists in the `create_knowledge_base` function within `src/backend/base/langflow/api/v1/knowledge_bases.py`. \n\nThis 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.\n\n## PoC (Proof of Concept)\nFor the **Create** endpoint, an attacker can supply traversal sequences or absolute paths in the `name` field:\n\n`../victim_user/evil_kb`\nor\n`/tmp/pwned`\n\nThis 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.\n\n## Impact\nAny Langflow instance exposing this endpoint to authenticated users is vulnerable. This exposes the server to:\n* **Cross-user data compromise:** Creation of directories and files within another tenant's knowledge base space.\n* **Arbitrary filesystem manipulation:** Directory creation at any path on the server where the application has write permissions (e.g., `/app/data`).\n* **Data overwrite:** Overwriting existing `embedding_metadata.json` and `schema.json` files in attacker-targeted paths, potentially corrupting existing knowledge bases.\n\n## Fixes\nThe 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`.\n\n## Acknowledgements\nThanks to the security researchers who responsibly disclosed this vulnerability:\n* @ddlxstudio\n* @nekros1xx","format":"markdown","source":"ghsa"},{"lang":"es","text":"Langflow es una herramienta para construir y desplegar agentes y flujos de trabajo impulsados por IA. Antes de la 1.9.0, Langflow es vulnerable a salto de ruta en la API de Bases de Conocimiento (POST /api/v1/knowledge_bases). Esto ocurre porque los nombres de bases de conocimiento proporcionados por el usuario se utilizan directamente para crear rutas de archivo sin una sanitización o comprobaciones de contención adecuadas. Un atacante autenticado puede explotar esta falla para crear directorios y escribir archivos en cualquier lugar del sistema de archivos del servidor. Esta vulnerabilidad está corregida en la 1.9.0.","source":"nvd"}],"published":"2026-06-16T17:35:09.000Z","modified":"2026-10-26T11:10:00.157Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","score":6.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 1.9.0","status":"affected"}],"vendor":"langflow-ai","product":"langflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.9.0"}],"ecosystem":"PyPI","package":"langflow","purl":"pkg:pypi/langflow","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.9.0"}],"vendor":"langflow","product":"langflow","cpe":"cpe:2.3:a:langflow:langflow:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.9.0"}],"ecosystem":"PyPI","package":"langflow","purl":"pkg:pypi/langflow","source":"pysec"}],"references":[{"url":"https://github.com/langflow-ai/langflow/security/advisories/GHSA-79ph-745m-6wxq","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/langflow-ai/langflow/pull/12337","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42867","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/advisories/GHSA-79ph-745m-6wxq","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/langflow-ai/langflow","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/langflow/PYSEC-2026-2566.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://pypi.org/project/langflow","tags":["package","web"],"sources":["ghsa","pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-06-23T17:01:29.364Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42867","url":"https://www.cve.org/CVERecord?id=CVE-2026-42867","licence":"CVE Terms of Use","modified":"2026-06-23T17:02:43.824Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-79ph-745m-6wxq","url":"https://github.com/advisories/GHSA-79ph-745m-6wxq","licence":"CC-BY-4.0","modified":"2026-07-20T13:45:32.268Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42867","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42867","licence":"Public domain","modified":"2026-10-26T11:10:00.157Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2566","url":"https://osv.dev/vulnerability/PYSEC-2026-2566","licence":"CC-BY-4.0","modified":"2026-07-13T16:32:01.896Z"}],"updatedAt":"2026-11-25T22:59:25.474Z","epss":{"score":0.00348,"percentile":0.30415,"date":"2026-12-01T12:00:22.000Z"}}