Detect Fortinet FortiWeb OS Command Injection (CVE-2025-58034) in Elastic Security
Detects exploitation of CVE-2025-58034, an OS command injection vulnerability (CWE-78) in Fortinet FortiWeb. This KEV-listed vulnerability allows attackers to inject and execute arbitrary OS commands through FortiWeb's management or inspection interfaces, potentially leading to full appliance compromise, lateral movement, and persistent access to network segmentation points.
MITRE ATT&CK
Elastic Detection Query
sequence by host.name with maxspan=5m
[network where event.dataset == "fortinet.fortiweb"
and (url.path : ("*;*", "*|*", "*&&*", "*`*", "*$(*")
or url.query : ("*%3B*", "*%7C*", "*%26%26*", "*%60*", "*%24%28*")
or event.action : ("*cmd_injection*", "*command_injection*", "*os_command*"))]
[process where host.os.type == "linux"
and process.name in ("/bin/sh", "/bin/bash", "sh", "bash")
and process.parent.name in ("httpsd", "wad", "node", "python", "perl")] EQL sequence detection correlating FortiWeb network events containing command injection patterns with subsequent shell process spawning on the FortiWeb appliance host within 5 minutes.
Data Sources
Required Tables
False Positives & Tuning
- Authorized shell access by FortiWeb administrators launching diagnostic scripts
- FortiWeb software update processes that invoke shell commands
- Monitoring agents running shell-based health checks on the FortiWeb system
- Automated backup scripts executed on FortiWeb appliances
Other platforms for CVE-2025-58034
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1FortiWeb Command Injection via URI Path Semicolon Delimiter
Expected signal: FortiWeb access logs showing HTTP GET request to /cgi-bin/module;id;whoami from test IP. CommonSecurityLog entry with RequestURL containing semicolons.
- Test 2FortiWeb Command Injection via URL-Encoded Shell Metacharacters
Expected signal: FortiWeb logs showing request URL containing %3B sequence. Network proxy or WAF logs showing URL-decoded form with semicolons.
- Test 3Simulated Post-Exploitation Shell Spawn from Web Process
Expected signal: Process execution log showing /bin/bash spawned with parent process www-data or httpsd equivalent. File creation event for /tmp/fortiweb_compromise_marker.txt.
- Test 4FortiWeb Management Interface Credential Stuffing and Command Injection Attempt
Expected signal: FortiWeb authentication log showing POST to management API with injection payload in password field. CommonSecurityLog DeviceAction showing authentication attempt with anomalous credential content.
Unlock Pro Content
Get the full detection package for CVE-2025-58034 including response playbook, investigation guide, and atomic red team tests.