Summary
OpenBMB ChatDev's file upload endpoint is vulnerable to path traversal, allowing crafted filenames with traversal sequences or absolute paths to control where files are written or deleted on the server.
When an unauthenticated remote attacker sends a malicious multipart filename, the server constructs the destination path without sanitization, making arbitrary filesystem modification possible wherever the process has write access.
Affected context
This vulnerability occurs in deployments of OpenBMB ChatDev (through 2.2.0) that expose the file upload API over the network.
The affected code path is the save_upload_file logic used by the POST /uploads/session endpoint, where user-supplied multipart filenames are directly combined with server-side directories.
Systems running with broad filesystem permissions or on shared hosts are at higher risk, especially when configuration, application, or system files reside in reachable paths.
Exploit preconditions
- Attack surface: HTTP POST requests to the ChatDev uploads session endpoint.
- Required access: None; the endpoint is reachable by unauthenticated remote clients.
- Trigger point: Uploading a file with a multipart filename containing
../traversal sequences or absolute paths. - Why exploitation is possible: The server-side
save_upload_filefunction constructs filesystem paths directly from the supplied filename without normalizing, validating, or restricting the resulting path to an intended upload directory.
Why this happens
The core issue is improper validation and sanitization of user-controlled path input before it is used in filesystem operations.
ChatDev's upload handling constructs destination paths by concatenating a base directory with the client-provided filename, failing to remove traversal tokens, reject absolute paths, or enforce that the resulting path stays within a designated upload root.
This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where unchecked path components allow access to files outside the intended directory scope.
Potential impact
- Attackers may write arbitrary files to locations accessible by the ChatDev process.
- Attackers could delete or overwrite existing application, configuration, or data files.
- File writes could enable web shell placement or other forms of code execution, depending on server configuration.
- Application integrity and availability can be affected through log tampering or removal of essential files.
- Neighboring services on the same host may be indirectly impacted if shared directories are modified.
General mitigation guidance
Mitigation should focus on hardening how paths are derived from user input and constraining all file operations to well-defined storage areas.
Common defensive patterns include:
- Treating filenames as data, not paths, and stripping directory separators and traversal sequences before use.
- Resolving the combined path and enforcing that it remains within a dedicated upload root using canonicalization checks.
- Rejecting absolute paths and any filename that, after normalization, escapes the expected directory.
- Applying least-privilege to the ChatDev process so it can only write within a restricted directory tree.
- Separating upload storage from application and system directories to reduce impact if checks fail.
How teams detect issues like this
Effective detection typically combines code-level and operational signals:
- Static analysis rules that flag direct concatenation of user input into filesystem paths or calls to file APIs without prior normalization and validation.
- Code review checklists that highlight any use of
filenameor path-like parameters in open/write/delete operations. - Runtime monitoring and logging of unexpected write or delete activity outside the intended upload directory.
- Security policy enforcement in CI/CD to require centralized helpers for safe path handling instead of ad hoc concatenation.

