An automated reverse analysis method for industrial control programs

By collecting, parsing and disassembling industrial control program files through automated reverse analysis methods, identifying function calling relationships and establishing a database, this solves the problem of inability to deeply analyze the security of industrial control programs in the existing technology, and enables analysis of different brands and formats. Security analysis and vulnerability detection of industrial control programs.

CN117370988BInactive Publication Date: 2024-10-29BEIHANG UNIV +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311329186.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-13
Publication Date
2024-10-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology is difficult to analyze the security of industrial control programs in depth, and cannot effectively mine the function call relationships in the programs, resulting in the inability to analyze the security of industrial control systems in depth.

Method used

An automated reverse analysis method for industrial control program files is proposed. By collecting, parsing, disassembling and identifying function call relationships, a function fingerprint database is established, and a text-graphic description language is used to visualize the reverse results, thereby realizing analysis of different types of industrial control program files. Automated reverse engineering.

Benefits of technology

It accelerates industrial digital forensics and security incident response, can dynamically analyze function call relationships, mine program vulnerabilities in advance, and effectively detect false data injection attacks. It is suitable for industrial control programs of different brands and formats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117370988B_ABST
    Figure CN117370988B_ABST
Patent Text Reader

Abstract

The present invention discloses an automated reverse analysis method and process for industrial control programs. First, industrial control program files of the same format are collected from the Internet and stored in a homologous format file directory, and the industrial program files in the homologous format file directory are manually analyzed recursively, the file header length and internal field information are summarized, and the subprogram segment separator is determined; secondly, the subprogram segments are divided according to the separator, the global variable initialization program segment and the general program segment are determined, the static link library function, the user-defined function, the dynamic link library function, and the device I / O operation function are determined, the function call relationship is determined, and a function fingerprint database is established; finally, an automated analysis script is written to realize automated reverse engineering of industrial control program files of different formats, and based on the results of program disassembly and function recognition, a function call relationship diagram is constructed using a text graphic description language DOT and a Graphviz toolkit to realize the visual display of the reverse results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial control system security, and more specifically, to the field of reverse analysis of industrial control program files. The present invention proposes an automated reverse analysis method and process for industrial control program files based on disassembly technology. Background Art

[0002] With the integration and development of new technologies such as the Internet of Things, cloud computing, big data, and 5G, in order to achieve efficient automated control and monitoring of industrial processes, industrial control systems (ICS) are gradually interconnected with office networks, the Internet, and third-party networks. The originally closed industrial control environment has been broken, and industrial control systems have become the main target of attack by hostile forces. Therefore, ensuring the security of industrial control systems is of great practical significance to ensuring network security and national security.

[0003] Generally speaking, vulnerability mining technology can be used to discover industrial control system vulnerabilities in advance to improve system security. Common industrial control system vulnerability mining methods include: vulnerability mining methods based on protocol fuzz testing, vulnerability mining methods based on firmware reverse analysis, vulnerability mining methods based on software ActiveX controls, and vulnerability mining methods based on VxWorks operating system. However, there is a lack of reverse analysis of industrial control program files running in control devices, and it is impossible to mine the function call relationship in the program, and it is impossible to deeply analyze the security of industrial programs. Summary of the invention

[0004] The present invention proposes an automated reverse analysis method for industrial control programs, which can accelerate industrial digital forensics and security incident response on the one hand; on the other hand, it can dynamically analyze the function call relationships in industrial control programs, sort out the function call relationships from the perspective of reverse engineering, and dig out program vulnerabilities in advance. The structured method for automated reverse analysis of industrial control program files proposed by the present invention can be applied to different types of industrial control program files.

[0005] To achieve the above object, the present invention is implemented according to the following technical solutions:

[0006] An industrial control program automated reverse analysis method comprises the following steps:

[0007] Step S1: the program collection step: collecting industrial control program files from controllers of different brands, and storing industrial control program files with the same format in a homologous format file directory;

[0008] Step S2: the program parsing step: recursively manually analyzing the industrial program files in the same source format file directory, summarizing the file header length and internal field information, and determining the delimiter of the subprogram segment;

[0009] Step S3: the subroutine disassembly step: dividing the subroutine segments according to the separators, and determining the global variable initialization segment and the general segment;

[0010] Step S4: According to the subroutine disassembly result, determine the static link library function, user-defined function, dynamic link library function, device I / O operation function, determine the function call relationship and establish a function fingerprint database;

[0011] Step S5: the automated reverse step: according to the above step flow, write an analysis script for industrial control program files in other formats, and execute steps S2-S4 for the industrial control program files to be analyzed in the same format;

[0012] Step S6: creating a function call relationship graph with nodes, edges and weights according to the results of subroutine disassembly and function identification, and using a textual graphic description language to realize the visualization of the reverse engineering results;

[0013] In the above technical solution, in step S1, the specific steps of collecting industrial control program files are:

[0014] Step S11: Create a homologous project file directory for storing project files developed based on controllers of the same brand and model;

[0015] Step S12: creating a homologous industrial control program file directory for storing industrial control program files of the same format;

[0016] Step S13: Use the PySpider crawler to crawl projects developed based on different controllers from the open source project websites Github and CSDN, and store the project files in the same source project file directory according to the brand and model of the controller;

[0017] Step S14: Use the file command in the Linux system to recursively identify the main file type of the project file in the same source project file directory. If the main file is a project file, execute steps S15 and S16; if the main file is an executable industrial control program file, save it in the same source format industrial control program file directory;

[0018] Step S15: using industrial programming software to open and compile the main file in the project file to generate an executable industrial control program file;

[0019] Step S16: export the compiled executable industrial control program file and store it in the industrial control program file directory of the same source format; repeat steps S13-S16 until the project file directory is empty, and collect all executable industrial control program files;

[0020] In the above technical solution, in step S2, the industrial control program is parsed, the file header length and internal field information are summarized, and the delimiter of the subroutine segment is determined. The specific steps are:

[0021] Step S21: Open the directory of industrial control program files of the same source format, use the HEX Editor tool to recursively open the industrial control program files of the same format in the directory, and export the corresponding hexadecimal strings;

[0022] Step S22: write a regular expression script to match the exported hexadecimal string, find the fixed fields and fixed structures contained in the string, and count the length of the fixed fields;

[0023] Step S23: Use industrial programming software to write and compile a ladder diagram program to generate an industrial control program file with the same format. Combined with steps S21 and S22, the compiled industrial control program files are compared to determine the file header information and other fixed information in the file;

[0024] Step S24: using the Radare2 tool in the Linux system to disassemble the industrial control program file of the same format, generate an assembly instruction set, and determine the assembly instruction system architecture of the industrial control program file of the format;

[0025] Step S25: In combination with the assembly instruction system architecture, the entry instruction and the exit instruction of the subroutine segment in the industrial control program file are determined according to the assembly instruction set to form a subroutine separator; for example, the entry of the subroutine in the industrial control program file in the .PRG format is determined by the following instructions:

[0026] MOV R12,SP

[0027] The above instruction means copying the value of the current stack pointer SP to register R12;

[0028] STMFD SP!,{R11,R12,LR}

[0029] The above instruction means to subtract 12 bytes from the current stack pointer value (each register takes up 4 bytes, and 3 registers need to be stored) and store the result back to SP, and then store the values ​​of R11, R12 and LR registers to the memory address pointed to by SP;

[0030] MOV R11,R12

[0031] The above instruction means copying the value in register R12 to register R11;

[0032] The following instructions can be used to determine the exit of a subroutine in an industrial control program file in .PRG format:

[0033] LDMDB R11,{R11,SP,PC}

[0034] The above instruction means loading 3 words (4 bytes per word) from the memory address pointed to by register R11 into registers R11, SP, and PC.

[0035] In the above technical solution, subroutine disassembly is performed in step S3, and the specific steps are as follows:

[0036] Step S31: Use industrial programming software to load the industrial control program file and record the global variables defined in the program;

[0037] Step S32: searching for the global variable name in the assembly instruction corresponding to the industrial control program file, and determining the global variable initialization subroutine segment in combination with the subroutine separator;

[0038] Step S33: using the symbolic execution tool angr to parse the memory information at the end of the subroutine execution, and determining the memory initialization subroutine segment in combination with the subroutine segment delimiter;

[0039] Step S34: using angr to parse the memory initialization subroutine segment, extracting the offset of the subroutine segment in the entire industrial control program file, and rebuilding the function call table; retrieving the target keyword "DCB "SysDebugHandler"" in the function call table to determine the industrial programming software dynamic debugging processing subroutine segment;

[0040] In the above technical solution, function recognition is performed in step S4, and a function fingerprint database is constructed. The specific steps are as follows:

[0041] Step S41: Use the flair tool provided by IDAPro to load the industrial control program file, generate a .pat file, combine the sigmake tool to obtain the .sig file from the .pat file, analyze the .sig file to identify the library function in the industrial control program file, thereby identifying the signature of the static link function and recording the function information in the dynamic link library;

[0042] Step S42: According to steps S31-S34 and S41, the key subroutines for executing the static link function F / FB can be obtained: the StaticLib subroutine for executing the main function, the StaticLibINIT subroutine for initializing the local memory, and the user-defined function execution subroutine (FB i) and the initialization function execution subroutine (FB i INIT), where i is the user-defined function execution subroutine number;

[0043] Step S43: Determine the call table according to the function type in the industrial control program file: if the function exists in a dynamic link form, the jump offset value is calculated according to the two-byte data value after the null-terminated string in the dynamic library to determine the call table position, and then determine the function call relationship; if the function exists in a static link form (binary program), based on the information parsed by angr in step S34, extract the index of all offsets assigned to the function to determine the call table position, and then determine the function call relationship;

[0044] Step S44: using industrial programming software to load the industrial control program to obtain the hardware structure information of the PLC device;

[0045] Step S45: Based on the hardware structure information obtained in step S44, extract and store the I / O function memory map of the industrial control device, and create a device I / O function database;

[0046] Step S46: Connect the operation codes of the function to form a character connection sequence, use the SHA-256 algorithm to calculate the hash value of the character connection sequence to generate a fingerprint signature that can uniquely identify the function, and construct a function fingerprint database;

[0047] In the above technical solution, the automatic reverse engineering of the industrial control program file is performed in step S5, and the specific steps are as follows:

[0048] Step S51: According to steps S2, S3, and S4, write an automated analysis script for industrial control program files in different formats;

[0049] Step S52: using the automated analysis script generated in step S51, perform automated reverse analysis on the industrial control program file of the same format, match the calculated function signature with the content in the known function fingerprint database, and if the match is successful, change the function name to the name of the function in the function fingerprint database;

[0050] Step S53: Based on the above steps, the function call relationship is drawn using the angrutils library in Python, thereby constructing a control flow graph of the industrial control program file;

[0051] In the above technical solution, the reverse result is visualized in step S6, and the specific steps are:

[0052] Step S61: Based on the industrial control file control flow graph generated in step S53, the static link library function and the dynamic link library function names in the subroutine are used as nodes, the calling relationships between functions are used as edges, and the number of calls is used as the weight of the edge;

[0053] Step S62: construct a function call relationship graph using the text graphics description language DOT and the Graphviz toolkit;

[0054] Step S63: For non-dynamic link library functions, that is, nodes included in the industrial control program file, a hyperlink is created in the final function call relationship graph from the node link to its corresponding disassembly list to facilitate traversal.

[0055] Compared with the prior art, the present invention has the following beneficial effects:

[0056] The present invention performs automated reverse analysis on industrial control program files, and realizes operations such as industrial control program collection, program parsing, subroutine disassembly, function identification, automated reversal, and visualization of reverse results. From the perspective of the entire technical solution, the present invention is the first to establish a disassembly method and process for industrial control programs in the field of industrial control system security;

[0057] The present invention is not limited by the brand of industrial controllers and the format of industrial control programs, that is, the detection method designed for industrial control programs running on industrial controllers of different brands including multi-node systems can still effectively detect false data injection attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 It is a schematic diagram of the process of the present invention;

[0059] Figure 2 A schematic diagram of the process flow collected for the industrial control program in the present invention;

[0060] Figure 3 It is a schematic diagram of the program analysis flow in the present invention;

[0061] Figure 4 It is a schematic diagram of the process of disassembling the subroutine in the present invention;

[0062] Figure 5 It is a schematic diagram of the process of function identification in the present invention;

[0063] Figure 6 It is a schematic diagram of the reverse process of the industrial control program file automation in the present invention;

[0064] Figure 7 It is a schematic diagram of the reverse result visualization process in the present invention. DETAILED DESCRIPTION

[0065] In order to better illustrate the purpose, technical solutions and advantages of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0066] The present invention proposes an automated reverse analysis method for industrial control programs, which collects industrial control programs, parses the industrial control programs and disassembles the parsed subroutines, thereby identifying functions and constructing a function fingerprint database, and finally realizes automated reverse engineering and visualization of reverse results. The flowchart is shown in FIG. Figure 1 As shown, the following steps are included:

[0067] Step S1: Collect industrial control program files from controllers of different brands, and store industrial control program files with the same format in the same source format file directory. The flowchart is as follows: Figure 2 As shown, the following steps are included:

[0068] Step S11: Create a homologous project file directory for storing project files developed based on controllers of the same brand and model;

[0069] Step S12: creating a homologous industrial control program file directory for storing industrial control program files of the same format;

[0070] Step S13: Use the PySpider crawler to crawl projects developed based on different controllers from the open source project websites Github and CSDN, and store the project files in the same source project file directory according to the brand and model of the controller;

[0071] Step S14: Use the file command in the Linux system to recursively identify the main file type of the project file in the same source project file directory. If the main file is a project file, execute steps S15 and S16; if the main file is an executable industrial control program file, save it in the same source format industrial control program file directory;

[0072] Step S15: using industrial programming software to open and compile the main file in the project file to generate an executable industrial control program file;

[0073] Step S16: export the compiled executable industrial control program file and store it in the industrial control program file directory of the same source format; repeat steps S13-S16 until the project file directory is empty, and collect all executable industrial control program files;

[0074] Step S2: Perform recursive manual analysis on the industrial control program files in the same source format file directory, summarize the file header length and internal field information, and determine the delimiter of the subroutine segment. The flowchart is shown in the figure below: Figure 3 As shown, the following steps are included:

[0075] Step S21: Open the directory of industrial control program files of the same source format, use the HEXEditor tool to recursively open the industrial control program files of the same format in the directory, and export the corresponding hexadecimal strings;

[0076] Step S22: write a regular expression script to match the exported hexadecimal string, find the fixed fields and fixed structures contained in the string, and count the length of the fixed fields;

[0077] Step S23: Use industrial programming software to write and compile a ladder diagram program to generate an industrial control program file with the same format. Combined with steps S21 and S22, the compiled industrial control program files are compared to determine the file header information and other fixed information in the file;

[0078] Step S24: using the Radare2 tool in the Linux system to disassemble the industrial control program file of the same format, generate an assembly instruction set, and determine the assembly instruction system architecture of the industrial control program file of the format;

[0079] Step S25: In combination with the assembly instruction system architecture, the entry instruction and the exit instruction of the subroutine segment in the industrial control program file are determined according to the assembly instruction set to form a subroutine separator; for example, the entry of the subroutine in the industrial control program file in the .PRG format is determined by instructions (1)-(3):

[0080] (1)MOVR12,SP

[0081] (2)STMFDSP!,{R11,R12,LR}

[0082] (3)MOVR11,R12

[0083] The exit of the subroutine in the industrial control program file in .PRG format is determined by instruction (4):

[0084] (4)LDMDBR11,{R11,SP,PC}

[0085] Instruction (1) means copying the value of the current stack pointer SP to register R12; instruction (2) means subtracting 12 bytes from the value of the current stack pointer (each register takes up 4 bytes, and 3 registers need to be stored) and storing the result back to SP, and then storing the values ​​of the R11, R12 and LR registers to the memory address pointed to by SP; instruction (3) means copying the value in register R12 to register R11; instruction (4) means loading the 3 words (each word is 4 bytes) in the memory address pointed to by register R11 into the R11, SP and PC registers;

[0086] Step S3: Divide the subprogram segments according to the separator, determine the global variable initialization program segment and the general program segment, and perform program analysis. The flowchart is as follows: Figure 4 As shown, the following steps are included:

[0087] Step S31: Use industrial programming software to load the industrial control program file and record the global variables defined in the program;

[0088] Step S32: searching for the global variable name in the assembly instruction corresponding to the industrial control program file, and determining the global variable initialization subroutine segment in combination with the subroutine separator;

[0089] Step S33: using the symbolic execution tool angr to parse the memory information at the end of the subroutine execution, and determining the memory initialization subroutine segment in combination with the subroutine segment delimiter;

[0090] Step S34: using angr to parse the memory initialization subroutine segment, extracting the offset of the subroutine segment in the entire industrial control program file, and rebuilding the function call table; retrieving the target keyword "DCB "SysDebugHandler"" in the function call table to determine the industrial programming software dynamic debugging processing subroutine segment;

[0091] Step S4: The function identification step: according to the subroutine disassembly result, determine the static link library function, user-defined function, dynamic link library function, device I / O operation function, determine the function call relationship and establish a function fingerprint database. The flow chart is as follows: Figure 5 As shown, the following steps are included:

[0092] Step S41: Use the flair tool provided by IDAPro to load the industrial control program file, generate a .pat file, and use the sigmake tool to obtain a .sig file from the .pat file. Analyze the .sig file to identify the library function in the industrial control program file, thereby identifying the signature of the static link function and recording the function information in the dynamic link library;

[0093] Step S42: According to steps S31-S34 and S41, the key subroutines for executing the static link function F / FB can be obtained: the StaticLib subroutine for executing the main function, the StaticLibINIT subroutine for initializing the local memory, and the user-defined function execution subroutine (FB i ) and the initialization function execution subroutine (FB i INIT). Among them, i is the user-defined function execution subroutine number;

[0094] Step S43: Determine the call table according to the function type in the industrial control program file: if the function exists in a dynamic link form, the jump offset value is calculated according to the two-byte data value after the null-terminated string in the dynamic library to determine the call table position, and then determine the function call relationship; if the function exists in a static link form (binary program), based on the information parsed by angr in step S34, extract the index of all offsets assigned to the function to determine the call table position, and then determine the function call relationship;

[0095] Step S44: using industrial programming software to load the industrial control program to obtain hardware structure information of the industrial control device;

[0096] Step S45: Based on the hardware structure information obtained in step S44, extract and store the I / O function memory map of the industrial control device, and create a device I / O function database;

[0097] Step S46: Connect the operation codes of the function to form a character connection sequence, use the SHA-256 algorithm to calculate the hash value of the character connection sequence to generate a fingerprint signature that can uniquely identify the function, and construct a function fingerprint database;

[0098] Step S5: The automated reverse step: According to the above steps, write an analysis script for industrial control program files in other formats, and execute steps S2-S4 for the industrial control program files to be analyzed in the same format. The flowchart is as follows: Figure 6 As shown, the following steps are included:

[0099] Step S51: According to steps S2, S3, and S4, write an automated analysis script for industrial control program files in different formats;

[0100] Step S52: using the automated analysis script generated in step S51, perform automated reverse analysis on the industrial control program file of the same format, match the calculated function signature with the content in the known function fingerprint database, and if the match is successful, change the function name to the name of the function in the function fingerprint database;

[0101] Step S53: Based on the above steps, the function call relationship is drawn using the angrutils library in Python, thereby constructing a control flow graph of the industrial control program file;

[0102] Step S6: Based on the results of subroutine disassembly and function identification, a function call relationship graph with nodes, edges and weights is created, and the reverse result visualization is realized using a textual graphic description language. The flowchart is shown in the figure below: Figure 7 As shown, the following steps are included:

[0103] Step S61: Based on the industrial control file control flow graph generated in step S53, the static link library functions and dynamic link library functions in the subroutine are used as nodes, the calling relationships between functions are used as edges, and the number of calls is used as the weight of the edge;

[0104] Step S62: Combined with step S61, use the text graphics description language DOT and the Graphviz toolkit to construct a function call relationship diagram;

[0105] Step S63: For non-dynamic link library functions, that is, nodes included in the industrial control program file, a hyperlink is created in the final function call relationship graph from the node link to its corresponding disassembly list to facilitate traversal.

Claims

1. An automated reverse analysis method for industrial control programs, characterized in that It includes the following six steps: program collection, program analysis, subroutine disassembly, function identification, automated reverse engineering, and result visualization: S1, the program collection step: collecting industrial control program files from controllers of different brands, and storing industrial control program files with the same format in a homologous format file directory; S2, the program parsing step: recursively manually analyzing the industrial control program files in the same source format file directory, summarizing the file header length and internal field information, and determining the delimiter of the subroutine segment; S3, the subroutine disassembly step: dividing the subroutine segments according to the separator, and determining the global variable initialization program segment and the general program segment; S4, the function identification step: according to the subroutine disassembly result, determine the static link library function, user-defined function, dynamic link library function, device I / O operation function, determine the function call relationship and establish a function fingerprint database; S5, the automated reverse step: according to steps S2-S4, write an automated analysis script for industrial control program files in other formats, execute steps S2-S4 for the industrial control program files to be analyzed in the same format, and use the angrutils library in Python to draw the function call relationship, thereby constructing a control flow graph of the industrial control program files; S6, the result visualization step: based on the control flow graph of the industrial control file generated in step S5, create a function call relationship graph with nodes, edges and weights, and use a text graphic description language to realize the visualization of the reverse result; in step S2, the program parsing step includes the following operations: S21. Open the directory of files with the same source format, use the HEX Editor tool to recursively open the industrial control program files with the same format in the directory, and export the corresponding hexadecimal strings; S22. Write a regular expression script to match the exported hexadecimal string, find the fixed fields and fixed structures contained in the string, and count the length of the fixed fields; S23, using industrial programming software to write and compile a ladder diagram program to generate an industrial control program file with the same format, combining steps S21 and S22, comparing the compiled industrial control program files to determine the file header information and other fixed information in the file; S24. Use Radare2 tool in Linux system to disassemble industrial control program files of the same format, generate assembly instruction set, and determine assembly instruction system architecture of industrial control program files of the format; S25, combining the assembly instruction system architecture, determining the entry instruction and the exit instruction of the subroutine segment in the industrial control program file according to the assembly instruction set, and forming a subroutine separator; In step S3, the subroutine disassembly step includes the following operations: S31. Use industrial programming software to load the industrial control program file and record the global variables defined in the program; S32, searching for the global variable name in the assembly instruction corresponding to the industrial control program file, and determining the global variable initialization program segment in combination with the subroutine separator; S33, using the symbolic execution tool angr to parse the memory information at the end of the subroutine execution, and determining the memory initialization subroutine segment in combination with the subroutine segment delimiter; S34, using angr to parse the memory initialization subroutine segment, extract the offset of the subroutine segment in the entire industrial control program file, and rebuild the call table; retrieve the target keyword "DCB"SysDebugHandler"" in the call table to determine the industrial programming software dynamic debugging processing subroutine segment; In step S4, the function identification step includes the following operations: S41. Use the flair tool provided by IDAPro to load the industrial control program file, generate a .pat file, combine the sigmake tool to obtain the .sig file from the .pat file, analyze the .sig file to identify the library functions in the industrial control program file, and thus identify the function information in the static link library function and the dynamic link library; S42, according to steps S31-S34 and S41, the key subroutines for executing the static link function F / FB can be obtained: the StaticLib subroutine for executing the main function, the StaticLibINIT subroutine for initializing the local memory, and the user-defined function execution subroutine and the initialization function execution subroutine; S43, determining the call table according to the function type in the industrial control program file: if the function exists in a dynamic link form, the jump offset value is calculated according to the two-byte data value after the null-terminated string in the dynamic library to determine the call table position, and then determine the function call relationship; if the function exists in a static link form, based on the information parsed by angr in step S34, the index of all offsets allocated to the function is extracted to determine the call table position, and then determine the function call relationship; S44, using industrial programming software to load the industrial control program to obtain hardware structure information of the industrial control device; S45, based on the hardware structure information obtained in step S44, extract and store the I / O function memory map of the industrial control device, and create a device I / O function database; S46. Connect the operation codes of the function to form a character connection sequence, use the SHA-256 algorithm to calculate the hash value of the character connection sequence to generate a fingerprint signature that can uniquely identify the function, and construct a function fingerprint database.

2. According to the method for automatic reverse analysis of industrial control programs described in claim 1, it is characterized in that: In step S1, the program collection step includes the following operations: S11. Create a homologous project file directory to store project files developed based on the same brand and model controller; S12. Create a homologous format industrial control program file directory for storing industrial control program files of the same format; S13. Use PySpider to crawl projects developed based on different controllers from the open source project websites Github and CSDN, and store the project files in the same source project file directory according to the brand and model of the controller; S14. Use the file command in the Linux system to recursively identify the main file type of the project file in the same source project file directory. If the main file is a project file, execute steps S15 and S16; if the main file is an executable industrial control program file, save it in the same source format industrial control program file directory; S15, using industrial programming software to open and compile the main file in the project file to generate an executable industrial control program file; S16. Export the compiled executable industrial control program file and save it in the industrial control program file directory of the same source format; repeat steps S13-S16 until the project file directory is empty, and collect all executable industrial control program files.

3. According to the method for automatic reverse analysis of industrial control programs described in claim 1, it is characterized in that: In step S5, the automated reverse step includes the following operations: S51. According to steps S2, S3, and S4, write an automated analysis script for industrial control program files in different formats; S52, using the automated analysis script generated in step S51, to perform automated reverse analysis on the industrial control program file of the same format, and matching the calculated function signature with the content in the known function fingerprint database, and if the match is successful, changing the function name to the name of the function in the function fingerprint database; S53. Based on the above steps, use the angrutils library in Python to draw the function call relationship, so as to construct a control flow graph of the industrial control program file.

4. According to the method for automatic reverse analysis of industrial control programs described in claim 1, it is characterized in that: In step S6, the result visualization step includes the following operations: S61, based on the industrial control file control flow graph generated in step S53, the static link library functions and dynamic link library functions in the subroutine are used as nodes, the calling relationships between the functions are used as edges, and the number of calls is used as the weight of the edge; S62, combining step S61 with the text graphics description language DOT and the Graphviz toolkit to construct a function call relationship diagram; S63. For non-dynamic link library functions, that is, nodes included in the industrial control program file, a hyperlink is created from the node link to its corresponding disassembly list in the final function call relationship diagram to facilitate traversal.

Citation Information

Patent Citations

  • Industrial communication protocol reverse analysis method based on dynamic stain analysis

    CN110213243A

  • Reverse analysis method for intelligent terminal firmware of power grid sensing layer

    CN115525331A

  • Realization method and device for restoring source code through reverse engineering and electronic equipment

    CN116501378A

  • Methods and systems of disassembling executable code

    US20190095183A1