
Public PoC for CVE-2025-25257: FortiWeb pre-auth SQLi to RCE
Disclaimer: This proof-of-concept (PoC) is provided for authorized security testing and research purposes only. Unauthorized use against systems you do not own or have explicit permission to test is illegal. Users are responsible for complying with all applicable laws and regulations.
CVE-2025-25257 is a critical vulnerability in Fortinet FortiWeb, a web application firewall, within its Fabric Connector component. It allows attackers to execute arbitrary system commands without authentication, posing a severe risk of full system compromise.
| Version Range | Status |
|---|---|
| 7.6.0 – 7.6.3 | Vulnerable |
| 7.4.0 – 7.4.7 | Vulnerable |
| 7.2.0 – 7.2.10 | Vulnerable |
| 7.0.10 and earlier | Vulnerable |
This vulnerability stems from insecure handling of the Authorization: Bearer <token> HTTP header in the get_fabric_user_by_token() function. Due to insufficient input sanitization, attackers can inject malicious SQL commands (SQL Injection, CWE-89).
Impact:
SELECT ... INTO OUTFILE, attackers can write malicious files (e.g., webshells or Python scripts) to the server, enabling full system control.📥 Download Latest Release (v1.0.0)
Files included:
CVE-2025-25257.py - Python exploit scriptREADME.md - Complete documentationexploit_workflow.svg - Attack workflow diagramThe exploit follows these steps, as illustrated in the Mermaid diagram below (rendered natively on GitHub) and the static image exploit_workflow.svg:
graph TD
A[Attacker] --> B[Target Endpoint]
B --> C[SQL Injection]
C --> D[Webshell Creation]
D --> E[Command Execution]
E --> F[System Compromise]
/api/fabric/device/status endpoint.webshell.php) to the server.User-Agent header to the webshell, executing arbitrary system commands.References:
This tool is for authorized security testing and research purposes only. Ensure you have explicit permission to test the target system.
requests, argparsepip install requestspython3 cve_2025_25257.py -t https://target-ip
| Option | Description |
|---|---|
-t | Target URL (e.g., https://target-ip) |
-T | File containing multiple target URLs |
Post-Exploitation: After successful exploitation, the script outputs the webshell URL (e.g., https://target-ip/webshell.php). Commands can be sent to the webshell via the User-Agent header using tools like curl or a browser.
python3 cve_2025_25257.py -t https://192.168.1.100 --proxy http://127.0.0.1:8080
Output: If successful, the script will display:
[+] Webshell deployed at: https://192.168.1.100/webshell.php
[+] Send commands via User-Agent header, e.g., `curl -A "whoami" https://192.168.1.100/webshell.php`
CVE-2025-25257 is a severe, easily exploitable vulnerability in FortiWeb, enabling unauthenticated attackers to achieve full system control. Immediate patching is critical, and organizations should monitor for signs of exploitation.
Visual Aids: The Mermaid diagram above renders natively on GitHub. The static exploit_workflow.svg (included in the repository) provides the same workflow for offline viewing or presentations, with scalable vector graphics for high-quality rendering.
| Action | Details |
|---|
| Patch Immediately | Upgrade to a fixed version: 7.6.4+, 7.4.8+, 7.2.11+, or 7.0.11+ |
| Temporary Mitigation | Restrict or disable HTTP/HTTPS admin interface access |
| Detection | - Monitor Authorization headers for SQL syntax- Use IDS/IPS to detect SQL injection attempts on /api/fabric/device/status- Check for unexpected files (e.g., .php, .py, or CGI scripts) |
--proxyRoute traffic through a proxy (e.g., http://127.0.0.1:8080) |