CVE-2021-22123
📋 TL;DR
This CVE describes an OS command injection vulnerability in FortiWeb's management interface that allows remote authenticated attackers to execute arbitrary commands on the system. The vulnerability exists in the SAML server configuration page and affects multiple FortiWeb versions. Attackers with valid credentials can exploit this to gain unauthorized system access.
💻 Affected Systems
- FortiWeb Web Application Firewall
📦 What is this software?
Fortiweb by Fortinet
Fortiweb by Fortinet
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise allowing attacker to execute arbitrary commands with system privileges, potentially leading to data theft, lateral movement, or complete device takeover.
Likely Case
Authenticated attacker gains command execution on the FortiWeb device, enabling configuration changes, credential harvesting, or deployment of persistent backdoors.
If Mitigated
Limited impact due to network segmentation, strong authentication controls, and restricted management interface access.
🎯 Exploit Status
Exploitation requires valid credentials. The vulnerability is in a web interface component making it relatively easy to exploit once authenticated.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: FortiWeb 6.3.8, 6.2.4, 6.1.2, 6.0.5, 5.9.2
Vendor Advisory: https://fortiguard.com/advisory/FG-IR-20-120
Restart Required: Yes
Instructions:
1. Backup current configuration. 2. Download appropriate firmware version from Fortinet support portal. 3. Upload firmware via web interface or CLI. 4. Reboot device after installation. 5. Verify successful upgrade.
🔧 Temporary Workarounds
Restrict Management Interface Access
allLimit access to FortiWeb management interface to trusted IP addresses only
config system interface
edit port1
set allowaccess https ssh
set trust-ip-1 192.168.1.0 255.255.255.0
end
Disable SAML Server Configuration
allRemove or disable SAML server configuration if not required
config user saml
delete <saml_server_name>
end
🧯 If You Can't Patch
- Implement strict network segmentation to isolate FortiWeb management interface
- Enforce multi-factor authentication and strong password policies for all administrative accounts
🔍 How to Verify
Check if Vulnerable:
Check FortiWeb version via web interface (System > Dashboard) or CLI using 'get system status'
Check Version:
get system status | grep Version
Verify Fix Applied:
Verify version is 6.3.8+, 6.2.4+, 6.1.2+, 6.0.5+, or 5.9.2+
📡 Detection & Monitoring
Log Indicators:
- Unusual command execution in system logs
- Multiple failed authentication attempts followed by successful login
- Unexpected configuration changes to SAML settings
Network Indicators:
- Unusual outbound connections from FortiWeb management IP
- Suspicious traffic patterns to/from management interface
SIEM Query:
source="fortiweb" AND (event_type="config_change" AND saml_server) OR (event_type="system" AND command_execution)