Summary
Flowise exposes an unauthenticated attachment upload endpoint that relies solely on client-supplied MIME types to validate files.
By spoofing the Content-Type header, an attacker can upload arbitrary files to backend storage, which can later be abused for Stored XSS, malicious file hosting, or Remote Code Execution when combined with other features.
Affected context
This vulnerability occurs in Flowise deployments where the /api/v1/attachments/:chatflowId/:chatId endpoint is reachable and treated as a trusted file ingestion path.
It is most relevant when:
- The endpoint remains in a whitelist or is otherwise accessible without authentication.
- File uploads are validated only via MIME type values supplied by the client.
- Uploaded files are stored in persistent backends such as S3, GCS, or local disk and may later be served back to users, used in static hosting, or processed by other backend components.
The risk increases when downstream features render or execute uploaded content in a browser or server context.
Exploit preconditions
- Attack surface: Public HTTP(S) exposure of the
/api/v1/attachments/:chatflowId/:chatIdendpoint. - Required access: Network-level access to the Flowise API; no authentication needed due to whitelisting.
- Trigger point: Sending a crafted multipart/form-data upload request that:
- Targets a valid
:chatflowIdand:chatId. - Sets the
Content-Type(file.mimetype) to an allowed value (e.g.,application/pdf) while supplying arbitrary file content and extension. - Why exploitation is possible:
- The server's upload validation trusts the client-provided MIME type without verifying:
- File magic bytes (true content type), or
- File name/extension (
file.originalname). - Uploaded files are persisted via
addArrayFilesToStorageto storage backends (S3, GCS, or disk), where they can be later accessed or integrated with other features (e.g., static hosting, retrieval views) that may render or execute them.
Why this happens
At its core, this is an unrestricted file upload issue, mapping to CWE-434, where uploaded content is insufficiently constrained and validated.
The upload implementation:
- Treats client-controlled metadata (
file.mimetype) as authoritative, rather than deriving the content type from file signatures or strictly enforced file extensions. - Applies logical checks based only on the declared MIME type list in
chatbotConfig.fullFileUpload.allowedUploadFileTypes. - Does not enforce authentication on a sensitive file upload surface due to the endpoint being listed in
WHITELIST_URLS.
This combination of implicit trust in client metadata and broad, unauthenticated access to persistent file storage creates a generic "arbitrary file upload" primitive.
When such files are later rendered in a browser context, served as static assets, or processed by backend logic, this primitive can be transformed into Stored XSS, malicious file hosting, or even Remote Code Execution.
Potential impact
- Upload and long-term storage of arbitrary files (scripts, binaries, malware) on backend storage (S3, GCS, local disk).
- Stored Cross-Site Scripting (XSS) if uploaded files are later served with active content types (e.g., HTML, JS) and rendered in user browsers.
- Use of the application infrastructure as a malicious file hosting platform, aiding phishing, malware distribution, or drive-by attacks.
- Remote Code Execution (RCE) if other application features or external tools process uploaded files in ways that lead to code execution (e.g., unsafe parsers or converters).
- Abuse of storage resources and potential cost amplification, including bandwidth and storage overuse.
- Reputational damage if the Flowise deployment is used as a distribution point for malicious content.
General mitigation guidance
Effective mitigation focuses on tightening both access control and file validation for upload endpoints, and on minimizing the trust granted to uploaded content.
Typical defensive patterns include:
- Enforce authentication and authorization on all file upload endpoints, especially those persisting data to shared or public storage.
- Validate files based on server-side checks, such as:
- Inspecting magic bytes or using robust content-sniffing libraries to confirm true file type.
- Enforcing a whitelist of safe extensions and verifying the filename format.
- Restrict allowable file types to the minimal set necessary for the product's core functionality (e.g., limited document types instead of generic binary uploads).
- Store uploaded files in segregated locations with:
- Non-executable storage configurations.
- Distinct domains or subdomains for serving user content, with strict Content-Type and Content-Disposition headers.
- Apply strong output handling policies when serving files:
- Avoid inline rendering of potentially hazardous types.
- Prefer forced download for untrusted file types.
- Use least privilege for storage and processing components, ensuring that services interacting with uploaded files have constrained permissions and no unnecessary execution capabilities.
- Introduce centralized upload validation middleware, so new upload surfaces automatically inherit hardened validation and access control policies.
How teams detect issues like this
Detection and assurance can be improved through a mix of code-level, configuration-level, and runtime controls:
- Static analysis and code scanning:
- Search for upload handlers that:
- Read
file.mimetypeor similar client-controlled metadata without server-side content verification. - Are exposed in lists like
WHITELIST_URLSor equivalent bypass lists. - Flag routes that accept file uploads but lack explicit authentication/authorization checks.
- Security-focused code review:
- Examine API route definitions for file upload endpoints and verify:
- Presence of authentication and permission checks.
- Enforcement of strict file-type and size constraints.
- Proper handling of storage paths and file name normalization.
- Review integration points (static hosting, file retrieval APIs, rendering components) for assumptions about the safety of stored files.
- Configuration audits:
- Inspect deployment configuration for public exposure of upload endpoints.
- Review storage bucket or filesystem policies ensuring user-uploaded content is treated as non-executable and isolated.
- Runtime and log-based monitoring:
- Monitor for unusual patterns in uploads, such as:
- High volume of uploads from unrecognized sources.
- Uploads whose names or patterns resemble scripts or executable files (e.g.,
.js,.html,.php,.sh). - Use WAF or API gateway rules to inspect multipart/form-data requests and enforce basic file upload policies (size, extension, MIME consistency).
- Automated security tests:
- Integrate DAST or custom security testing scripts into CI/CD to probe upload endpoints with mismatched MIME types, suspicious extensions, and potentially executable content.

