Kuboid
Open Luck·Kuboid.in
Black Hat2023
Open in YouTube ↗

A Decade After Stuxnet: How Siemens S7 Is Still An Attacker's Heaven

Black Hat7,453 views38:31about 2 years ago

This talk demonstrates techniques for reverse engineering and interacting with Siemens S7 PLC firmware, including decrypting firmware images and analyzing proprietary communication protocols. The researchers identify significant security weaknesses in the S7-1200/1500 series, specifically the reliance on hardcoded cryptographic keys and the lack of robust authentication. The presentation provides a practical methodology for performing dynamic and static analysis on these industrial control systems. The speakers release custom tools, including a firmware decoder and a Ghidra processor definition, to facilitate further security research on these devices.

Breaking the Siemens S7 Protocol: How to Bypass Industrial Authentication

TLDR: Researchers have reverse-engineered the proprietary Siemens S7 communication protocol, revealing that it relies on hardcoded cryptographic keys and lacks robust authentication. By decrypting firmware images and implementing custom protocol handlers, they demonstrated that an attacker can read and write process variables or stop PLC operations entirely. This research provides actionable tools for security professionals to audit industrial control systems that were previously considered "black boxes."

Industrial control systems are often treated as immutable, air-gapped monoliths that exist outside the reach of standard security testing. This assumption is dangerous. When you plug a Programmable Logic Controller (PLC) into a company network, you are effectively exposing an embedded computer to the same threat landscape as any other server. The recent research presented at Black Hat 2023 on the Siemens S7-1200 and S7-1500 series confirms that security by obscurity is not a strategy, but a liability.

The Myth of Proprietary Security

For years, the S7 protocol was protected by the vendor’s refusal to document its inner workings. This is the classic trap of security by obscurity. If you cannot see the code, you cannot find the bugs. However, as this research demonstrates, proprietary protocols are just software, and software can be reverse-engineered.

The researchers focused on the S7-1500 software controller, which runs in a virtual machine on x86 hardware. Because this version is software-only, it is significantly more accessible to researchers than the hardware-based PLCs. By analyzing the firmware, they discovered that the communication protocol—while updated in 2022 to include a TLS-based handshake—still supports the legacy, unencrypted protocol from 2015. Most production environments have not been updated to the newer, more secure firmware, leaving them wide open to interception and manipulation.

Cracking the Firmware and Protocol

The firmware images for these controllers are distributed as encrypted ELF binaries. To perform any meaningful analysis, the researchers had to bypass this encryption. They identified a self-contained decryptor within the firmware and, by leveraging the Intel PIN framework, they were able to hook the decryption function and extract the raw binary.

Once the binary was exposed, the next hurdle was the decompiler. The firmware is a 32-bit ELF file that executes 64-bit code, but uses 32-bit pointers. Standard tools like Ghidra struggle with this architecture, often misinterpreting data types and producing unreadable pseudocode. The team solved this by creating a custom Ghidra processor definition that correctly handles the 32-bit pointer size, allowing them to map the protocol logic accurately.

The protocol itself relies on a shared secret derived via Elliptic Curve Diffie-Hellman. However, the implementation is flawed. The "master key" used to secure the handshake is effectively hardcoded. Once the researchers identified the curve parameters and the public key, they were able to write a custom client that could authenticate to the PLC without a password.

Practical Exploitation for Pentesters

If you are conducting a penetration test on an OT network, you no longer need to rely on vendor-supplied engineering software to interact with these devices. The researchers released a firmware decoder and a loader that allow you to perform dynamic analysis on the controller.

During an engagement, the impact of this vulnerability is severe. An attacker who can reach the PLC network can:

  1. Read Process Variables: Monitor the state of the machine, including sensor data and operational status.
  2. Write Process Variables: Manipulate the machine's behavior, potentially causing physical damage or production downtime.
  3. Stop the PLC: Issue a command to halt the controller, which in a manufacturing environment, is equivalent to a full-scale denial-of-service attack.

This falls squarely under OWASP A07:2021 – Identification and Authentication Failures, as the device fails to verify the identity of the client effectively.

The Path Forward for Defenders

Defending these systems requires moving away from the "it's on a separate network" mindset. If your PLC is reachable from any other part of your network, it is vulnerable.

First, ensure that the company network and the machine network are strictly segmented. Use industrial firewalls to restrict traffic to only the necessary ports and protocols. Second, demand that your vendors provide a clear roadmap for firmware updates. If a device cannot be updated to support modern, authenticated communication, it should be treated as a legacy asset that requires additional compensating controls, such as unidirectional gateways or deep packet inspection (DPI) that can detect unauthorized S7 commands.

Finally, stop assuming that your industrial hardware is secure simply because it is expensive or proprietary. The tools to break these systems are now public. If you are not testing your own OT environment, you can be certain that someone else is. The only way to improve the security of these critical systems is through the same rigorous, transparent research that has driven the evolution of web and enterprise security for the last two decades. We need more researchers to treat PLCs like the networked computers they actually are.

Talk Type
research presentation
Difficulty
advanced
Category
iot security
Has Demo Has Code Tool Released


Black Hat Europe 2023

47 talks · 2023
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in