An automated penetration testing method for industrial control terminal devices
By analyzing the communication protocol of industrial control terminal equipment and writing automated testing programs, the problem of low penetration testing efficiency of industrial control systems is solved, efficient automated testing of multiple devices is achieved, and testing efficiency and coverage are improved.
Patent Information
- Application Number
- CN202111407319.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-11-24
AI Technical Summary
The penetration testing efficiency of existing industrial control systems is low, especially the automation testing of industrial control terminal equipment is difficult to achieve, and traditional tools cannot effectively automate operations, resulting in insufficient safety testing efficiency and coverage.
Develop an automated penetration testing method for industrial control terminal equipment. By analyzing the equipment communication protocol, write penetration testing programs suitable for industrial control terminal equipment, and download them to the equipment for system settings to realize automated testing between equipment and optimize testing. program to improve testing efficiency.
It realizes efficient automated penetration testing of industrial control system terminal equipment, saves the time and energy of safety personnel, and can test multiple devices at the same time, expands the test surface, and improves the scalability and efficiency of the test.
Smart Images

Figure CN113934411B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of industrial control system security, and in particular relates to an automated penetration testing method between industrial control terminal devices. Background Art
[0002] With the continuous integration of industrialization and informatization, more and more information technology has been introduced into the industrial production environment, which has greatly improved the efficiency of industrial production and reduced the cost of cables used for communication. However, while enjoying the convenience brought by information technology, it has also introduced security issues that have never been faced in the industrial field before. The original industrial control system is an "information island", which forms a closed-loop system including equipment control, equipment communication, data monitoring, and data collection within the factory. With the continuous integration with information technology, more and more industrial control equipment interfaces are exposed to the public network, and security issues are becoming increasingly prominent.
[0003] As an important terminal device for industrial production, PLC (Programmable Logic Controller) receives user instructions such as program control, counting and arithmetic operations, and controls various types of machinery or production equipment through digital or analog input / output. It is a "bridge" facing the physical world and the network world. However, due to the small computing power and streamlined and concentrated functions of PLC, security issues were not considered too much during the design. However, the pace of informatization of industrial control systems is accelerating, and some PLCs are exposed to the attack field, and the probability of being maliciously attacked will be greatly increased. At this time, penetration testing is performed on PLC, and corresponding sensitive data backup, firmware version upgrade and other security operations are performed according to the results, ultimately enhancing the security of PLC itself.
[0004] Penetration testing in the field of industrial control is generally prepared with network detection, and vulnerability scanning and fuzz testing are used as auxiliary means. Penetration testing is used as the core method, and vulnerability assessment is the final goal. Network detection mainly undertakes tasks such as intelligence collection, host detection, port scanning, etc. of the target industrial control system. The collected information provides detailed and accurate fingerprint information for subsequent vulnerability data comparison. After obtaining effective information of the test target system through network detection, vulnerability scanning will use the vulnerability information and vulnerability data in the industrial control vulnerability library for feature comparison. If the search is successful, the security vulnerabilities and vulnerabilities of the test target are discovered. If the search fails, manual vulnerability analysis is required by means such as fuzz testing. Based on the results of vulnerability scanning and fuzz testing, penetration attacks are carried out, and vulnerability assessments are performed based on the results.
[0005] Penetration testing for industrial control systems requires the participation of host computers and security personnel. The test scope includes industrial control communication protocols, engineer stations, industrial routers, and industrial control equipment. In penetration testing of industrial control equipment, due to the particularity of industrial control private protocols, the results of traditional tools such as Nmap only include device versions, port opening information, product serial numbers, etc. For further analysis of industrial control equipment, security personnel need to manually construct protocol packages to communicate with the equipment to obtain sensitive information, which is very unfavorable for automated security testing. At the same time, due to the large number of industrial control terminal devices, if all devices under the intranet are tested once, it will take a huge amount of time. Summary of the invention
[0006] The purpose of the present invention is to provide an automated penetration test method for industrial control terminal devices. Aiming at the weakness that the upper computer is not conducive to automated implementation and has low efficiency in penetration testing, a method for penetration testing between penetration devices is proposed, which can effectively improve the efficiency of penetration testing of terminal devices in the target network.
[0007] An automated penetration testing method for industrial control terminal devices, comprising the following steps:
[0008] Step 1, select a terminal device and analyze the communication protocol it uses;
[0009] Step 2: Analyze the security features in the protocol and develop a penetration testing program suitable for industrial control terminal devices in combination with the programming language of the terminal devices;
[0010] Step 3, based on step 2, download the program to the terminal device and perform relevant system settings on the terminal device;
[0011] Step 4: Deploy the experimental environment, conduct penetration tests on the devices connected to the intranet, and further optimize the test procedures based on the returned results;
[0012] Step 5: Obtain the optimal test program through multiple optimization iterations and obtain the final test results.
[0013] Furthermore, the following operations are subdivided in step 1:
[0014] Step 1-1, obtain the model of the terminal device and related device information;
[0015] Step 1-2, communication protocol analysis: the personal computer downloads the supporting software required for communication with the terminal device; after completing the download, connect the personal computer to the terminal device with an Ethernet cable, set the relevant communication parameters, and complete the communication environment deployment; when the personal computer can communicate normally with the terminal device, open the wireshark packet capture software to perform packet capture operations; in order to correctly obtain the field name of the communication protocol, it is necessary to download an open source parsing plug-in to support wireshark's automated protocol parsing; after completing the above operations, the communication protocol packet is captured through a communication operation, and relevant analysis is performed through the parsing of the plug-in.
[0016] Furthermore, the following operations are subdivided in step 2:
[0017] Step 2-1, use of protocol security features: construct the necessary messages for a communication process based on the messages sent during the communication process, analyze the meaning of each field of the necessary messages, and manually construct the messages required for a complete communication process; in the case of a protection mechanism in the message, to prevent replay attacks, it is necessary to take different points through multiple communication processes and understand the field content for analysis. Specifically, terminal devices communicate with each other using a private protocol, which is formulated in accordance with TPKT and ISO8073 standards and uses port 102 / TCP for communication. A large number of communication messages were intercepted by Wireshark, and the comparative analysis showed that the structure of the protocol is divided into three parts: Header, Data, and Trailer. The Header part consists of Protocol ID, PDU-Type, and Data Length bytes. Prootcol ID means the private protocol message header, which occupies one byte. PDU-Type means the type of protocol data unit, which occupies one byte. Data Length means the data length of the message, which occupies two bytes; the Data part includes Opcode, Function, Session ID, and Request Set. Opcode means operation code, which represents the data operation type such as request and response, and occupies one byte. Function means the function that needs to be completed by the message, such as device authentication, device start and stop, and data reception, etc., which occupies two bytes. Session ID represents the session flag. The session flags of different messages increase in chronological order and occupy four bytes. Request Set means the content of the request packet, which contains the specific data to be transmitted. The bytes occupied vary according to the transmission content. The Trailer part means the end of the data frame, and the content is fixed to 72010000, occupying four bytes. In-depth analysis of the request packet content and message structure shows that in order to prevent replay attacks, the protocol specifies a random number in the 25th byte of the sent message during the handshake process. The value of this byte varies between 0x06 and 0x7F. When the data sending device responds, the 24th and 29th bytes in the message are response bytes, and the size of the response value is the random number + 0x80. After analyzing the message structure and content above, when manually constructing a message, pay attention to the Data Length, Opcode, Session ID, and Request Set content structure in the message, as well as the setting of the response byte. (It is relatively general. Is there any specific manual construction and analysis instructions?)
[0018] Step 2-2, penetration program writing: the manually constructed message data is stored in the terminal device in the form of a byte array, and the data is transmitted through the function blocks provided by the programming, so that data communication can be achieved between devices, providing support for the transmission of user programs. Specifically, the program is written in a process-oriented manner, and the handshake process is completed by the function blocks TCON_DB, TSEND_DB and the data block DATA. The configuration parameters and message data in the handshake process are stored in the DATA data block. After the handshake process is completed, the penetration function is written, which is completed by the function blocks READ_DBL and MOVE_BLK. After the test process is completed, the function block DISCON_DB disconnects and completes the test. (Only the data transmission process is explained, and it is not clear how the actual writing is implemented)
[0019] Furthermore, the following operations are subdivided in step 3:
[0020] Step 3-1, program download: After completing the program development in step 2, download the developed test program to the device for functional testing; the scope of the functional test is adjusted according to the needs, including collecting sensitive information such as the target device firmware version, CPU model, and loaded program blocks, and writing scripts for vulnerability testing, denial of service attacks, and replay attacks based on sensitive information. Specifically, when writing this type of script, manually construct the socket function to connect the device. After the connection is completed, write different test functions according to different sensitive information. When conducting vulnerability testing, different methods are used to complete the vulnerability triggering according to different vulnerability types, such as command injection, buffer overflow, etc.; when writing a denial of service attack script, the specific content is written in the form of ARP spoofing. By updating the ARP cache table, a non-existent MAC address record is inserted to match a known IP, resulting in the host being unable to receive data packets and causing a denial of service; when writing a replay attack script, after obtaining the response bytes, write a message with the same content to observe whether the same result is triggered. (Are there specific instructions or implementation processes for writing)
[0021] Step 3-2, device system settings: In order to complete communication with other devices, the terminal device needs to configure relevant communication parameters; when establishing a TCP connection through the TCON system function, the parameter CONNECT needs to be configured; this parameter needs to configure ID, CONNECT_TYPE: 17, ACTIVE_LIST: 1, REM_TASP_ID: 102, REM_STADDR.
[0022] Furthermore, the following operations are subdivided in step 4:
[0023] Step 4-1, experimental environment deployment: connect the terminal device to be tested and the personal computer through a switch to complete the penetration test under the intranet;
[0024] Step 4-2, analysis of returned results: further analyze the data results returned by the test (whether there are specific instructions for the analysis, how to optimize the test program through analysis) to improve the effect of the next test. Specifically, the data results returned by the test are divided into two parts: device sensitive information and program block sensitive information. When performing penetration tests on different types of devices, the returned device sensitive information is partially missing. The test program is optimized and adapted by analyzing the missing parts; in the process of the test program obtaining the program block sensitive information, some sensitive information is not correctly obtained. After analysis, it is found that different devices have different program block identifiers, and the test program is optimized by adding an identifier array.
[0025] Furthermore, in step 4-1, the entire penetration test process is divided into an intranet terminal device scanning phase, a program injection phase, and a result return phase;
[0026] During the intranet terminal device scanning phase, the connection function in the test program is called, an IP start value is set, and the TCON function is called to send data to the IP port. If the data is sent successfully, a terminal device is successfully searched, and then the program is injected into it. If the terminal device has been tested, the TDISCON function is called to disconnect, the scan address is incremented by one, and the TCON function is called again until all terminal devices in the intranet have been tested, the program is terminated, and the test results are returned.
[0027] Furthermore, each stage of the penetration testing process is implemented using structured control language SCL programming.
[0028] Compared with the traditional industrial control system penetration testing method, the present invention has the following beneficial effects:
[0029] (1) Introducing the concept of penetration testing between devices. Penetration testing of industrial control system terminal devices is generally performed through a host computer, which requires manual operation by security personnel. This method converts this process into a program, which is downloaded to the device for operation, saving the time and energy of security personnel. At the same time, since the execution of the program does not require the intervention of security personnel, the test process tends to be automated.
[0030] (2) Performing penetration testing on all terminal devices in the intranet is an important task. The traditional penetration testing method is to collect fingerprint information of each device. If an individual device has a known security defect, the security personnel will select the device for further testing. However, when the present invention is testing, the terminal device that downloads the program has the function of communicating with multiple devices to be tested at the same time, which means that multiple devices can be tested in the same period of time, and all connected devices in the intranet can be tested, which expands the test surface and saves time costs.
[0031] (3) For communication between terminal devices of different brands, manufacturers generally choose a universal communication protocol to write system function blocks. This method can implement penetration testing on terminal devices of different brands in the same intranet by parsing the universal protocol and expanding the test program, thereby improving the scalability of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a flow chart of the penetration testing procedure in an embodiment of the present invention.
[0033] Figure 2 It is a flow chart of message exchange between devices in an embodiment of the present invention.
[0034] Figure 3 This is an industrial control protocol message analysis diagram in an embodiment of the present invention.
[0035] Figure 4 It is a terminal device communication setting diagram under the programming software in an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings.
[0037] This paper proposes an automated penetration test method for industrial control terminal devices. Aiming at the weakness that the host computer is not conducive to automated implementation and has low efficiency in penetration testing, a penetration test method for penetration testing between penetration devices is proposed, which can effectively improve the efficiency of penetration testing of terminal devices in the target network. Specifically, the communication protocol of industrial control systems is generally based on the TCP / IP protocol, and private communication functions are implemented on the communication functions provided by TCP / IP, including terminal device data reading, command issuance, response byte prevention of replay attacks, etc. According to the results of the survey, the current mainstream terminal equipment manufacturers, including Siemens, Rockwell, and Mitsubishi, all provide programming support for TCP / IP communication function blocks for their respective industrial control terminal devices, which provides data support for the actual implementation of this method. The following table is the results of the survey.
[0038] Table 1 Survey of mainstream manufacturers based on TCP / IP functional programming
[0039]
[0040]
[0041] The present invention is an automated penetration testing method for industrial control terminal devices, which aims to implement penetration testing between terminal devices and achieve automated testing results. In terms of theoretical research, penetration testing tools in the traditional IT field tend to be mature and develop rapidly. However, the field of industrial control systems has the characteristics of closedness, proprietaryness, and highly privatized communication protocols between industrial control equipment, which makes existing penetration testing tools difficult to use in industrial control systems, and there are problems such as low efficiency, complex protocol vulnerability detection, and single vulnerability exploitation methods. In response to this problem, the present method introduces the concept of penetration testing between industrial control devices and analyzes the architecture of industrial control protocols, and realizes the development of penetration testing tools for industrial control protocols with communication characteristics, solving the problem that traditional penetration testing tools cannot be used in the field of industrial control. The present method mainly includes the following steps:
[0042] Step 1: Select terminal devices from mainstream industrial control manufacturers and analyze the communication protocols they use;
[0043] Step 2: Analyze the security features in the protocol and develop a penetration testing program suitable for industrial control terminal devices in combination with the programming language of the terminal device;
[0044] Step 3: Based on step 2, download the program to the terminal device and perform relevant system settings on the terminal device, such as communication port, communication ID, etc.
[0045] Step 4: Deploy the experimental environment, perform penetration tests on the devices connected to the intranet, and further optimize the test procedures based on the returned results.
[0046] Step 5: Obtain the optimal test program through multiple optimization iterations and obtain the final test results.
[0047] Specifically, the present invention subdivides the following operations in step 1:
[0048] (1) Terminal device acquisition: Investigate mainstream terminal device manufacturers, select terminal device manufacturers with complete TCP / IP communication functions, and select a terminal device from this manufacturer. The present invention selects a Siemens SIMATIC S7-1200 programmable logic controller (PLC), version V3.2.0.
[0049] (2) Communication protocol analysis: The personal computer downloads the supporting software required for communication with the terminal device, including programming software, debugging software, visualization software, etc. After downloading, use an Ethernet cable to connect the personal computer to the terminal device, set the relevant communication parameters through the debugging software, and complete the communication environment deployment. When the personal computer can communicate normally with the terminal device, open the wireshark packet capture software to perform packet capture operations. In order to correctly obtain the field name of the communication protocol, it is necessary to download an open source parsing plug-in to support wireshark's automatic protocol parsing. After the above operations are completed, the communication protocol packet can be captured through a simple communication operation, and relevant analysis can be performed through the parsing of the plug-in. For the S7-1200V3.2.0 version of the protocol, the enhanced version of the S7 protocol (i.e., the S7+ protocol) is used. Compared with the S7 protocol used by S7-300 and 400 PLCs, the S7+ protocol is designed with a replay attack mechanism, so the analysis of its protocol is more difficult.
[0050] Specifically, the present invention subdivides the following operations in step 2:
[0051] (1) Utilization of protocol security features: Based on the messages sent during the communication process, construct the messages required for a communication process, analyze the meaning of each field of the required message, and try to manually construct the message required for a complete communication process. It should be noted that there may be a protection mechanism in the message to prevent replay attacks. It is necessary to take different points through multiple communication processes and understand the field content for analysis. In the S7+ protocol used in the S7-1200 V3.2.0 version, an anti-replay attack mechanism is introduced. In the PLC's response message, a random changing byte is at a specific offset. In two completely independent communications, the byte responded by the PLC is different, and its size range is 0x06 to 0x7F. In the subsequent data interaction with the PLC, the initiator of the connection establishment needs to use a value equal to the random byte plus 0x80 at the specific offset of its message, otherwise the PLC will directly disconnect and subsequent communication will be impossible.
[0052] (2) Penetration program writing: The manually constructed message data is stored in the terminal device in the form of a byte array, and the data is transmitted through the function blocks provided by the programming. In this way, data communication can be carried out between devices, providing support for the transmission of user programs. The specific port used for communication of Siemens series PLC is 102, so all devices with open port 102 can be used as a proprietary mark to identify Siemens PLC. The entire penetration test process can be divided into the intranet terminal device scanning stage, the program injection stage and the result return stage. The intranet terminal device scanning stage calls the connection function in the test program, sets an IP start value, and calls the TCON function to send data to the IP 102 port. If the data is sent successfully, a Siemens PLC is successfully searched, and then the program is injected into it. If the PLC has been tested, the TDISCON function is called to disconnect the connection, the scan address is incremented by one, and the TCON function is called again until all terminal devices in the intranet have been tested, the program is terminated, and the test results are returned. Each of the above stages is implemented using Structured Control Language (SCL) programming. SCL is a text-based high-level programming language that can handle complex logic well. Specifically, the program is written in a process-oriented manner, and the handshake process is completed by the function blocks TCON_DB, TSEND_DB and the data block DATA. The configuration parameters and message data during the handshake process are stored in the DATA data block. After the handshake process is completed, the penetration function is written and completed by the function blocks READ_DBL and MOVE_BLK. After the test process is completed, the function block DISCON_DB disconnects and the test is completed.
[0053] Specifically, the present invention subdivides the following operations in step 3:
[0054] (1) Program download: After completing the program development in step 2, download the developed test program to the device for functional testing. The scope of the functional test can be adjusted according to the needs, including collecting sensitive information such as the target device firmware version, CPU model, and loaded program blocks, as well as scripting vulnerability testing, denial of service attacks, replay attacks, etc. based on sensitive information.
[0055] (2) Device system settings: In order to complete communication with other devices, the terminal device needs to configure relevant communication parameters. When establishing a TCP connection through the TCON system function, the parameter CONNECT needs to be configured. This parameter needs to be configured with ID (the ID number can be arbitrary, but all related communications must use this ID number), CONNECT_TYPE: 17 (17 represents the communication based on TCP connection), ACTIVE_LIST: 1 (1 represents active connection establishment), REM_TASP_ID: 102 (must be 102, indicating the PLC port address to be connected), REM_STADDR (the starting position of the address scan).
[0056] Specifically, the present invention subdivides the following operations in step 4:
[0057] (1) Experimental environment deployment: Connect the test equipment to the personal computer through a switch to complete the penetration test under the intranet.
[0058] (2) Analysis of returned results: Further analyze the data results returned by the test (whether there are specific instructions for the analysis, and how to optimize the test program through analysis) to improve the effect of the next test. Specifically, the data results returned by the test are divided into two parts: device sensitive information and program block sensitive information. When performing penetration tests on different types of devices, some of the returned device sensitive information is missing. The test program is optimized and adapted by analyzing the missing parts; in the process of the test program obtaining program block sensitive information, some sensitive information is not obtained correctly. After analysis, it is found that different devices have different program block identifiers. The test program is optimized by adding an identifier array.
[0059] Reference Figure 2-4 , the specific operation process is:
[0060] Step 1: Select Siemens S7-1200 V3.2.0 version of programmable logic controller as the terminal device for the experiment; connect the device to the personal computer via Ethernet cable, and configure the relevant environment, including Siemens TIA Portal Totally Integrated Automation software, Siemens WinCC Windows Control Center software, and select the appropriate software version according to the operating system version and device model; configure wireshark with a plug-in that can parse the S7+ protocol. After the device is connected to the personal computer via Ethernet cable, the environment can be successfully set up if the data flow can be captured.
[0061] Step 2: Write the penetration program according to the security characteristics of the communication protocol. The program's operating logic is as follows: Figure 2Specifically, the initiating test device initiates a handshake connection, and completes the acquisition of the feature block after the connection is confirmed. If the feature block of the receiving test device meets the test requirements, a stop request is initiated and a penetration test is performed. After the test is completed, the result is returned and the receiving test device is turned on.
[0062] Step 3: Download the program to the S7-1200 device and make relevant communication settings, such as Figure 3 Specifically, the communication parameters are set according to the message format and message data in the reference protocol. The Data Length in the Header part, the Opcode, Session ID and Request Set content in the Data part are modified according to the current communication. Step 4: Build the experimental environment and make further analysis and improvements based on the results returned by the experiment. The experimental environment configuration is as follows: Figure 4 . Specifically, it is the TCP / IP connection parameter configuration and the IP scanning segment parameter configuration.
[0063] Step 5: Obtain the optimal test program through multiple optimization iterations and obtain the final test results.
[0064] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by ordinary technicians in this field based on the contents disclosed by the present invention should be included in the protection scope recorded in the claims.
Claims
1. An automated penetration testing method for industrial control terminal devices, characterized by: The method comprises the following steps: Step 1, select a terminal device and analyze the communication protocol it uses; Step 2: Analyze the security features in the protocol and develop a penetration test program suitable for industrial control terminal devices in combination with the programming language of the terminal device. The following operations are subdivided in step 2: Step 2-1, use of protocol security features: construct the necessary messages for a communication process based on the messages sent during the communication process, analyze the meaning of each field of the necessary messages, and manually construct the messages required for a complete communication process; in the case of a protection mechanism in the message, to prevent replay attacks, it is necessary to take different points through multiple communication processes and understand the field content for analysis; terminal devices communicate with each other using a private protocol, which is formulated in accordance with TPKT and ISO8073 standards and uses port 102 / TCP for communication; a large number of communication messages are intercepted by Wireshark, and the comparative analysis shows that the structure of the protocol is divided into three parts: Header, Data, and Trailer; the Header part consists of Protocol ID, PDU-Type, and DataLength bytes; Protcol ID means the private protocol message header, which occupies one byte; PDU-Type means the type of protocol data unit, which occupies one byte; Data Length means the data length of the message, which occupies two bytes; the Data part contains Opcode, Function, Session ID, Request Set part; Opcode means operation code, which represents the data operation type and occupies one byte; Function means the function that needs to be completed by the message, which occupies two bytes; Session ID represents the session flag, which increases in chronological order and occupies four bytes; Request Set means the content of the request packet, which contains the specific data to be transmitted, and the bytes occupied vary according to the transmission content; Trailer part means the end of the data frame, and the content is fixed to 72010000, which occupies four bytes; In-depth analysis of the request packet content and message structure shows that in order to prevent replay attacks, the protocol will specify a random number in the 25th byte of the sent message during the handshake process. The value of this byte varies between 0x06 and 0x7F; When the data sending device responds, the 24th and 29th bytes in the message are response bytes, and the size of the response value is the random number + 0x80; After the above analysis of the message structure content, when manually constructing a message, pay attention to the Data Length, Opcode, Session ID and Request Set content construction in the message, as well as the setting of the response byte; Step 2-2, penetration program writing: the manually constructed message data is stored in the terminal device in the form of a byte array, and the data is transmitted through the function blocks provided by the programming, so that data communication can be achieved between devices, providing support for the transmission of user programs; the program is written in a process-oriented way, and the handshake process is completed by the function blocks TCON_DB, TSEND_DB and the data block DATA. The configuration parameters and message data in the handshake process are stored in the DATA data block; After the handshake process is completed, the penetration function is written, which is completed by the function blocks READ_DBL and MOVE_BLK; after the test process is completed, the function block DISCON_DB disconnects and completes the test; Step 3, based on step 2, download the program to the terminal device and perform relevant system settings on the terminal device; the following operations are subdivided in step 3: Step 3-1, program download: After completing the program development in step 2, download the developed test program to the device for functional testing; the scope of the functional test is adjusted according to the needs, including collecting sensitive information such as the firmware version, CPU model, and loaded program blocks of the target device, and writing scripts for vulnerability testing, denial of service attacks, and replay attacks based on the sensitive information; when writing the script, manually construct the socket function to connect the device, and after the connection is completed, write different test functions according to the different sensitive information; when conducting vulnerability testing, different methods are used to complete the vulnerability triggering according to the different vulnerability types; when writing the denial of service attack script, the content is written in the way of ARP spoofing, by updating the ARP cache table, inserting a non-existent MAC address record to match a known IP, resulting in the host being unable to receive the data packet, resulting in a denial of service; when writing the replay attack script, after obtaining the response byte, write a message with the same content to observe whether the same result is triggered; Step 3-2, device system settings: In order to complete the communication with other devices, the terminal device needs to configure relevant communication parameters; when establishing a TCP connection through the TCON system function, the parameter CONNECT needs to be configured; the parameter needs to be configured with ID, CONNECT_TYPE: 17, ACTIVE_LIST: 1, REM_TASP_ID: 102, REM_STADDR; Step 4: Deploy the experimental environment, conduct penetration tests on the devices connected to the intranet, and further optimize the test procedures based on the returned results; Step 5: Obtain the optimal test program through multiple optimization iterations and obtain the final test results.
2. According to claim 1, an automated penetration testing method for industrial control terminal devices is characterized in that: In step 1, the following operations are broken down: Step 1-1, obtain the model of the terminal device and related device information; Step 1-2, communication protocol analysis: the personal computer downloads the supporting software required for communication with the terminal device; after completing the download, connect the personal computer to the terminal device with an Ethernet cable, set the relevant communication parameters, and complete the communication environment deployment; when the personal computer can communicate normally with the terminal device, open the wireshark packet capture software to perform packet capture operations; in order to correctly obtain the field name of the communication protocol, it is necessary to download an open source parsing plug-in to support wireshark's automated protocol parsing; after completing the above operations, the communication protocol packet is captured through a communication operation, and relevant analysis is performed through the parsing of the plug-in.
3. The method for automated penetration testing between industrial control terminal devices according to claim 1, characterized in that: In step 4, the following operations are broken down: Step 4-1, experimental environment deployment: connect the terminal device to be tested and the personal computer through a switch to complete the penetration test under the intranet; Step 4-2, analysis of returned results: further analyze the data results returned by the test to improve the effect of the next test; the data results returned by the test are divided into two parts: device sensitive information and program block sensitive information; when performing penetration tests on different types of devices, the returned device sensitive information is partially missing, and the test program is optimized and adapted by analyzing the missing parts; In the process of the test program obtaining sensitive information of the program block, some sensitive information was not obtained correctly. After analysis, it was found that different devices had different program block identifiers. The test program was optimized by adding an identifier array.
4. The method for automated penetration testing between industrial control terminal devices according to claim 3 is characterized in that: In step 4-1, the entire penetration test process is divided into the intranet terminal device scanning phase, the program injection phase and the result return phase; During the intranet terminal device scanning phase, the connection function in the test program is called, an IP start value is set, and the TCON function is called to send data to the IP port. If the data is sent successfully, a terminal device is successfully searched, and then the program is injected into it. If the terminal device has been tested, the TDISCON function is called to disconnect, the scan address is incremented by one, and the TCON function is called again until all terminal devices in the intranet have been tested, the program is terminated, and the test results are returned.
5. The method for automated penetration testing between industrial control terminal devices according to claim 4, characterized in that: Each stage of the penetration testing process is implemented using structured control language SCL programming.
