• •    

PLC程序控制流分析方法研究

张晔1,陆余良2   

  1. 1. 电子工程学院
    2. 合肥电子工程学院网络工程系
  • 收稿日期:2017-05-09 修回日期:2017-07-03 发布日期:2017-07-03
  • 通讯作者: 张晔

Control Flow Analysis of PLC Program

  • Received:2017-05-09 Revised:2017-07-03 Online:2017-07-03

摘要: 可编程逻辑控制器(PLC)是工业控制系统的重要组成部分,控制着各类物理设备及工艺流程。不论是攻击者的恶意篡改还是内部人员的编程错误所造成的PLC控制程序错误都将严重威胁设备及人身安全。基于这种情况,提出了针对PLC程序的控制流分析方法。首先,利用flex和bison分析了源代码的词法及语法结构;其次,通过分析抽象语法树生成并优化了不含指令副作用的中间表示;最后,在中间表示的基础上划分基本块,并以此为基本单元构建了程序的控制流图。实验结果表明,该方法能够恢复语句表形式PLC程序的控制流结构,为程序理解和安全性分析提供了基础。

关键词: 可编程逻辑控制器, 控制流, 中间表示, 程序理解, 安全性

Abstract: Programmable Logic Controller (PLC) is one of the most important components of industrial control system, which controls varieties of physical equipment and production process. The faults of PLC programs caused by malicious tempering or programming mistakes could seriously threat equipment safety and personal safety in industrial field. To solve this problem, this paper proposed a control flow analysis approach of PLC program. Firstly, this approach analyzed the lexical and syntactic structure of the source code. Then it generates and optimizes the intermediate representation without side effects by analyzing the abstract syntax tree. Finally, the basic blocks are divided on the basis of the intermediate representation, and the control flow graph of the program is constructed. The result of the experiments proves that the proposed method can restore the control flow structure of PLC program which is the basis of program understanding and security analysis.

Key words: Programmable Logic Controller (PLC), control flow, intermediate representation, program understanding, security

中图分类号: