CVE-2023-34992: Fortinet FortiSIEM Command Injection Deep-Dive
An unauthenticated command injection vulnerability in Fortinet FortiSIEM's phMonitor service allowed remote attackers to execute arbitrary commands as root. The flaw was in a handler that parsed XML and passed user-controlled values to a system command.
horizon3.ai
Published on horizon3.ai
Attack Blogs, Disclosures
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the phMonitor service exposed command handlers without authentication, and one handler (handleStorageRequest) took user-supplied XML values and passed them unsanitised into a system() call.
Impact
An unauthenticated attacker could execute arbitrary commands as root, potentially reading secrets and pivoting to integrated systems.
What the attacker needed
Network access to the FortiSIEM appliance
The fix
The command injection vulnerability was fixed according to the timeline.
How it was found
- Inspect the web service and find the backend Glassfish service and its WAR file.
- Decompile the WAR and locate the LicenseUploadServlet and its call to sendCommand().
- Identify that sendCommand() sends a custom binary message to tcp/7900 (phMonitor).
- Build a client that constructs the phMonitor message format (command type, payload length, send ID, sequence ID, payload).
- Send a message with command type 81 (handleStorageRequest) containing XML with malicious server_ip or mount_point values.
- Observe that the handler calls do_system_cancellable() with the user-controlled string, leading to command execution.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This report describes a serious security hole in a Fortinet product. An attacker who can reach the device over the network could send a specially crafted message that makes the device run commands of the attacker's choosing, with the highest level of permission (root). This means the attacker could take full control of the device.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.