WAGO PFC200 iocheckd service "I/O-Check" cache gateway Memory Corruption Vulnerability
The iocheckd service on WAGO PFC200 parses a globally writable XML cache file and frees a heap buffer once for each gateway element, causing a double free. An attacker who can write the cache file can crash the service, leading to denial of service and potentially code execution.
Originally disclosed on Cisco Talos
An exploitable double free 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 heap pointer to be freed twice, resulting in a denial of service and potentially 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 code frees the gateway entry array inside a loop without resetting the pointer, so the same heap chunk is freed on each iteration.
Impact
Exploiting this vulnerability in its basic form results in a denial of service for several iocheckd messages, and depending on the memory allocator it could potentially result in code execution.
What the attacker needed
Write access to /tmp/iocheckCache.xml; ability to send messages to iocheckd
The fix
The vulnerability should be fixed by disabling the iocheckd service or its caching, as recommended in the mitigation section.
How it was found
- Write a malicious XML file containing multiple gateway elements to /tmp/iocheckCache.xml.
- Send a BC_SaveParameter message to the iocheckd service to trigger parsing of the cache file.
- The service frees the gateway buffer multiple times and crashes.
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 double free happens when a program releases the same piece of memory twice. Here, the service reads a file that any user can write to, and if the file lists more than one gateway, the program frees the same memory repeatedly. This crashes the service and could let an 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.