Critical SQL Injection Flaw in FortiWeb Exposed

Fortinet has released patches for a serious SQL‑injection vulnerability affecting its FortiWeb Web Application Firewall tracked as CVE‑2025‑25257, rated CVSS 9.6. Reported by GMO Cybersecurity and confirmed by watchTowr Labs and Arctic Wolf, the flaw allows unauthenticated attackers to inject arbitrary SQL via the GUI’s Fabric Connector API endpoints. This could lead to full database compromise or remote code execution depending on the backend configuration. Fortinet recommends updating affected versions (7.0.x–7.6.x) to the latest patched releases and disabling HTTP/HTTPS admin access if patching isn’t immediately possible.

Technical Description

Vulnerability Overview

The flaw identified as CVE‑2025‑25257 is a critical pre-authentication SQL injection vulnerability found in Fortinet’s FortiWeb product, specifically within its Fabric Connector functionality. With a CVSS score of 9.6, the issue allows remote attackers to send manipulated Bearer tokens to the /api/fabric/device/status endpoint, which is used for internal authentication and system status queries. When exploited, this vulnerability allows unauthorized access and, in advanced cases, remote code execution (RCE).

Root Cause: Unsafe Query Construction

At the heart of the issue lies the function get_fabric_user_by_token(), which takes the Authorization Bearer token and directly inserts it into a SQL statement using snprintf()—a C function that does not inherently protect against injection. Because no parameterized queries or input sanitization mechanisms are used, an attacker can inject malicious SQL code by crafting a token such as ‘ OR ‘1’=’1′ — . This allows the backend to authenticate the attacker without a valid token or credentials.

Exploitation Pathway to RCE

While initial exploitation results in unauthorized API access, attackers can escalate this further. Through SQL injection, they can execute MySQL’s SELECT INTO OUTFILE function to write arbitrary files onto the server. Researchers have demonstrated how a .pth file can be planted in Python’s site-packages directory, causing the system to execute malicious Python code when the next CGI script (e.g., ml-draw.py) runs. Since CGI scripts on FortiWeb often execute with root privileges, this leads directly to full system compromise.

Security Misconfigurations Amplify Risk

One critical factor exacerbating this vulnerability is that the MySQL process on FortiWeb runs as root, contrary to least-privilege best practices. This gives the attacker write access to sensitive directories like /usr/local/lib/python*/dist-packages, allowing manipulation of interpreter behavior. Once control is gained, the attacker can install backdoors, add rogue users, manipulate system services, or even corrupt logs to evade detection.

Impact

Left unpatched, this vulnerability can be weaponized by attackers to read, modify, or destroy critical firewall configuration. In deployments where the database interfaces with OS-level subsystems, SQL injection may even pave the way to remote command execution. As a web application firewall, FortiWeb often resides at the network perimeter any compromise could have widespread implications for organizational security posture and data protection.

IOC and Context Details

Topics Details
Tactic Name Initial Access, Data Exfiltration
Technique Name Exploit Public-Facing Application
Sub Technique Name SQL Injection via Fabric Connector API
Attack Type Unauthorized Database Access, Remote Code Execution Potential
Targeted Applications Fortinet FortiWeb (Web Application Firewall)
Region Impacted Global
Industry Impacted Any organization using FortiWeb for web application security
IOC’s NA
CVE CVE-2024-48887

Recommended Actions

  • Update FortiWeb Immediately: Apply the latest firmware or hotfix: 7.0.11+, 7.2.11+, 7.4.8+, or 7.6.4+.
  • Temporarily Disable Admin GUI Interfaces: If patching is delayed, block or disable HTTP/HTTPS access to Fabric Connector endpoints via firewall rules or administrative settings.
  • Inspect Access Logs: Review web and API logs for unusual SQL syntax, query anomalies, or unexpected POST requests to Fabric-related URLs

References

https://fortiguard.fortinet.com/psirt/FG-IR-24-435