CoDe16: 16 Zero-Day Vulnerabilities in CODESYS
This talk demonstrates 16 zero-day vulnerabilities in the CODESYS industrial automation framework, enabling remote code execution and denial-of-service attacks. The research focuses on reverse engineering the proprietary CODESYS network protocol and identifying memory corruption flaws within its various components. The speaker provides a detailed analysis of how these vulnerabilities can be chained to bypass security mitigations like ASLR and DEP, culminating in a practical exploit demonstration against industrial PLCs. The presentation highlights the critical risks posed by vulnerable SDKs in the industrial supply chain.
Breaking Industrial Controllers: Exploiting 16 Zero-Days in the CODESYS SDK
TLDR: Researchers recently disclosed 16 zero-day vulnerabilities in the CODESYS industrial automation framework, allowing for remote code execution and denial-of-service on millions of devices. By reverse-engineering the proprietary network protocol, the team identified memory corruption flaws that bypass ASLR and DEP protections. Security professionals should audit their OT environments for exposed CODESYS runtimes and prioritize patching, as these SDK-level flaws affect a vast array of downstream vendor products.
Industrial control systems often rely on third-party software development kits to handle complex communication and logic execution. When that SDK is as ubiquitous as the CODESYS framework, a single vulnerability chain doesn't just affect one device; it creates a systemic risk across energy, manufacturing, and building automation sectors. The recent disclosure of 16 zero-day vulnerabilities within this framework proves that supply chain security in the operational technology space is far more fragile than many assume.
Reverse Engineering the Proprietary Protocol
The research began by targeting the CODESYS runtime, specifically the communication layer that handles requests between development systems and field devices. Using IDA Pro for static analysis and GDB for dynamic debugging, the team mapped out the proprietary network protocol.
The protocol structure is surprisingly modular, consisting of four distinct layers: the Block Driver, Datagram, Channel, and Service layers. The team discovered that the Service layer acts as the primary execution point for various components, each assigned a specific Service ID. By identifying the "magic" bytes—specifically 0x55—used to signal protocol packets, they were able to reconstruct the communication flow and identify where input validation failed.
Memory Corruption and Mitigation Bypass
The core of the research focused on how these components handle incoming data. Many of the identified vulnerabilities, such as CVE-2022-47378 and CVE-2022-47379, are classic stack-based buffer overflows. The framework fails to validate the size of incoming tags against the allocated stack buffer, allowing an attacker to overwrite adjacent memory.
What makes this research particularly dangerous is the chainable nature of the exploits. While many modern systems employ Address Space Layout Randomization (ASLR) and Data Execution Prevention (DEP), the researchers found that these protections were either absent or inconsistently implemented across different hardware platforms. On the Schneider Electric TM251, for instance, the power-failure recovery mechanism consistently reloaded the stack at the same memory address, effectively neutralizing ASLR.
To bypass DEP, the team utilized Return-Oriented Programming (ROP) techniques. By hunting for gadgets within the binary, they could redirect execution flow to their shellcode. The following snippet illustrates the logic used to trigger the overflow by sending a crafted packet:
# Simplified payload structure for triggering the overflow
tag_thirteen = {
"id": 13,
"data": b"A" * 1024, # Oversized buffer to trigger overflow
"type": "malicious_payload"
}
# Send the packet to the target service handler
dev.send_packet(tag_thirteen)
Real-World Impact and Testing
For a pentester, these findings change the game for OT assessments. You are no longer just looking for default credentials or unauthenticated web interfaces. You are looking for the underlying SDK implementation. If you encounter a device running a CODESYS runtime, you should assume that any exposed port handling these proprietary packets is a potential entry point for remote code execution.
The impact is severe. An attacker who gains code execution can manipulate the logic running on the PLC, potentially causing physical damage to industrial processes. During the demonstration, the researchers showed how they could stealthily replace legitimate application files with malicious ones by leveraging the file-handling services within the framework. This allows for persistent, hard-to-detect backdoors that survive standard reboots.
Defensive Strategies for OT Environments
Defending against these flaws requires a shift toward network-level segmentation and rigorous patch management. If you are managing these systems, the first step is to identify all devices running CODESYS and ensure they are not directly exposed to the internet. Use OWASP principles for A06:2021-Vulnerable and Outdated Components to track the versions of the SDK used in your environment.
Because these vulnerabilities exist at the SDK level, you are often dependent on the hardware vendor to release a firmware update that incorporates the patched CODESYS library. If a patch is not yet available, implement strict firewall rules that restrict communication to the CODESYS port to only authorized engineering workstations.
The research serves as a stark reminder that the "black box" nature of industrial hardware is an illusion. When you peel back the layers of proprietary protocols, you often find the same memory safety issues that have plagued software for decades. For those of us in the field, the lesson is clear: don't trust the vendor's security claims until you have verified the implementation yourself. The tools to find these bugs are available, and the attack surface is massive. Start digging.
CVEs
Vulnerability Classes
Target Technologies
Attack Techniques
OWASP Categories
All Tags
Up Next From This Conference

Chained to Hit: Discovering New Vectors to Gain Remote and Root Access in SAP Enterprise Software

Zero-Touch-Pwn: Abusing Zoom's Zero Touch Provisioning for Remote Attacks on Desk Phones

ODDFuzz: Hunting Java Deserialization Gadget Chains via Structure-Aware Directed Greybox Fuzzing
Similar Talks

Inside the FBI's Secret Encrypted Phone Company 'Anom'

Kill List: Hacking an Assassination Site on the Dark Web

