Computer Integrated Manufacturing System ›› 2025, Vol. 31 ›› Issue (11): 4156-4165.DOI: 10.13196/j.cims.2023.0428

Previous Articles     Next Articles

Code vulnerability detection of programmable logic controller based on control flow slicing

LIAO Xuechao1,2+,MENG Hangyu1,2   

  1. 1.College of Computer Science and Technology,Wuhan University of Science and Technology
    2.Key Laboratory of Intelligent Information Processing and Real-time Industrial Systems
  • Online:2025-11-30 Published:2025-12-05
  • Supported by:
    Project supported by the National Natural Science Foundation,China(No.62273264).

基于控制流切片的可编程逻辑控制器代码漏洞检测方法

廖雪超1,2+,孟航宇1,2   

  1. 1.武汉科技大学计算机科学与技术学院
    2.智能信息处理与实时工业系统重点实验室
  • 作者简介:
    +廖雪超(1979-),男,湖北武汉人,副教授,研究方向:工业大数据和过程控制系统,通讯作者,E-mail:liaoxuechao@wust.edu.cn。

    孟航宇(1999-),男,河南周口人,硕士研究生,研究方向:漏洞检测和计算机应用,E-mail:a1324537171@gmail.com。
  • 基金资助:
    国家自然科学基金资助项目(62273264)。

Abstract: Programmable Logic Controller(PLC)code vulnerability detection plays a crucial role in maintaining PLC control systems,troubleshooting control flow errors and ensuring stable system operation efficiency.To address the issue of reduced precision in vulnerability detection due to an unclear semantic understanding of PLC code,a PLC code lexing approach was proposed to generate lexical units and an abstract syntax tree based on semantic segmentation rules using instruction operators as a reference.Additionally,considering the challenge of unclear control flow caused by cross-domain vulnerabilities within the PLC system,specific vulnerable code slices were generated to construct a sliced control flow graph.The vulnerability detection of multi-layer calling PLC code was realized.Through experimental verification,the integrated model could quickly detect complex structural items at the field level.Compared with the direct syntax analysis method,the recall rate of “lexical+syntax” analysis method was significantly improved and the time cost was shortened.Moreover,after slicing the overall control flow,the vulnerability detection efficiency was significantly improved,and the proposed method had certain universality.

Key words: programmable logic controller, lexical analysis, grammatical analysis, control flow diagram, code slicing

摘要: 在可编程逻辑控制器(PLC)控制系统维护、控制流错误排查和稳定系统运行效率等方面,PLC代码漏洞检测发挥着重要作用。针对PLC代码语义不明确,导致漏洞检测精度降低的问题,先对PLC代码进行词法分析生成词法单元流,并基于指令操作符为基准的语义分割规则生成抽象语法树。同时针对PLC系统内部存在着跨域漏洞而导致控制流程不明确的难点,结合具体漏洞对控制流相关代码进行切片,生成切片控制流图,实现了对多层调用PLC代码的漏洞检测。通过实验验证,该集成模型能够快速检测现场级的复杂结构项目,对比直接语法分析方法,词法+语法分析方法的召回率明显提高,时间开销缩短,并且对整体控制流进行切片后,漏洞检测效率提升明显,所提方法具有一定的普适性。

关键词: 可编程逻辑控制器, 词法分析, 语法分析, 控制流图, 代码切片

CLC Number: