Summary
A directory traversal issue in Langflow's profile picture download endpoint allows attackers to manipulate folder and file parameters to read files outside the intended image directory.
When exploited, this flaw can expose sensitive application data, including the secret_key, leading to further compromise of the Langflow instance and its users.
Affected context
This vulnerability occurs in Langflow deployments exposing the /profile_pictures/{folder_name}/{file_name} endpoint.
It manifests when user-supplied folder_name and file_name values are used to access files on disk without strict validation or normalization to a fixed base directory.
Any environment where this endpoint is reachable by untrusted users and the application's secret_key or other sensitive files are stored in accessible server-side paths is at risk.
Exploit preconditions
- Attack surface: HTTP requests to the
/profile_pictures/{folder_name}/{file_name}endpoint. - Required access: Network access to the Langflow web interface/API (typically unauthenticated or low-privilege user, depending on deployment).
- Trigger point: Supplying crafted
folder_nameand/orfile_namevalues containing path traversal sequences (e.g., parent directory references) or absolute/alternative paths. - Why exploitation is possible: The server-side implementation combines user-controlled path segments into file system paths without enforcing a strict base directory or adequately sanitizing disallowed characters and traversal patterns, allowing access to files outside the intended profile picture directory.
Why this happens
The core issue is improper restriction of file system paths constructed from user input, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
The download_profile_picture function trusts folder_name and file_name parameters and uses them to locate files on disk without robust checks such as canonicalization, enforcement of a fixed root directory, or rejection of traversal sequences.
As a result, attackers can escape the designated profile pictures directory and reach arbitrary readable files, including configuration files containing the application's secret_key.
Potential impact
- Exposure of the application's secret_key, which can be used to forge tokens, sessions, or other signed data.
- Disclosure of configuration files, logs, or other sensitive application data.
- Increased risk of account takeover or privilege escalation through tampering with signed objects.
- Facilitation of further attacks by revealing environment details, file paths, and credentials.
General mitigation guidance
Effective mitigation focuses on constraining file access to a well-defined directory and treating all path components as untrusted:
- Resolve requested paths against a fixed, application-controlled base directory and reject any request that resolves outside this directory.
- Normalize and canonicalize paths before use, and explicitly deny traversal indicators such as
.., leading slashes, backslashes, and null bytes. - Avoid passing raw user input into file system APIs; instead map user-visible identifiers to server-side file paths via a lookup table or database.
- Store high-value secrets (such as secret keys) outside web-accessible directories and segregated from user-controlled file trees.
- Apply defense-in-depth with least-privilege filesystem permissions so that the web process cannot read unnecessary sensitive files.
How teams detect issues like this
Organizations can detect and monitor for this class of issue using:
- Static analysis rules that flag uses of user-controlled path segments in file operations without normalization or base-directory checks.
- Code review checklists that call out any endpoint serving files from disk and require explicit path validation and restriction.
- Runtime logging and monitoring for suspicious access patterns, such as requests containing
../, encoded traversal sequences, or unexpected file extensions. - Security testing (including automated DAST and manual penetration testing) focused on all file download or media-serving endpoints.

