/

CVE-2026-58166

Severity:

CRITICAL RISK

(9.1)

Path Traversal (CWE-22) in ChatDev File Upload API

CVE-2026-58166

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write and Deletion on Server Filesystem

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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_file function 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 filename or 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.

Sources

SourceLink
github.comgithub.com/OpenBMB/ChatDev/commit/4fd4da603801766b14ad8788649cfc1ad21f99a6
github.comgithub.com/OpenBMB/ChatDev/issues/638
github.comgithub.com/OpenBMB/ChatDev/pull/641
vulncheck.comvulncheck.com/advisories/openbmb-chatdev-unauthenticated-path-traversal-in-upload-handler-allows-arbitrary-file-write-and-delete

Frequently asked

questions

It can, depending on deployment. If the application can write into executable or configuration directories, attackers may escalate from arbitrary file write to code execution or service hijacking, but this depends on the specific server setup and permissions.

Only network access to the exposed file upload endpoint is needed; the vulnerability is reachable by unauthenticated remote users as long as they can send HTTP POST requests to the uploads session API.

Implement strict path handling: normalize and validate all derived paths, ensure they remain inside a dedicated upload root, strip or reject any traversal components, and avoid using raw user-provided filenames directly in filesystem operations.

Establish secure file handling abstractions that enforce directory confinement, integrate static analysis or linters to detect direct path concatenation from user input, and include path traversal checks in security-focused code reviews for any feature involving file uploads or downloads.

Find out what's already
exploitable in your codebase.