Skip to content
Memory corruption Advisory Advanced CVE-2019-5166

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.

Kelly Leuschner Follow

Originally disclosed on Cisco Talos

High 8.8 View original

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.

Kelly Leuschner, on Cisco Talos

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

  1. Write a crafted XML file containing an oversized dns value to the globally writable cache path.
  2. Send the BC_SaveParameter message to the service so it parses the cache file.
  3. 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.

More by Kelly Leuschner

View all

32 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.