NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Langflow

CVE-2026-33497: langflow: /profile_pictures/{folder_name}/{file_name} endpoint file reading

highCVSS 4.0 8.7GHSA-ph9w-r52h-28p7

Langflow before 1.7.1 has an unauthenticated path traversal in `GET /api/v1/files/profile_pictures/{folder_name}/{file_name}`. An attacker can read any file the Langflow process can read, including the `secret_key` that signs JWTs, and then forge tokens for any user, administrators included. Upgrade to Langflow 1.7.1.

Published Mar 20, 2026 · Updated Jun 6, 2026 · Analysis Oct 31, 2026

What an attacker can do

The download_profile_picture function in src/backend/base/langflow/api/v1/files.py built a path by joining the folder_name and file_name URL parameters, with no sanitization and no check that the result stayed inside the profile pictures directory. The old containment test used startswith(), which has prefix-ambiguity problems (CWE-22).

No login is needed. The reported proof of concept is one request:

curl --path-as-is 'http://<host>:7860/api/v1/files/profile_pictures/../secret_key'

The response is the raw secret_key, which Langflow uses to sign every JWT. With it an attacker forges valid tokens and acts as any user, so file read becomes full authentication bypass. From an admin session they can reach everything Langflow manages, including stored API keys and flows. Other readable files, such as .env files and configuration, are exposed as well.

Who is affected

The pip package langflow below 1.7.1. Any instance whose port, 7860 by default, is reachable by an attacker is exposed. Check with:

pip show langflow

langflow

Ecosystem
PyPI
Affected
< 1.7.1
Fixed in
1.7.1
Check
pip show langflow

How to fix it

Upgrade to langflow 1.7.1 or later:

pip install --upgrade langflow

The fix (PR 12263) types the parameters as ValidatedFolderName and ValidatedFileName, strips directory parts with Path.name, and checks containment with Path.is_relative_to(). If you cannot upgrade, block network access to /api/v1/files/profile_pictures/ at the reverse proxy or firewall. The advisory strongly recommends rotating the secret_key if exposure cannot be ruled out. Rotating invalidates existing sessions.

How to tell if you were hit

Search web server and proxy logs for requests to /api/v1/files/profile_pictures/ whose path contains .., %2e%2e or other traversal forms, and for any that return HTTP 200 with a non-image body. If secret_key may have been read, look for logins or API activity from unfamiliar addresses and for admin sessions you did not start, then rotate the key and all stored credentials.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Vulnerability

Path Traversal in GET /api/v1/files/profile_pictures/{folder_name}/{file_name}

The 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.

An 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.

This exposed the server to:

  • Sensitive file disclosure — any file readable by the application process could be retrieved
  • Secret key exfiltration — the application's secret_key file, used as JWT signing material, could be read directly via ../secret_key
  • Authentication bypass — with the secret_key in hand, an attacker can forge valid JWT tokens and authenticate as any user, including administrators

---

Proof of Concept

curl --path-as-is 'http://<host>:7860/api/v1/files/profile_pictures/../secret_key'

A successful response returns the raw secret key value used to sign all JWT authentication tokens in the instance.

---

Fix

The fix was applied in src/backend/base/langflow/api/v1/files.py (PR #12263).

Two layers of defense were introduced:

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.

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.

 @router.get("/profile_pictures/{folder_name}/{file_name}")
 async def download_profile_picture(
-    folder_name: str,
-    file_name: str,
+    folder_name: ValidatedFolderName,
+    file_name: ValidatedFileName,
     settings_service: Annotated[SettingsService, Depends(get_settings_service)],
 ):
-        file_path = (config_path / "profile_pictures" / folder_name / file_name).resolve()
+        safe_folder = Path(folder_name).name
+        safe_file = Path(file_name).name
+        file_path = (config_path / "profile_pictures" / safe_folder / safe_file).resolve()

         allowed_base = (config_path / "profile_pictures").resolve()
-        if not str(file_path).startswith(str(allowed_base)):
-            raise HTTPException(status_code=404, detail="Profile picture not found")
+        if not file_path.is_relative_to(allowed_base):
+            raise HTTPException(status_code=404, detail="Profile picture not found")

---

Workarounds

If 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.

---

Acknowledgements

We thank the security researcher who responsibly disclosed this vulnerability.

Credited to r00tuser111, erichare, AntonioABLima.

Questions

Does the attacker need to be logged in to exploit CVE-2026-33497?

No. The endpoint needs no authentication, and the CVSS 4.0 vector sets privileges required to none.

Why is reading secret_key so serious?

It is the JWT signing material. With it, an attacker can forge valid tokens and authenticate as any user, including administrators.

Is there a workaround?

Yes. Restrict network access to /api/v1/files/profile_pictures/ at the reverse proxy or firewall, and rotate the secret_key if you cannot rule out exposure.

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 entries