Code Integrity Attestation for PLCs using Black Box Neural Network Predictions

Yuqi Chen, Christopher M. Poskitt, Jun SunESEC/SIGSOFT FSE 2021 · DOI · OpenReview

TL;DR

This paper introduces a novel method for verifying the integrity of Programmable Logic Controllers (PLCs) in cyber-physical systems (CPSs) by using neural networks to predict their input-output behavior. This approach bypasses the need for firmware access or trusted hardware, making it applicable to legacy systems and offering privacy by treating the PLC code as a black box.

What Problem Does This Paper Address?

Cyber-physical systems (CPSs), crucial for critical infrastructure like water treatment plants and power grids, rely heavily on Programmable Logic Controllers (PLCs) to manage physical processes. A compromise of PLC code can lead to catastrophic failures. Traditional methods for ensuring code integrity, such as firmware attestation or trusted execution environments, are often impractical for proprietary or legacy PLCs due to hardware or access limitations. This paper addresses the challenge of attesting PLC code integrity in a practical, privacy-preserving, and hardware-agnostic manner, especially in the face of sophisticated attackers.

Methods

The core of the proposed solution is a "black box" behavioral attestation system. The authors first create faithful offline translations of the PLC programs into an imperative language. They then employ an information flow analysis to identify the most critical inputs that influence the PLC's behavior. Using these inputs, they collect a large dataset of input-output pairs by running the offline PLC code. This data is used to train neural networks that learn to predict the PLC's actuator commands based on its inputs. The attestation process involves monitoring the real PLC's inputs and outputs and comparing them against the predictions of the trained neural network. Any discrepancy triggers an alarm, indicating a potential code modification. The "black box" nature of the neural network is key to maintaining the privacy of the original PLC code and making it difficult for attackers to simultaneously compromise both the PLC and the attestation model.

Datasets

The primary dataset used in this research was derived from the Secure Water Treatment (SWaT) testbed. The authors utilized faithful Python translations of the SWaT PLC programs to generate input-output data. They also leveraged a publicly available dataset generated from seven days of SWaT's normal operation and four days with attack scenarios for model validation. No new benchmarks were introduced; instead, the focus was on adapting existing data and testbeds to their novel attestation approach.

Key Insights and Ideas

  • Behavioral Attestation as a Practical Alternative: The paper demonstrates that attesting PLC code integrity through its input-output behavior, rather than its internal code, is a viable and practical approach, especially for systems where traditional methods are infeasible.
  • Black Box Models for Privacy and Robustness: Using neural networks as "black boxes" for attestation offers a dual benefit: it protects the intellectual property of the PLC code and significantly increases the difficulty for attackers to subvert both the PLC and the attester simultaneously.
  • Information Flow Analysis for Efficiency: Identifying the most important inputs through information flow analysis is crucial for building accurate predictive models without being overwhelmed by the sheer number of potential inputs in complex PLCs.
  • Offline Training for Safety and Scalability: The ability to train attestation models entirely offline using translated PLC code, without needing to interact with the physical system, eliminates safety concerns and reduces resource requirements.

Key Results

  • High Prediction Accuracy: The trained neural network attestation models achieved near-100% prediction accuracy on the SWaT testbed.
  • Effective Attack Detection: The system successfully detected all 120 effective code mutation attacks subjected to the PLCs.
  • Robustness Against Adversarial Attacks: The attestation models proved to be highly resilient to adversarial attacks. It was found to be practically impossible for an attacker to simultaneously modify PLC code and craft discreet adversarial noise to fool the attester into making consistent mispredictions. Even with higher levels of noise, adversarial success rates were very low.
  • Low False Alarm Rates: After retraining to address a specific bias, the neural network attestation models exhibited near-zero false alarm rates in validation against the real system.

Limitations and Future Work

The authors acknowledge that their results are based on experiments conducted on a single CPS (SWaT), and generalizability to other systems may need further investigation. However, they emphasize that their approach is designed for generality by relying on PLC code translations rather than specific process models. A key limitation is that their method can only detect code modifications that alter the PLC's input-output behavior. Modifications that do not affect behavior would go undetected. Future work could involve integrating this behavioral attestation with other defense mechanisms, such as anomaly detectors or formal verification techniques, to create a more comprehensive security chain for PLCs.

Summary updated

Abstract

Cyber-physical systems (CPSs) are widespread in critical domains, and significant damage can be caused if an attacker is able to modify the code of their programmable logic controllers (PLCs). Unfortunately, traditional techniques for attesting code integrity (i.e. verifying that it has not been modified) rely on firmware access or roots-of-trust, neither of which proprietary or legacy PLCs are likely to provide. In this paper, we propose a practical code integrity checking solution based on privacy-preserving black box models that instead attest the input/output behaviour of PLC programs. Using faithful offline copies of the PLC programs, we identify their most important inputs through an information flow analysis, execute them on multiple combinations to collect data, then train neural networks able to predict PLC outputs (i.e. actuator commands) from their inputs. By exploiting the black box nature of the model, our solution maintains the privacy of the original PLC code and does not assume that attackers are unaware of its presence. The trust instead comes from the fact that it is extremely hard to attack the PLC code and neural networks at the same time and with consistent outcomes. We evaluated our approach on a modern six-stage water treatment plant testbed, finding that it could predict actuator states from PLC inputs with near-100% accuracy, and thus could detect all 120 effective code mutations that we subjected the PLCs to. Finally, we found that it is not practically possible to simultaneously modify the PLC code and apply discreet adversarial noise to our attesters in a way that leads to consistent (mis-)predictions.
BibTeX
@inproceedings{chen2021code,
  author = {Yuqi Chen and Christopher M. Poskitt and Jun Sun},
  title = {{Code Integrity Attestation for PLCs using Black Box Neural Network Predictions}},
  booktitle = {ESEC/SIGSOFT FSE},
  year = {2021},
  doi = {10.1145/3468264.3468617},
}
Figure