WAGO PFC200 iocheckd service "I/O-Check" cache DNS code execution vulnerability
The iocheckd service on the WAGO PFC200 parses a globally writable XML cache file and copies the DNS value into a fixed 1024-byte stack buffer without a length check. An attacker who can write that file and trigger parsing can overflow the stack and potentially execute code.
Originally disclosed on Cisco Talos
An exploitable stack buffer overflow vulnerability exists in the iocheckd service “I/O-Check” functionality of WAGO PFC 200. A specially crafted XML cache file written to a specific location on the device can cause a stack buffer overflow, resulting in code execution.
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 DNS value from the XML cache is passed into sprintf() with a fixed 1024-byte stack destination and no length check, so a long value overflows the buffer.
Impact
An attacker with local write access could crash the service and, since the copied data is attacker-controlled, potentially achieve code execution.
What the attacker needed
Local write access to /tmp; ability to send a message to the service
The fix
The service should be fixed by bounding the DNS value length before formatting it into the stack buffer, or by disabling the iocheckd service or its caching as an interim mitigation.
How it was found
- Write a crafted XML file containing an oversized dns value to the globally writable cache path.
- Send the BC_SaveParameter message to the service so it parses the cache file.
- The dns value is copied into a fixed stack buffer with sprintf(), overflowing it.
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 small background service on this industrial controller reads a settings file that any local user is allowed to write. It copies a value from that file into a fixed-size space in memory without checking how long the value is, so a long value spills over into neighbouring memory. Because the attacker controls what spills over, this can crash the service and may let the attacker run their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.