OpenPLC OpenPLC_v3 OpenPLC Runtime EtherNet/IP parser stack-based buffer overflow vulnerability
The OpenPLC EtherNet/IP parser copies a hex-formatted version of an unsupported request into a fixed 1000-byte stack buffer without checking the length, allowing a stack-based buffer overflow. An attacker can send a series of crafted EtherNet/IP requests to trigger this overflow, potentially leading to remote code execution.
Originally disclosed on Cisco Talos
A stack-based buffer overflow vulnerability exists in the OpenPLC Runtime EtherNet/IP parser functionality of OpenPLC v3 b4702061dc14d1024856f71b4543298d77007b88. A specially crafted EtherNet/IP request can lead to remote 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 uses sprintf to append hex-formatted bytes to a fixed-size stack buffer without verifying that the total output length stays within the buffer's bounds.
Impact
Depending on the security precautions enabled on the host, further exploitation could be possible, potentially leading to remote code execution.
What the attacker needed
Network access to the EtherNet/IP server
The fix
The vulnerability was fixed in a vendor patch release on 2024-09-17.
How it was found
- Send an EtherNet/IP request with an unsupported command code and a valid encapsulation header.
- Ensure the total request size is at least 500 bytes.
- The server formats the message bytes as hex into the 1000-byte log_msg buffer, overflowing it and corrupting the stack.
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 buffer overflow happens when a program writes more data into a fixed-size memory area than it can hold, spilling into nearby memory. Here, the program takes an incoming network message, converts each byte to two hex characters plus a space, and stores that text in a 1000-byte space on the stack without checking if it fits. By sending a long enough message, an attacker can overwrite important data on the stack, which may let them 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.