CVE-2021-36182
📋 TL;DR
This vulnerability allows attackers to execute arbitrary commands on Fortinet FortiWeb web application firewalls by sending specially crafted HTTP requests. It affects FortiWeb version 6.3.13 and below, potentially enabling remote code execution on vulnerable devices.
💻 Affected Systems
- Fortinet FortiWeb
📦 What is this software?
Fortiweb by Fortinet
Fortiweb by Fortinet
⚠️ Risk & Real-World Impact
Worst Case
Complete system compromise allowing attackers to execute arbitrary commands with web server privileges, potentially leading to data theft, lateral movement, or deployment of ransomware.
Likely Case
Attackers gain shell access to the FortiWeb device, allowing them to modify configurations, intercept traffic, or use the device as a pivot point into the internal network.
If Mitigated
With proper network segmentation and access controls, impact is limited to the FortiWeb device itself without allowing lateral movement to other systems.
🎯 Exploit Status
Exploitation requires sending crafted HTTP requests to vulnerable endpoints. Multiple proof-of-concept exploits have been published.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 6.3.14 and above
Vendor Advisory: https://fortiguard.com/advisory/FG-IR-21-047
Restart Required: Yes
Instructions:
1. Download FortiWeb firmware version 6.3.14 or later from Fortinet support portal. 2. Backup current configuration. 3. Upload and install new firmware via web interface or CLI. 4. Reboot device after installation completes.
🔧 Temporary Workarounds
Restrict Management Access
allLimit access to FortiWeb management interfaces to trusted IP addresses only
config system interface
edit <interface_name>
set allowaccess https ssh
set trust-ip-1 <trusted_ip>
end
Enable WAF Protection Rules
allConfigure WAF rules to block suspicious HTTP requests containing command injection patterns
config waf signature
edit <rule_name>
set status enable
set pattern "(;|&|\||`|$)"
end
🧯 If You Can't Patch
- Isolate FortiWeb device in a dedicated network segment with strict firewall rules
- Implement network-based intrusion detection to monitor for command injection attempts
🔍 How to Verify
Check if Vulnerable:
Check FortiWeb version via web interface (System > Dashboard) or CLI command 'get system status'
Check Version:
get system status | grep Version
Verify Fix Applied:
Verify version is 6.3.14 or higher and test with known exploit payloads to confirm they are blocked
📡 Detection & Monitoring
Log Indicators:
- Unusual command execution in system logs
- HTTP requests containing shell metacharacters (;, &, |, `, $)
- Multiple failed login attempts followed by successful command execution
Network Indicators:
- HTTP requests with encoded shell commands in parameters
- Outbound connections from FortiWeb to unexpected destinations
- Unusual traffic patterns from FortiWeb management interface
SIEM Query:
source="fortiweb" AND ("cmd.exe" OR "/bin/sh" OR "bash" OR ";" OR "&" OR "|" OR "`" OR "$")