{"id":"CVE-2026-33497","aliases":["CVE-2026-33497","GHSA-ph9w-r52h-28p7","PYSEC-2026-81"],"related":[],"kind":"vulnerability","state":"published","title":"Langflow: /profile_pictures/{folder_name}/{file_name} endpoint file reading","summary":"Langflow is a tool for building and deploying AI-powered agents and workflows. Prior to version 1.7.1, in the download_profile_picture function of the /profile_pictures/{folder_name}/{file_name} endpoint, the folder_name and file_name parameters are not strictly filtered, which allows the secret_key to be read across directories. Version 1.7.1 contains a patch.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Langflow is a tool for building and deploying AI-powered agents and workflows. Prior to version 1.7.1, in the download_profile_picture function of the /profile_pictures/{folder_name}/{file_name} endpoint, the folder_name and file_name parameters are not strictly filtered, which allows the secret_key to be read across directories. Version 1.7.1 contains a patch.","source":"cvelist"},{"lang":"en","text":"## Vulnerability\n\n### Path Traversal in `GET /api/v1/files/profile_pictures/{folder_name}/{file_name}`\n\nThe `download_profile_picture` function in `src/backend/base/langflow/api/v1/files.py` constructed file paths by directly concatenating the user-supplied `folder_name` and `file_name` path parameters without sanitization or boundary validation. The resulting path was passed to the filesystem without verifying it remained within the intended directory.\n\nAn unauthenticated attacker could supply traversal sequences (e.g. `../secret_key`) to navigate outside the profile pictures directory and read arbitrary files on the server filesystem.\n\nThis exposed the server to:\n\n- **Sensitive file disclosure** — any file readable by the application process could be retrieved\n- **Secret key exfiltration** — the application's `secret_key` file, used as JWT signing material, could be read directly via `../secret_key`\n- **Authentication bypass** — with the `secret_key` in hand, an attacker can forge valid JWT tokens and authenticate as any user, including administrators\n\n---\n\n## Proof of Concept\n\n```bash\ncurl --path-as-is 'http://<host>:7860/api/v1/files/profile_pictures/../secret_key'\n```\n\nA successful response returns the raw secret key value used to sign all JWT authentication tokens in the instance.\n\n---\n\n## Fix\n\nThe fix was applied in `src/backend/base/langflow/api/v1/files.py` (PR #12263).\n\nTwo layers of defense were introduced:\n\n**1. Typed path validation** — the `folder_name` and `file_name` parameters were changed from plain `str` to `ValidatedFolderName` and `ValidatedFileName` annotated types that reject traversal characters at the FastAPI input layer.\n\n**2. Path containment check** — `Path.name` is used to strip any directory component from the inputs before path construction, and `Path.is_relative_to()` verifies the resolved path remains within the allowed base directory. This replaces the previous `startswith()` check, which was susceptible to prefix-ambiguity bugs.\n\n```diff\n @router.get(\"/profile_pictures/{folder_name}/{file_name}\")\n async def download_profile_picture(\n-    folder_name: str,\n-    file_name: str,\n+    folder_name: ValidatedFolderName,\n+    file_name: ValidatedFileName,\n     settings_service: Annotated[SettingsService, Depends(get_settings_service)],\n ):\n```\n\n```diff\n-        file_path = (config_path / \"profile_pictures\" / folder_name / file_name).resolve()\n+        safe_folder = Path(folder_name).name\n+        safe_file = Path(file_name).name\n+        file_path = (config_path / \"profile_pictures\" / safe_folder / safe_file).resolve()\n\n         allowed_base = (config_path / \"profile_pictures\").resolve()\n-        if not str(file_path).startswith(str(allowed_base)):\n-            raise HTTPException(status_code=404, detail=\"Profile picture not found\")\n+        if not file_path.is_relative_to(allowed_base):\n+            raise HTTPException(status_code=404, detail=\"Profile picture not found\")\n```\n\n---\n\n## Workarounds\n\nIf you cannot upgrade immediately, restrict network access to the `/api/v1/files/profile_pictures/` endpoint at the reverse-proxy or firewall level. Rotating the `secret_key` is strongly recommended if exposure cannot be ruled out.\n\n---\n\n## Acknowledgements\n\nWe thank the security researcher who responsibly disclosed this vulnerability.\n\n- [r00tuser111](https://github.com/r00tuser111)","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 versión 1.7.1, en la función download_profile_picture del endpoint /profile_pictures/{folder_name}/{file_name}, los parámetros folder_name y file_name no se filtran estrictamente, lo que permite leer la secret_key a través de directorios. La versión 1.7.1 contiene un parche.","source":"nvd"}],"published":"2026-03-20T20:56:14.000Z","modified":"2026-06-17T10:37:36.150Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 1.7.1","status":"affected"}],"vendor":"langflow-ai","product":"langflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.7.1"}],"ecosystem":"PyPI","package":"langflow","purl":"pkg:pypi/langflow","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.7.1"}],"vendor":"langflow","product":"langflow","cpe":"cpe:2.3:a:langflow:langflow:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.7.1"}],"ecosystem":"PyPI","package":"langflow","purl":"pkg:pypi/langflow","source":"pysec"}],"references":[{"url":"https://github.com/langflow-ai/langflow/security/advisories/GHSA-ph9w-r52h-28p7","tags":["evidence","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33497","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/langflow-ai/langflow","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/langflow/PYSEC-2026-81.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-03-24T17:45:18.228Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-33497","url":"https://www.cve.org/CVERecord?id=CVE-2026-33497","licence":"CVE Terms of Use","modified":"2026-03-24T17:45:26.314Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-ph9w-r52h-28p7","url":"https://github.com/advisories/GHSA-ph9w-r52h-28p7","licence":"CC-BY-4.0","modified":"2026-06-06T01:00:08.133Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-33497","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33497","licence":"Public domain","modified":"2026-06-17T10:37:36.150Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-81","url":"https://osv.dev/vulnerability/PYSEC-2026-81","licence":"CC-BY-4.0","modified":"2026-05-20T09:19:04.629Z"}],"updatedAt":"2026-11-25T22:59:16.564Z","epss":{"score":0.21268,"percentile":0.97652,"date":"2026-12-01T12:00:22.000Z"}}