Summary
Flowise before version 3.0.6 contains an arbitrary file read vulnerability in file download-related API endpoints, where the chatId parameter is used without adequate validation.
By exploiting a path traversal in the storage lookup logic, an unauthenticated attacker can read sensitive files such as the internal SQLite database, exposing stored application data whenever the application runs with default paths and permissions.
Affected context
This vulnerability appears in Flowise deployments that expose the /api/v1/get-upload-file and /api/v1/openai-assistants-file/download endpoints and rely on the default file storage layout.
It is relevant when user-controlled identifiers, such as chatId, are accepted as part of the file selection mechanism and the application runs with sufficient privileges to access configuration and data files on disk.
Environments where the Flowise process user can read sensitive files like /root/.flowise/database.sqlite are particularly at risk, especially in single-tenant setups or default container images.
Exploit preconditions
- Attack surface: HTTP API endpoints
/api/v1/get-upload-fileand/api/v1/openai-assistants-file/download. - Required access: Network access to the Flowise service; no authentication is required in affected configurations.
- Trigger point: A request that supplies a crafted
chatIdvalue causing path traversal duringstreamStorageFile()lookups. - Why exploitation is possible: The
chatIdparameter is not validated or normalized, and a fallback path-lookup that omitsorgIdis evaluated after the storage-directory containment check, enabling traversal beyond the intended storage directory and access to arbitrary readable files.
Why this happens
The underlying issue is improper handling of file paths derived from user-controlled input, mapping to CWE-73: External Control of File Name or Path.
Instead of enforcing strict validation and containment, the code passes the chatId value into streamStorageFile() and then applies a fallback lookup path that does not preserve the original directory constraints.
This insecure pattern allows path segments such as directory traversals to bypass the storage-directory check, leading the file-reading logic to operate on arbitrary locations on the filesystem that the process can reach.
Potential impact
- Unauthenticated attackers may read the Flowise SQLite database, exposing all stored application content.
- Attackers could access configuration files and secrets stored under the application's runtime directories.
- Sensitive logs or credentials cached on disk can be disclosed, enabling broader compromise or lateral movement.
- Data privacy violations can occur if user conversations, prompts, or other stored artifacts are accessible through the same filesystem.
General mitigation guidance
Effective mitigation focuses on eliminating externally controlled file path usage and enforcing strict containment for file access operations.
Common defensive patterns include:
- Validating and normalizing identifiers like
chatIdso they cannot contain path separators or traversal sequences. - Resolving requested files against a canonical base directory and rejecting any paths that attempt to escape this directory.
- Using opaque, server-generated file IDs rather than direct filenames or paths in API parameters.
- Running the application under a least-privilege account with limited filesystem access and segregating sensitive data from web-exposed storage paths.
- Applying defense-in-depth controls such as application-level authorization checks on file access requests.
How teams detect issues like this
Organizations can detect similar vulnerabilities by:
- Applying static analysis rules that flag concatenation of user-controlled input into filesystem APIs (e.g., open, readStream, fs operations).
- Reviewing code for fallback path logic that bypasses earlier security checks or directory containment validations.
- Implementing security-focused code review checklists that call out any use of request parameters in file path construction.
- Using automated scanning tools that simulate path traversal attacks against file-related endpoints and alert on unexpected file disclosure.

