# CVE-2025-25257: FortiWeb pre-auth SQL injection to root code execution, exploited

An unauthenticated SQL injection in the FortiWeb GUI lets an attacker run code as root. Public exploits appeared on July 11, 2025, exploitation followed within days, and CISA added it to the KEV catalog.

- Vendor: Fortinet, FortiWeb GUI (Fabric Connector)
- Severity: CRITICAL (CVSS 3.1 9.6)
- Exploited (CISA KEV): yes, added 2025-07-18
- EPSS: 99.9% on 2026-11-23
- Public exploit: yes
- Patch available: yes
- Vendor advisory: FG-IR-25-151, https://fortiguard.fortinet.com/psirt/FG-IR-25-151
- Published: 2025-07-08; updated: 2026-10-12
- Page: https://patchtonight.com/cve/CVE-2025-25257/

## Affected and fixed versions

| Affected | Fixed in |
| --- | --- |
| FortiWeb 7.6.0 to 7.6.3 | 7.6.4 or later |
| FortiWeb 7.4.0 to 7.4.7 | 7.4.8 or later |
| FortiWeb 7.2.0 to 7.2.10 | 7.2.11 or later |
| FortiWeb 7.0.0 to 7.0.10 | 7.0.11 or later |
| FortiWeb 6.4 | Not affected |

## What it is

FortiWeb is Fortinet's web application firewall. Its GUI has a **SQL injection** in the Fabric Connector code path that needs no login. An attacker sends crafted HTTP or HTTPS requests and runs SQL, and from there code, on the appliance. Help Net Security reports that this can reach **root**.

watchTowr traced the cause: the `Authorization: Bearer` token is placed into a SQL query without escaping. The requests reach it through `/api/fabric/device/status` and two `/api/v[0-9]/fabric/widget` endpoints. Per BleepingComputer, attackers abuse the injection to write a `.pth` file into Python's `site-packages`, then call the CGI script `/cgi-bin/ml-draw.py` to run it.

Fortinet fixed it on July 8, 2025. Three days later watchTowr and a second researcher published public exploits. The Shadowserver Foundation saw attempts from July 11 and counted **85 infected devices on July 14**, mostly with web shells. Fortinet confirmed exploitation on July 18, and CISA added the CVE to KEV the same day.

## Am I affected?

You're affected if you run FortiWeb **7.6.0 to 7.6.3, 7.4.0 to 7.4.7, 7.2.0 to 7.2.10 or 7.0.0 to 7.0.10**. FortiWeb 6.4 is not affected.

The bug is in the GUI, so the risk is highest when the **HTTP/HTTPS management interface is reachable from untrusted networks**. Shadowserver still saw 223 exposed FortiWeb management interfaces after the first wave. Check your firmware version on the appliance, and check which networks can reach its management interface.

## What to do

1. **Upgrade** to 7.6.4, 7.4.8, 7.2.11, 7.0.11 or later.
2. **If you can't patch tonight, disable the HTTP/HTTPS administrative interface,** Fortinet's only workaround. You lose GUI management until you re-enable it. Fortinet's advisory gives no steps, so use the FortiWeb documentation for your version.
3. **Take management interfaces off the internet** whatever else you do. Allow them only from an admin network or VPN.
4. **Assume compromise if an unpatched device was reachable since July 11, 2025.** Check it (below). If you find anything:
   - Rebuild the appliance on a fixed release. Upgrading doesn't remove a web shell.
   - Rotate secrets stored on it: admin passwords, API keys, certificate private keys and backend credentials.
   - Look for movement from the appliance into the networks and servers it protects.

## Detection

watchTowr and BleepingComputer describe the attack path. No vendor or researcher has published confirmed indicators, so these are hunting leads:

- **Unexpected `.pth` files** in Python's `site-packages` directory on the appliance (watchTowr).
- **Unexpected files in the CGI directory,** and requests to `/cgi-bin/ml-draw.py` (BleepingComputer, watchTowr).
- **Requests to `/api/fabric/device/status` and `/api/v[0-9]/fabric/widget`** with an `Authorization` header holding SQL metacharacters, comments or very long values (watchTowr).
- **Version check:** watchTowr's public detection script tests whether a device is vulnerable. Run it only against systems you own.

## Sources

- [Fortinet advisory FG-IR-25-151](https://fortiguard.fortinet.com/psirt/FG-IR-25-151)
- [watchTowr Labs analysis](https://labs.watchtowr.com/pre-auth-sql-injection-to-rce-fortinet-fortiweb-fabric-connector-cve-2025-25257/)
- [BleepingComputer, FortiWeb hacks linked to public exploits (citing Shadowserver)](https://www.bleepingcomputer.com/news/security/new-fortinet-fortiweb-hacks-likely-linked-to-public-rce-exploits/)
- [Help Net Security, public exploits and KEV listing](https://www.helpnetsecurity.com/?p=336344)
- [CVE record](https://cveawg.mitre.org/api/cve/CVE-2025-25257)

---

Data from PatchTonight (https://patchtonight.com), compiled from vendor advisories, CISA KEV and FIRST EPSS. Please credit PatchTonight and link to the CVE page when you use it.
