Stealing Private Keys From S7 PLCs
This talk demonstrates six distinct attack vectors against Siemens S7-1500 PLCs, focusing on the extraction of private keys and the manipulation of industrial processes. The researchers highlight vulnerabilities in the S7CommPlus protocol, specifically the lack of robust client authentication and the reliance on hardcoded keys for program encryption. The presentation provides a comprehensive analysis of how these flaws allow for man-in-the-middle attacks, unauthorized code injection, and the bypass of certificate pinning mechanisms. The researchers also release a custom S7 packet sniffer and proxy tool to facilitate the analysis of encrypted S7 traffic.
Breaking Siemens S7-1500 Security: How Hardcoded Keys and Weak Auth Compromise Industrial Control
TLDR: Researchers at Black Hat 2024 demonstrated six distinct attack vectors against Siemens S7-1500 PLCs, proving that even with TLS 1.3, the underlying protocol remains fundamentally broken. By exploiting insecure key provisioning and hardcoded cryptographic secrets, an attacker can perform man-in-the-middle attacks to steal private keys and inject malicious control logic. This research highlights the critical need for robust mutual authentication and secure key management in industrial environments, as current implementations fail to protect against sophisticated network-level adversaries.
Industrial control systems are often treated as black boxes, protected by the assumption of air-gapped networks or proprietary protocols. This mindset is dangerous. The recent research presented at Black Hat 2024 on Siemens S7-1500 PLCs shatters the illusion that modernizing industrial protocols with TLS 1.3 is a silver bullet. When the underlying architecture relies on hardcoded keys and lacks mandatory mutual authentication, adding encryption is merely putting a padlock on a screen door.
The Anatomy of the S7CommPlus Failure
At the heart of the issue is the S7CommPlus protocol, which Siemens uses for communication between the TIA Portal engineering software and the PLC. While the protocol now supports TLS 1.3, the implementation is riddled with design flaws that allow an attacker with network access to bypass security controls entirely.
The researchers identified that the PLC relies on a public-key infrastructure (PKI) for authentication, but the provisioning process is fundamentally insecure. When a new PLC is initialized, it generates a self-signed certificate. If the engineer does not manually secure this process, the PLC is vulnerable to man-in-the-middle (MITM) attacks from the very first connection. Because the TIA Portal does not enforce strict certificate pinning by default, an attacker can intercept the initial handshake, present a rogue certificate, and establish a trusted connection.
Extracting Secrets via Insecure Provisioning
One of the most alarming findings is how easily an attacker can extract the PLC’s private key. During the initial configuration download, the TIA Portal sends the private key and certificate to the PLC. The researchers discovered that this sensitive data is encrypted using a hardcoded key shared across all PLCs with the same firmware version.
To facilitate this, the team developed a custom S7 proxy and packet sniffer. By positioning themselves as a MITM, they can decrypt the traffic, extract the configuration password, and subsequently decrypt the private key. The following logic illustrates the vulnerability:
# Conceptual flow of the key extraction
def extract_private_key(captured_packet):
# The hardcoded key is used to encrypt the seed
# which in turn protects the private key
encrypted_seed = captured_packet.get_field('encrypted_seed')
seed = decrypt_with_hardcoded_key(encrypted_seed)
private_key = decrypt_with_seed(captured_packet.get_field('encrypted_private_key'), seed)
return private_key
Once the private key is in the attacker's possession, the game is over. They can impersonate the PLC to the engineering station or the engineering station to the PLC, effectively gaining full control over the industrial process.
Rogue Clients and Stealth Injection
Beyond key theft, the researchers demonstrated a "Rogue Client" attack. By implementing a Python script that mimics the S7CommPlus client, an attacker can send arbitrary commands to the PLC. Since the protocol lacks robust client-side authentication, the PLC accepts these commands without question. This allows an attacker to stop the CPU, modify the hardware configuration, or write to arbitrary memory addresses.
The most dangerous vector, however, is the "Stealth MITM" attack. By intercepting the communication between the operator and the PLC, the attacker can feed the operator a forged, "healthy" status while the PLC is actually running malicious code. This is a direct parallel to the Stuxnet era, where the operator’s HMI showed normal operations while the physical process was being sabotaged. Because the attacker holds the valid private key, they can sign these forged responses, ensuring the TIA Portal accepts them as authentic.
Defensive Realities for ICS Environments
Defending against these attacks requires moving beyond the "set it and forget it" approach to PLC security. The primary mitigation is to treat the engineering network as a high-security zone.
- Enforce Strict Password Policies: Use the PLC configuration password, CPU access protection password, and know-how protection password. These must be unique per device and sufficiently complex.
- Secure Provisioning: Perform the initial provisioning in a physically isolated, hardened environment. Never initialize a PLC on a production network where an attacker could be sniffing traffic.
- Use Vendor Certificates: Avoid self-signed certificates. If your infrastructure supports it, use a managed PKI to issue and verify certificates for all engineering stations and PLCs.
- Monitor for Anomalies: Use network intrusion detection systems to monitor for unauthorized S7CommPlus traffic, specifically looking for unexpected engineering commands or unauthorized attempts to access configuration memory.
The burden of security in these systems currently rests heavily on the asset owner. While vendors like Siemens are aware of these issues, the fundamental design of legacy-compatible protocols makes them difficult to patch without breaking existing workflows. As a researcher or pentester, your goal should be to identify where these hardcoded keys or weak authentication points exist in your client's environment. If you can extract a private key from a PLC, you have demonstrated a risk that no firewall can mitigate. Demand secure products, but until they arrive, assume the network is compromised and build your defenses accordingly.
Vulnerability Classes
Target Technologies
Attack Techniques
All Tags
Up Next From This Conference
Similar Talks

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

Hacking Apple's USB-C Port Controller




