Global encryption keys were hard-coded on some PLC product lines. Siemens recommends upgrading all affected devices.
Security researchers have found a way to extract a hard-coded global encryption key from the CPUs of several Siemens PLC product lines, allowing them to compromise their secure communications and authentications. Siemens advises all customers to update the firmware of affected devices as well as the TIA Portal software that engineers use to communicate with them and deploy their programs. As Claroty security researchers recalled, Siemens introduced asymmetric cryptography in its SIMATIC S7-1200/1500 CPUs nearly a decade ago to protect their configuration, programs, and communications.
However, the manufacturer has chosen to do this by using a hard-coded global private key for all devices in these product families. At the time, dynamic key distribution and management was not common practice and was a potential burden for customers. “Since then, advances in technology, security research and a rapidly changing threat landscape have turned these hard-coded cryptographic keys into an unacceptable risk,” say the researchers in their report. “A malicious actor capable of extracting a hard-coded global key could irreparably compromise the security of the device’s entire product line,” they added.
Cryptographic keys for authentication and code protection
According to Claroty, Siemens S7-1200 and S7-1500 PLCs use several keys: A “per-family” key, shared by all devices in a product line, and a “per-model/firmware” key used to encrypt configurations and maintain code integrity, as well as a connection key used in the authentication process, but also to encrypt communications with clients. Derived from the configuration keys, the connection key is used for elliptic curve-based encryption. This means that if attackers obtain the configuration key, they can potentially crack the user’s password from an automaton’s configuration and launch man-in-the-middle attacks, even if they do not have access to the encrypted configuration.
The problem is that this “per-family” configuration key is not stored in the firmware of the device – the operating system running on the device – but in the CPU itself, so reading it requires access to interact directly with the CPU via opcodes. This operation only needs to be performed once on a single device, as they all share the same key.
Direct memory access to extract the key
Last year, Claroty researchers discovered a remote code execution vulnerability (CVE-2020-15782) affecting S7 PLC controllers and allowing them to execute native code on the devices. Normally, programs or logic that engineers write and deploy to PLCs through specialized engineering software runs inside a sandbox within the PLC’s operating system. The CVE-2020-15782 flaw allowed researchers to bypass this layer of security and directly read and write to any normally protected memory address on the PLC.
“Using the DA read permission – direct memory access – that we obtained, we were able to extract the entire encrypted firmware of the PLC (SIMATIC S7-1500) and map its functions”, explained Researchers. “During the mapping process, we found a function that read the private key on the PLC controller. Once we had the function address, we rewrote the functionality of some MC7+ opcodes with our shell code, forcing them to call the native function that reads the private key. We then copied the key to a known memory address and read it from there. Executing the overwritten function gave us the full private key of the automaton”.
Key facilitates multiple attacks
Interaction with Siemens PLCs requires a password, but customer permissions for the device are defined by four levels of protection, all configurable. If the protection level is less than three, an attacker can extract the PLC configuration without special authorization. This configuration contains the password hash, but is encrypted. However, if they have the global private key, attackers can crack the password hash and use it to authenticate to the API with higher privileges. If the protection level is higher than four, attackers can use the private key to launch a man-in-the-middle attack against a legitimate client. To do this, they simulate a fake automaton and force the client to authenticate with it. The client then sends an encrypted login key to the fake PLC, which can then be decrypted with the extracted global key in the attacker’s possession and used to login to the real PLC.
The real PLC will respond with a password request which the attacker will send back to the client for its response. Passing this response to the real controller can establish an authenticated session with the necessary privileges to read the configuration that includes the password hash. This could then be decrypted using the global private key, giving attackers future access without repeating session hijacking using a man-in-the-middle attack. Finally, “an attacker with passive access to capture traffic to a given PLC on the network can intercept the PLC’s configuration reads/writes”, further warn the researchers. “Using the private key, the attacker can decrypt the configuration and extract the hash of the password. With the password hash, the attacker can authenticate to the PLC and write a new configuration,” they added.
Upgrade vulnerable devices and engineering software
“The SIMATIC S7-1200, S7-1500 CPUs and related products protect the embedded global private key in a way that can no longer be considered sufficient,” said said Siemens in a new notice in response to this problem. “Siemens recommends updating the affected products as well as the corresponding TIA Portal project to the latest versions. TIA Portal V17 and related CPU firmware versions introduced protection of confidential configuration data based on individual device passwords and TLS-protected PG/PC and HMI communication.”
Vulnerable devices include SIMATIC Drive Controller family versions below 2.9.2, SIMATIC ET 200SP Open Controller CPU 1515SP PC2 (including SIPLUS variants) below 21.9, SIMATIC S7-1200 CPU family (including SIPLUS) below 4.5.0, versions of the SIMATIC S7-1500 CPU family (including related ET200 CPUs and SIPLUS variants) below 2.9.2, versions of the SIMATIC S7-1500 Software Controller below 21.9 and SIMATIC S7-PLCSIM Advanced lower than 4.0. All versions of the SIMATIC ET 200SP Open Controller CPU 1515SP PC (including SIPLUS variants) are also affected, but no patches are available or planned for them.
We wish to say thanks to the writer of this post for this remarkable content
Researchers extract Siemens PLC encryption master key Computerworld
Discover our social media accounts as well as the other related pageshttps://metfabtech.com/related-pages/