WAGO PFC200 Cloud Connectivity Remote Code Execution Vulnerability
The Cloud Connectivity service of WAGO PFC200 does not validate the path, file name, or type of files downloaded during a remote firmware update. An attacker with web administrator privileges can configure the service to connect to a malicious Azure IoT Hub and supply an XML file that causes a shell script to be written to a specific location and executed as root.
Originally disclosed on Cisco Talos
An exploitable remote code execution vulnerability exists in the Cloud Connectivity functionality of WAGO PFC200. A specially crafted XML file will direct the Cloud Connectivity service to download and execute a shell script with root privileges.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the firmware update process trusts the TargetPath and file type from an XML file without validating them, allowing an attacker to write a script to a fixed hook location that is executed before signature verification.
Impact
An attacker with web administrator privileges could execute arbitrary shell commands as root on the device.
What the attacker needed
Web administrator privileges; attacker-controlled Azure IoT Hub
The fix
The vulnerability could be mitigated by disabling the Cloud Connectivity feature via the web-based management application.
How it was found
- Configure the Cloud Connectivity service to connect to an attacker-controlled Azure IoT Hub node.
- Provide an XML file with a File Type of 'rauc' and a TargetPath pointing to /tmp/fwupdate/fwupdate_hook.sh.
- The service downloads the file from the URL specified in the XML to the TargetPath.
- The fwupdate_background_service script finds the hook file, makes it executable, and runs it as root.
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 report has not been written yet. The Original tab links to the source.
The device's cloud update feature downloads files from a server and runs a script without checking where the files go or what they are. An attacker who can change the cloud server settings can make the device download a malicious script and run it with the highest permissions.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.