The Old Switcheroo: Hiding Code on Rockwell Automation PLCs

0

By Claroty Team82. 

Successful stealthy exploits of programmable logic controllers (PLCs) are among the rarest, most time-consuming, and investment-heavy attacks. Stuxnet’s authors established the playbook for hacking PLCs by figuring out how to conceal malicious bytecode running on a PLC while the engineer programming the controller sees only normalcy on their engineering workstation. Without advanced forensics utilities, the execution of such malicious code cannot be discovered.

Conceptually, exploitation is the same in previous research: decouple the bytecode and textual code, modify one, and not the other. For example, in the Rogue7 attack on Siemens SIMATIC S7 PLCs, researchers were able to modify the textual code while transferring malicious bytecode to the PLC. Airbus Researchers carried out similar research and attacks on Schneider Electric PLCs and modified native bytecode being transferred to the PLC.

Team82 decided to test for these Stuxnet-type of attacks on the Rockwell Automation PLC platform. Our research uncovered two vulnerabilities that expose the company’s Logix Controllers and Logix Designer application for engineering workstations to attacks that allow threat actors to stealthily modify automation processes.

Programmable logic and predefined variables drive these processes, and changes to either will alter normal operation of the PLC and the process it manages. An attacker with the ability to modify PLC logic could cause physical damage to factories that affect the safety of manufacturing assembly lines, the reliability of robotic devices, or in a much more dramatic example, as we saw with Stuxnet, attackers could damage centrifuges at the core of uranium enrichment at a nuclear facility.

Rockwell Automation today disclosed these vulnerabilities and has developed a tool that detects differences in binary and textual code. By using this tool, hidden code can be detected.

TWO NEW VULNERABILITIES TO MODIFY PLC LOGIC

At its core, an engineering workstation is a fully working integrated development environment (IDE) and compiler for PLC programs. From a high-level perspective, the process of executing logic on the PLC is comprised of four main steps, illustrated below:

  1. Develop: The engineer will use the IDE capabilities of the engineering workstation to develop a new PLC program in one of the main automation programming language, such as Ladder Diagram (LD), Structured Text (ST), Function Block Diagram (FBD), and others. This code is known as textual code.
  2. Compile: Once developed, the engineer will want to transfer the new logic to the controller. To achieve this, the engineering workstation will compile the program to a PLC-compatible bytecode depending on the firmware and architecture of the target PLC. This code is referred to as binary code.
  3. Transfer: Next, the engineering workstation will communicate with the PLC over its proprietary protocol and transfer the compiled bytecode. This process is often called a download procedure, download logic, or download configuration. The download terminology refers to the viewpoint of the PLC in this process (the PLC downloads the code).
  4. Execute: Once the bytecode has been delivered successfully to the PLC, the logic will be executed.

In our research of Rockwell Automation’s engineering workstation, Studio 5000 Logix Designer, and the mechanics of its download logic procedure, we uncovered two vulnerabilities that allowed us to decouple textual code from binary code and transfer it to the PLC, while modifying one and not the other.

The first vulnerability, CVE-2022-1161 (CVSS v3.1 Base Score: 10.0/CRITICAL), was found within affected PLC firmware running on ControlLogix, CompactLogix, and GuardLogix control systems. It allows attackers to write user-readable program code to a separate memory location from the executed compiled code, allowing the attacker to modify one and not the other. To do so, an attacker could use a hardcoded secret key vulnerability in Logix Controllers previously disclosed by Team82 to communicate with Rockwell Automation PLCs and modify user programs without using Studio 5000 Logix Designer software.

The second vulnerability, CVE-2022-1159, was found within the Studio 5000 Logix Designer application that compiles the user program on the workstation. This compilation process prepares the Logix Designer application user program for download to a Logix controller. To successfully exploit this vulnerability, an attacker must first gain administrator access to the workstation running Studio 5000 Logix Designer. The attacker can then intercept the compilation process and inject code into the user program. The user may potentially be unaware that this modification has taken place.

The end result of exploiting both vulnerabilities is the same: The engineer believes that benign code is running on the PLC; meanwhile, completely different and potentially malicious code is being executed on the PLC.  

DETECTIONS AND MITIGATIONS

Team82 worked closely with Rockwell Automation engineers to understand the root cause of these attacks. As a result, Rockwell engineers came up with sophisticated solutions to detect hidden code running on their PLCs by analyzing and comparing the textual code and the binary code running on the PLC.

If a mismatch is detected, the tool will alert a difference between the two, indicating that the hidden code is running on the PLC.

To leverage these detection capabilities, asset owners are directed to upgrade to:

  • Studio 5000 V34 or later
  • Corresponding versions of Logix 5580, 5380, 5480, GuardLogix 5580 and Compact GuardLogix 5380 controller firmware
  • One of the following Compare tools:
    • Logix Designer application Compare Tool V9 or later, installed with Studio 5000 Logix Designer
    • FactoryTalk AssetCentre V12 or later (available Fall 2022)

Additional detections and mitigations options include:

THE VULNERABILITIES

CVE-2022-1161
CVSS V3.1 score: 10.0 

Affected Products:

  • 1768 CompactLogix controllers
  • 1769 CompactLogix controllers
  • CompactLogix 5370 controllers
  • CompactLogix 5380 controllers
  • CompactLogix 5480 controllers
  • Compact GuardLogix 5370 controllers
  • Compact GuardLogix 5380 controllers
  • ControlLogix 5550 controllers
  • ControlLogix 5560 controllers
  • ControlLogix 5570 controllers
  • ControlLogix 5580 controllers
  • GuardLogix 5560 controllers
  • GuardLogix 5570 controllers
  • GuardLogix 5580 controllers
  • FlexLogix 1794-L34 controllers
  • DriveLogix 5730 controllers
  • SoftLogix 5800 controllers

Description: An attacker with the ability to modify a user program may change user program code on some ControlLogix, CompactLogix, and GuardLogix Control systems. Studio 5000 Logix Designer writes user-readable program code to a separate location than the executed compiled code allowing an attacker to change one and not the other. Additionally, devices communicating over the unauthenticated version of EtherNet/IP may be vulnerable to attacks from custom clients exploiting CVE-2021-22681

CVE-2022-1159
CVSS v3.1 score: 7.7 

Affected Products: Studio 5000 Logix Designer application v28 and later, and the following Logix controllers running these affected versions: 

  • ControlLogix 5580 controllers
  • GuardLogix 5580 controllers
  • CompactLogix 5380 controllers
  • CompactLogix 5480 controllers
  • Compact GuardLogix 5380 controllers

Description: Studio 5000 Logix Designer compiles the user program on the workstation. This compilation process prepares the Logix Designer application user program for download to a Logix controller. To successfully exploit this vulnerability, an attacker must first gain administrator access to the workstation running Studio 5000 Logix Designer. The attacker can then intercept the compilation process and inject code into the user program. The user may potentially be unaware that this modification has taken place.

Share.