Summary
A critical directory traversal vulnerability in DB-GPT's Python file upload endpoint may allow a remote attacker to write files outside the intended workspace or storage boundary. The issue becomes risky when attacker-controlled path information reaches file-system operations without reliable canonicalization and boundary enforcement.
Affected context
The vulnerability occurs in the DB-GPT Python file upload API when uploaded files are stored using attacker-influenced path information. Deployments may be exposed when the endpoint is remotely reachable and the application does not consistently resolve paths and verify that the resulting location remains within the approved workspace or storage directory.
Exploit preconditions
- Attack surface: The remotely reachable Python file upload endpoint - Required access: Network access to the endpoint; authentication requirements
depend on deployment configuration
- Trigger point: Processing and storing a file upload - Why exploitation is possible: User-controlled path components can influence
the destination path, allowing writes beyond the intended directory when
canonicalization and boundary checks are incomplete
Why this happens
The underlying bug is improper limitation of a pathname to a trusted directory. When an application combines attacker-controlled path components with a storage directory without canonicalizing the result and enforcing a directory boundary, traversal sequences or equivalent path representations may escape the intended location. This behavior maps to CWE-22, Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Potential impact
- An attacker may overwrite application or configuration files
- Sensitive files could be damaged or replaced
- The application may experience denial of service
- File writes could enable code execution if a writable target is later loaded or executed
- Compromise could extend to connected services or data depending on process privileges
General mitigation guidance
Mitigation generally centers on treating upload names and paths as untrusted data and constraining all writes to an explicitly approved directory. Common defensive patterns include resolving paths before use, rejecting any resolved path outside the configured boundary, generating server-side filenames, and avoiding user-controlled directory selection. Secure-by-default storage should use isolated, non-executable locations with restrictive permissions. Upload handling can also reduce trust through allowlisted file types, size limits, content validation, and least-privilege service accounts.
How teams detect issues like this
Detection approaches include static analysis for file-system APIs that combine upload input with paths, and code review checks for missing canonicalization or post-resolution boundary validation. Runtime monitoring can flag uploads whose normalized destinations fall outside approved directories, unexpected writes to application paths, and unusual file replacement activity. Policy enforcement can require isolated upload storage, server-generated filenames, and security tests for path-boundary violations. Automated review tools may help identify risky path construction patterns.

