WAGO e!COCKPIT file path improper input validation vulnerability
The firmware update feature of WAGO e!COCKPIT trusts a file path listed inside a firmware update package, so a crafted package can write files to any location on a WAGO controller. An attacker who gets a user to select such a package could place files that lead to code execution on the device.
Originally disclosed on Cisco Talos
An exploitable improper input validation vulnerability exists in the firmware update functionality of WAGO e!COCKPIT automation software. A specially crafted firmware update file can allow an attacker to write arbitrary files to arbitrary locations on WAGO controllers as a part of executing a firmware update…
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
The update tool takes the destination path for each file directly from the package's control file and writes there without validating or restricting it.
Impact
Files could be written anywhere the entered credentials allow, potentially leading to code execution on the controller; using an admin rather than root account limits which locations are writable.
What the attacker needed
Victim starts a firmware update; victim selects the crafted package; controller admin or root credentials
The fix
The update tool should validate and restrict the target paths taken from the package, and users should run updates with administrator rather than root credentials.
How it was found
- Create a firmware update package in the expected zip format with a control file listing files and their target paths.
- Set the target path of a listed file to an arbitrary location on the controller.
- In e!COCKPIT, start a firmware update and choose the crafted package through the file browser.
- Enter controller credentials so the update proceeds and the files are written to the chosen paths.
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.
A firmware update package is a zip file that tells the update tool which files to copy onto a device and where to put them. The tool never checked that the destination was a sensible place, so a tampered package could drop a file anywhere the logged-in user was allowed to write. Someone has to be tricked into picking the bad package during an update.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.