WAGO PFC200 iocheckd service "I/O-Check" get_coupler_details remote code execution vulnerability
The get_coupler_details utility in the WAGO PFC200 iocheckd service copies the MARKING or WAGONR system values into a 64-byte stack buffer using a much larger length, so values over 60 bytes overflow the stack. An unauthenticated attacker can send crafted iocheckd packets to overwrite those values with their own data and gain remote code execution.
Originally disclosed on Cisco Talos
An exploitable stack buffer overflow vulnerability exists in the command line utility getcouplerdetails of the WAGO PFC 200. A specially crafted set of packets sent to the iocheckd service “I/O-Check” can cause a stack buffer overflow in the sub-process getcouplerdetails, 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 copy routine passes a length of 0x104 into g_strlcpy while the destination stack buffer is only 0x40 bytes, so an over-long MARKING or WAGONR value overflows the buffer and later overwrites the saved registers and return address.
Impact
An unauthenticated remote attacker could execute arbitrary code on the controller, with high confidentiality, integrity and availability impact.
What the attacker needed
Network access to the iocheckd service; no authentication needed
The fix
The text offers only a mitigation: disable the iocheckd service through the web-based management application.
How it was found
- Send an unauthenticated iocheckd protocol packet that sets the MARKING or WAGONR system value to attacker-controlled data longer than 60 bytes.
- Trigger the get_coupler_details utility remotely through an iocheckd service message, one of four message types that reach the vulnerable copy.
- The over-long value is copied into the 64-byte stack buffer, overwriting saved registers and the return address.
- When the function returns, execution jumps to the attacker-controlled address, giving code 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 report has not been written yet. The Original tab links to the source.
A small helper program on the controller copies a device setting into a fixed-size space in memory without checking how long the setting is. If the setting is longer than that space, it spills over into nearby memory, including the place where the program remembers where to return after finishing. Because the attacker can set that value remotely and without logging in, they can control what gets written there and redirect the program to 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.