IPBUF安全漏洞报告
English
CVE-2025-12488 CVSS 9.8 严重

CVE-2025-12488: oobabooga text-generation-webui trust_remote_code 远程代码执行漏洞

披露日期: 2025-11-06

漏洞信息

漏洞编号
CVE-2025-12488
漏洞类型
远程代码执行(RCE)
CVSS评分
9.8 严重
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
oobabooga text-generation-webui

相关标签

远程代码执行RCE严重CVE-2025-12488oobaboogatext-generation-webuitrust_remote_codeZDI-CAN-26680PythonAI安全

漏洞概述

CVE-2025-12488是oobabooga text-generation-webui中的一个严重远程代码执行漏洞,CVSS评分高达9.8分(严重级别)。该漏洞源于text-generation-webui在处理trust_remote_code参数时缺乏适当的输入验证机制。攻击者可以通过构造恶意的trust_remote_code参数值,在受影响系统的服务账户上下文中执行任意代码。由于该漏洞无需认证即可被利用,因此对暴露在网络中的text-generation-webui实例构成极高威胁。攻击者可以利用此漏洞完全控制服务器,执行系统命令、安装恶意软件或窃取敏感数据。此漏洞由Trend Micro Zero Day Initiative发现并披露,编号为ZDI-CAN-26680。

技术细节

该漏洞的核心问题在于text-generation-webui的load端点对trust_remote_code参数的处理。当用户加载模型时,系统会使用trust_remote_code参数来决定是否信任远程模型代码。然而,该参数在传递给模型加载函数之前缺乏充分的验证和清理。攻击者可以通过精心构造的请求,将恶意的代码路径或命令注入到模型加载过程中。具体来说,攻击者可以指定一个包含恶意代码的模型路径或配置,当系统尝试加载该模型时,会执行攻击者植入的任意代码。这种攻击方式利用了Python的动态导入机制和transformers库的安全特性,通过绕过trust_remote_code的安全限制实现代码执行。修复方案已在GitHub提交b5a6904中实现,主要添加了对trust_remote_code参数的严格验证逻辑。

攻击链分析

STEP 1
步骤1
攻击者识别暴露在网络中的text-generation-webui实例,通常通过Shodan等搜索引擎发现
STEP 2
步骤2
攻击者访问/api/v1/load端点,该端点用于加载AI模型
STEP 3
步骤3
攻击者构造包含恶意代码路径的请求,将trust_remote_code参数设置为True
STEP 4
步骤4
系统在加载模型时,由于缺少对trust_remote_code参数的验证,直接执行了攻击者指定的恶意代码
STEP 5
步骤5
攻击者成功在服务器的服务账户上下文中执行任意系统命令,获得服务器完全控制权

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # CVE-2025-12488 PoC - oobabooga text-generation-webui RCE via trust_remote_code # Target: text-generation-webui server with exposed /api/v1/load endpoint target_url = "http://target-server:5000" # Malicious payload to execute arbitrary code via trust_remote_code parameter # The attacker can specify a model path that contains malicious code payload = { "model_name": "../../malicious_model", # Path traversal + malicious model "trust_remote_code": True # This enables execution of arbitrary code } try: response = requests.post( f"{target_url}/api/v1/load", json=payload, timeout=10 ) print(f"Status: {response.status_code}") print(f"Response: {response.text}") except requests.exceptions.RequestException as e: print(f"Request failed: {e}") # Alternative: Direct command execution via model loading # Attacker can craft a model config with malicious code that auto-executes

影响范围

oobabooga text-generation-webui < b5a6904c4ac4049823396090360b6f566f4e4603

防御指南

临时缓解措施
在官方修复版本发布之前,建议采取以下临时缓解措施:1) 不要将text-generation-webui直接暴露在互联网或不可信的网络中;2) 使用网络访问控制列表(ACL)限制只有授权IP可以访问服务;3) 监视和记录所有对/api/v1/load端点的请求;4) 考虑在反向代理层实现请求过滤,阻止包含可疑参数的请求;5) 如果业务允许,暂时禁用远程模型加载功能。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表