Internet of Things firmware dynamic detection method, device, electronic device and storage medium
Dynamically detecting IoT firmware through disassembly tools and cross-architecture simulation models solves the problem in the existing technology that firmware detection relies on physical devices, and achieves more efficient and accurate vulnerability identification and automated detection.
Patent Information
- Application Number
- CN202011006947.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-23
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-09-23
AI Technical Summary
In the existing technology, IoT firmware security detection relies heavily on physical devices, has a low degree of automation, and requires full-system simulation of the device. The simulation is difficult and the simulation architecture support is limited, making it impossible to effectively identify unknown vulnerabilities and open ports.
Use disassembly tools to disassemble IoT firmware, use cross-architecture simulation models to convert hardware devices into cross-architecture simulation firmware, and use vulnerability detection tools to perform vulnerability scans to identify vulnerability data and achieve cross-architecture dynamic detection.
It improves the automation and accuracy of IoT firmware detection, can simulate hardware devices in multiple compilation architectures, discover more vulnerabilities, reduces simulation difficulty and cost, and supports a wider range of firmware architectures.
Smart Images

Figure CN112287342B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer software security detection, and in particular to a method, device, electronic device and storage medium for dynamic detection of IoT firmware. Background Art
[0002] With the rapid development of the Internet of Things and the implementation of relevant laws and standards for the security of the Internet of Things, the Internet of Things terminals have attracted great attention as the weakest link in security. Firmware is an important component in the architecture of IoT devices. Specifically, it refers to the device "driver" stored inside the device. Through firmware, the operating system can implement the operation of a specific machine according to the standard device driver.
[0003] Currently, firmware security detection is divided into two categories: static detection and dynamic detection. Static detection does not require simulation of the firmware or execution of programs in the firmware. It mainly uses large-scale static analysis technology to identify known vulnerabilities and backdoors in the firmware. Dynamic detection usually requires simulation of the firmware at the system level or user level.
[0004] However, existing static firmware detection methods can only identify known vulnerabilities and backdoors, with high false positive and false negative rates, and are unable to perform open port scanning. Existing dynamic detection methods have the following problems: (1) They rely heavily on physical devices and have a low degree of automation; (2) They require full system simulation of the device, which is very difficult, and only support architectures with pre-compiled kernels, such as MIPS (Microprocessor without interlocked piped stages) and ARM (Asynchronous Response Mode). Summary of the invention
[0005] The present application provides a method, device, electronic device and storage medium for dynamic detection of IoT firmware to solve the technical problems in the prior art that firmware security detection relies heavily on physical devices, has a low degree of automation, requires full-system simulation of the device, is very difficult to simulate and has limited support for the simulation architecture.
[0006] In a first aspect, the present application provides a method for dynamic detection of IoT firmware, comprising:
[0007] Use disassembly tools to disassemble the system files of IoT firmware to determine the firmware disassembly files;
[0008] Using a cross-architecture simulation model, converting the hardware device in the IoT firmware into a cross-architecture simulation firmware, wherein the cross-architecture simulation is fixedly used to simulate the hardware device in multiple compilation architectures;
[0009] The cross-architecture simulation firmware is scanned for vulnerabilities using a vulnerability detection tool to determine vulnerability data of the IoT firmware.
[0010] In a possible design, the use of a cross-architecture simulation model to convert the hardware device in the IoT firmware into a cross-architecture simulation firmware includes:
[0011] Determine an initialization file and an executable file according to the firmware disassembly file by using a preset screening algorithm, wherein the initialization file is used to initialize the hardware device and the executable file is used to call the hardware device;
[0012] The cross-architecture simulation firmware is determined by utilizing the cross-architecture simulation model according to the initialization file and the executable file.
[0013] In a possible design, the using of a preset screening algorithm to disassemble the file according to the firmware to determine the initialization file and the executable file includes:
[0014] Filtering the initialization file according to the initialization characteristics of the firmware disassembly file, wherein the initialization characteristics include a file storage path, a file type, a file name, and an initialization process field;
[0015] Determine a file to be selected according to an initial byte of the firmware disassembly file, wherein the initial byte is used to identify an encoding method of the firmware disassembly file;
[0016] The executable file is selected from the candidate files according to the preset data type information of the executable file.
[0017] Optionally, before using the disassembly tool to disassemble the system file of the firmware to determine the firmware disassembly file, the method further includes:
[0018] Use a port scanning tool to scan the first IP open port of the simulation system;
[0019] Correspondingly, after converting the hardware devices in the IoT firmware into the cross-architecture simulation firmware using the cross-architecture simulation model, the method further includes:
[0020] Scanning the second IP open port of the cross-architecture simulation firmware using the port scanning tool, where the number of ports of the second IP open port is greater than or equal to the number of ports of the first IP open port;
[0021] Determine a vulnerable port based on the first IP open port and the second IP open port.
[0022] In a possible design, determining the vulnerable port according to the first IP open port and the second IP open port includes:
[0023] Comparing the first IP open port with the second IP open port, and determining a third IP open port according to the comparison result, wherein the third IP open port is an IP open port in the second IP open port that is different from the first IP open port;
[0024] The vulnerable port is determined according to the third IP open port and the vulnerable port library.
[0025] Optionally, the vulnerable ports include: port 22, port 23, port 80, port 443, port 5280 and port 5555.
[0026] In a possible design, the cross-architecture simulation model is used to determine the cross-architecture simulation firmware according to the firmware disassembly file, including:
[0027] Determine a cross-platform compiled file according to a virtual machine monitor VMM in the cross-architecture simulation model, according to the initialization file and the executable file;
[0028] The host coding file is determined based on the cross-platform compiled file and the current operating system. The host coding file is used to call the service of the current operating system to obtain resources to realize the virtualization of the hardware device corresponding to the firmware. The cross-architecture simulation firmware is the host coding file.
[0029] Optionally, the firmware disassembly file includes: a binary file and a text file;
[0030] Correspondingly, the initialization file and the executable file are binary files.
[0031] In a second aspect, the present application provides an IoT firmware dynamic detection device, comprising:
[0032] A disassembly module, used to disassemble the system files of IoT firmware using a disassembly tool to determine the firmware disassembly files;
[0033] A simulation module, used to convert the hardware device in the IoT firmware into a cross-architecture simulation firmware using a cross-architecture simulation model, wherein the cross-architecture simulation is fixedly used to simulate the hardware device in multiple compilation architectures;
[0034] The vulnerability detection module is used to use a vulnerability detection tool to perform vulnerability scanning on the cross-architecture simulation firmware to determine vulnerability data of the Internet of Things firmware.
[0035] In a possible design, the simulation module is used to convert the hardware device in the IoT firmware into the cross-architecture simulation firmware using the cross-architecture simulation model, including:
[0036] The simulation module is used to determine an initialization file and an executable file according to the firmware disassembly file by using a preset screening algorithm, wherein the initialization file is used to initialize the hardware device and the executable file is used to call the hardware device;
[0037] The simulation module is also used to use the cross-architecture simulation model to determine the cross-architecture simulation firmware according to the initialization file and the executable file.
[0038] In a possible design, the simulation module is used to determine the initialization file and the executable file according to the firmware disassembly file by using a preset screening algorithm, including:
[0039] The simulation module is used to filter out the initialization file according to the initialization characteristics of the firmware disassembly file, wherein the initialization characteristics include a file storage path, a file type, a file name, and an initialization process field;
[0040] The simulation module is further used to determine a file to be selected according to an initial byte of the firmware disassembly file, wherein the initial byte is used to identify an encoding method of the firmware disassembly file;
[0041] The simulation module is further used to filter out the executable file from the candidate files according to the preset data type information of the executable file.
[0042] Optionally, before the disassembly module is used to disassemble the system file of the IoT firmware using a disassembly tool to determine the firmware disassembly file, it also includes:
[0043] A port scanning module, used for scanning the first IP open port of the simulation system using a port scanning tool;
[0044] Correspondingly, after the simulation module is used to convert the hardware devices in the IoT firmware into cross-architecture simulation firmware using the cross-architecture simulation model, it also includes:
[0045] The port scanning module is further used to use the port scanning tool to scan the second IP open port of the cross-architecture simulation firmware, and the number of ports of the second IP open port is greater than or equal to the number of ports of the first IP open port;
[0046] The vulnerability detection module is further used to determine the vulnerable port according to the first IP open port and the second IP open port.
[0047] In a possible design, the vulnerability detection module is further used to determine the vulnerable port according to the first IP open port and the second IP open port, including:
[0048] The vulnerability detection module is further used to compare the first IP open port with the second IP open port, and determine a third IP open port according to the comparison result, wherein the third IP open port is an IP open port in the second IP open port that is different from the first IP open port;
[0049] The vulnerability detection module is further used to determine the vulnerable port according to the third IP open port and the vulnerable port library.
[0050] Optionally, the vulnerable ports include: port 22, port 23, port 80, port 443, port 5280 and port 5555.
[0051] In a possible design, the simulation module is used to convert the hardware device in the IoT firmware into the cross-architecture simulation firmware using the cross-architecture simulation model, including:
[0052] The simulation module is used to determine a cross-platform compiled file according to the virtual machine monitor VMM in the cross-architecture simulation model, according to the initialization file and the executable file;
[0053] The simulation module is also used to determine the host encoding file based on the cross-platform compiled file and the current operating system. The host encoding file is used to call the services of the current operating system to obtain resources to achieve hardware device virtualization corresponding to the firmware. The cross-architecture simulation firmware is the host encoding file.
[0054] Optionally, the firmware disassembly file includes: a binary file and a text file;
[0055] Correspondingly, the initialization file and the executable file are binary files.
[0056] In a third aspect, the present application provides an electronic device, including:
[0057] A memory for storing program instructions;
[0058] The processor is used to call and execute the program instructions in the memory to execute any possible Internet of Things firmware dynamic detection method provided by the first aspect.
[0059] In a fourth aspect, the present application provides a storage medium, wherein the readable storage medium stores a computer program, and the computer program is used to execute any possible IoT firmware dynamic detection method provided in the first aspect.
[0060] The present application provides a method, device, electronic device and storage medium for dynamic detection of IoT firmware. The method disassembles the system files of IoT firmware using a disassembly tool to determine the firmware disassembly file, then uses a cross-architecture simulation model to convert the hardware devices in the IoT firmware into cross-architecture simulation firmware, and finally uses a vulnerability detection tool to perform vulnerability scanning on the cross-architecture simulation firmware to determine the vulnerability data of the IoT firmware. The method solves the technical problems in the prior art that firmware security detection relies heavily on physical devices, has a low degree of automation, requires full system simulation of the device, is very difficult to simulate and has limited simulation architecture support, and realizes dynamic detection of IoT firmware through cross-architecture, achieving the technical effect of more efficiently and accurately discovering IoT firmware vulnerabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0062] Figure 1 A schematic diagram of the structural principle of the Internet of Things system provided for this application;
[0063] Figure 2 A flowchart of a method for dynamic detection of IoT firmware provided by this application;
[0064] Figure 3 A flowchart of another method for dynamic detection of IoT firmware provided by this application;
[0065] Figure 4 A schematic diagram of the structure of a dynamic detection device for IoT firmware provided by this application;
[0066] Figure 5 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work, including but not limited to the combination of multiple embodiments, belong to the scope of protection of this application.
[0068] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0069] The following is an explanation and introduction of the professional terms involved in the embodiments of the present application.
[0070] Firmware is an important component in the architecture of IoT devices. Specifically, it refers to the device "driver" stored inside the device. Through firmware, the operating system can implement the operation of a specific machine according to the standard device driver. Firmware is the software that performs the most basic and lowest-level work of a system. In hardware devices, firmware is the soul of the hardware device, because some hardware devices have no other software components except firmware, so firmware also determines the function and performance of the hardware device.
[0071] At present, firmware security detection is divided into two categories: static detection and dynamic detection. Static detection does not require simulation of firmware or execution of programs in firmware. It is represented by LAVA (Linaro Automated Validation Architecture). It mainly uses large-scale static analysis technology to identify known vulnerabilities and backdoors in firmware. Dynamic detection usually requires simulation of firmware at the system level or user level. It is represented by Avatar and Firmadyne. Avatar is a framework for coordinating communication between emulators and physical devices, and Firmadyne uses Qemu's system mode to simulate the firmware in the entire system.
[0072] However, the existing static firmware detection methods can only identify known vulnerabilities and backdoors, with high false positive and false negative rates, and cannot perform open port scanning. The existing dynamic detection methods have the following problems: Avatar relies heavily on physical devices and has a low degree of automation; Firmadyne requires full system simulation of the device, which is very difficult, and only supports the architecture of its pre-compiled kernel, such as MIPS (Microprocessor without interlocked piped stages) or ARM (Asynchronous Response Mode). Currently, only routers with MIPS architecture can be well supported.
[0073] In addition, dynamic detection also includes discovering new vulnerabilities through fuzz testing. The fuzz testing method is mainly used to determine whether there is a vulnerability by monitoring whether the program crashes. After investigation, it was found that most of the vulnerabilities in IoT devices are logical vulnerabilities, such as XSS and authentication bypass. These vulnerabilities will not cause system crashes, so it is difficult to discover such problems using fuzz testing technology. In addition, the crashes caused by fuzz testing require professional analysis and are difficult to automate.
[0074] To this end, the invention object of this application is to solve the following problems:
[0075] (1) The problem of high false alarm and missed alarm rates in static detection;
[0076] (2) It is difficult to simulate the entire device system;
[0077] (3) The dynamic detection system architecture does not fully support the problem;
[0078] (4) Fuzz testing generates crashes that require professional analysis and are difficult to automate;
[0079] (5) The user mode emulation method cannot obtain the firmware IP, so port scanning and vulnerability scanning cannot be performed.
[0080] Figure 1 This is a schematic diagram of the structural principle of the Internet of Things system provided in this application. Figure 1As shown, the IoT system generally includes: operating system 110, driver software 111, hardware device 120, and firmware 121. The operating system 110 cannot directly control the hardware device, and needs to interact with the underlying driver software 111 for data. In order for the hardware device to be better utilized by the operating system, it is necessary to use the firmware 121 as an intermediate medium to achieve handshake with the driver software 111, so that the IoT operating system 110 can call the hardware device 120 to complete various IoT tasks. It is understandable that one firmware 121 may correspond to multiple hardware devices. Since the firmware must provide an open IP port to the driver so that the operating system can call the hardware device, and the firmware also needs to have resource configuration logic for the hardware device, these two aspects are the key directions for troubleshooting security risks and vulnerabilities.
[0081] Since any firmware is built in a certain organizational form, namely architecture, and different architectures have different IP port opening logic and resource allocation logic, this brings a natural shielding barrier to firmware security detection. Since open source architectures are easily targeted, most architectures add their own independent elements on the basis of open source architectures, which makes the same open source architecture form multiple branch systems. Existing firmware security detection must pre-configure architecture information to support the firmware vulnerability detection needs under the architecture.
[0082] The inventive concept of this application is to look at the firmware from another perspective. According to the general logic of IP port opening and resource allocation, the firmware file is disassembled and reorganized at the bottom level, just like disassembling the human nervous system, extracting and reorganizing the nerve cells, and fully revealing the internal logic that was originally wrapped and protected, which makes it easier to expose the security vulnerabilities of the firmware. The key point of the reorganization is to be able to screen and extract the effective logic blocks that play the role of "neurons" from the disassembled program blocks.
[0083] Figure 2 A flowchart of a method for dynamic detection of IoT firmware provided by this application. Figure 2 As shown, the IoT firmware dynamic detection method provided by the embodiment of the present application comprises the following specific steps:
[0084] S201. Disassemble the system files of the IoT firmware using a disassembly tool to determine the firmware disassembly files.
[0085] In this embodiment, this step specifically includes:
[0086] Performing a reverse logic link test on the IoT firmware to be processed using an architecture detection tool, wherein the architecture detection tool includes preset test process data and detection simulation data;
[0087] Determine the architecture type involved based on the test results;
[0088] Selecting a corresponding disassembly algorithm according to the architecture type;
[0089] The IoT firmware is disassembled using the disassembly algorithm to determine a firmware disassembly file.
[0090] For example, for an IoT firmware to be processed, the ARM architecture test process and the corresponding test data are input into the IoT firmware to detect whether it can obtain the corresponding preset test results, such as whether the response result to a specific IP development port meets the preset response result of the ARM architecture. If not, the X86 architecture test is performed again until an architecture that meets the requirements is detected.
[0091] In a possible design, the architecture compliance can also be calculated through testing, and the judgment can be made based on whether the architecture compliance meets the preset threshold of the corresponding architecture, or based on the ranking of the architecture compliance, the architecture with the highest compliance or the architecture with a compliance ranking within the preset ranking can be selected to determine the architecture type of the IoT firmware.
[0092] Then you can use the disassembly algorithm or open source extraction tools such as Binwalk firmware decompression tool to disassemble and decompress to obtain the firmware disassembly file. It should be noted that the firmware disassembly file can include multiple file types, such as binary files, hexadecimal files, assembly files, text files, dos files, etc., or special format files preset corresponding to the disassembly algorithm or disassembly tool.
[0093] S202: Using a cross-architecture simulation model, convert the hardware devices in the IoT firmware into a cross-architecture simulation firmware.
[0094] In this step, cross-architecture simulation is used to simulate the hardware device in multiple compilation architectures.
[0095] Specifically, they include:
[0096] Using a preset screening algorithm, according to the firmware disassembly file, an initialization file and an executable file are determined, wherein the initialization file is used to initialize the hardware device and the executable file is used to call the hardware device;
[0097] The cross-architecture simulation model is used to determine the cross-architecture simulation firmware according to the initialization file and the executable file.
[0098] For example, initialization files generally have a fixed storage path or naming format such as init, so you only need to find the corresponding code segment for a specific path or name, and then filter these code segments according to the organization format corresponding to the architecture to filter out the initialization file. The types of executable files include x-executable types, so you only need to find the corresponding x-executable type file's corresponding starting coding segment or code with specific characteristics in the firmware disassembly file to filter out the executable file.
[0099] It should be noted that the executable file is the most basic logical structure in the entire firmware, because there will be files that call other library functions in the firmware. These files cannot play a decisive role in security detection and will also hinder subsequent cross-platform simulation. Therefore, only the executable files need to be filtered out. The initialization file is used to define the initialization state of the firmware. It is also an indispensable file of the firmware, so it also needs to be filtered out.
[0100] The role of the cross-architecture simulation model is to enable the initialization file and executable file to execute the resource allocation logic and IP port opening logic of the firmware to be processed in the operating system environment of the simulation system. It is equivalent to reorganizing the firmware execution logic file, so that it is no longer limited by the original architecture, thus achieving the role of cross-architecture. The so-called simulation is to reproduce the original functions of the firmware to be processed on another platform that is not constrained by the firmware architecture under the same logic algorithm, and establish a virtual firmware model.
[0101] S203: Use a vulnerability detection tool to perform vulnerability scanning on the cross-architecture simulation firmware to determine vulnerability data of the IoT firmware.
[0102] In this embodiment, for common vulnerability types in firmware, they are divided into logical vulnerabilities (XSS, authentication bypass) and memory vulnerabilities (buffer overflows), vulnerability detection tools such as the vulnerability exploitation module of the metasploit tool are used to query the corresponding vulnerability exploits and generate a vulnerability exploitation list. Then, the cross-architecture Founder firmware is used to execute the vulnerability exploitation program in the vulnerability exploitation list, and the corresponding vulnerability data can be detected, so that it can be determined whether the corresponding IoT firmware has the corresponding vulnerability.
[0103] This embodiment provides a method for dynamic detection of IoT firmware, which uses a disassembly tool to disassemble the system file of the IoT firmware to determine the firmware disassembly file, then uses a cross-architecture simulation model to convert the hardware devices in the IoT firmware into cross-architecture simulation firmware, and finally uses a vulnerability detection tool to perform vulnerability scanning on the cross-architecture simulation firmware to determine the vulnerability data of the IoT firmware. This solves the technical problems in the prior art that firmware security detection heavily relies on physical devices, has a low degree of automation, requires full system simulation of the device, is very difficult to simulate, and has limited simulation architecture support, and realizes dynamic detection of IoT firmware through cross-architecture, achieving the technical effect of more efficiently and accurately discovering IoT firmware vulnerabilities.
[0104] Figure 3 A flowchart of another method for dynamic detection of IoT firmware provided by this application. Figure 3 As shown, the specific steps of the IoT firmware dynamic detection method include:
[0105] S301, using a port scanning tool to scan the first IP open port of the simulation system.
[0106] In this embodiment, in order to identify the IP open port of the Internet of Things firmware in the user layer simulation mode, it is necessary to perform two IP open port scans in the system executing the simulation program to exclude the IP open port of the system executing the simulation program itself, that is, the first IP open port.
[0107] S302: Disassemble the system files of the IoT firmware using a disassembly tool to determine the firmware disassembly files.
[0108] This step is similar to S201. For detailed principles and terminology explanations, please refer to S201 and will not be repeated here.
[0109] It should be noted that, in this embodiment, the firmware disassembly file includes: a binary file and a text file.
[0110] S303: Filter out initialization files according to initialization features of the firmware disassembly files.
[0111] In this step, the initialization features include file storage path, file type, file name, and initialization process fields.
[0112] For example, the initialization binary file usually exists in the process " / sbin / init". You can then look for features related to the corresponding " / sbin / init" process, such as code segments, specific call files, etc., and filter out the corresponding initialization binary file based on the relevant initialization features.
[0113] S304: Determine a file to be selected according to the initial bytes of the firmware disassembly file.
[0114] In this step, the initial byte is used to identify the encoding method of the firmware disassembly file, and the selected file includes an executable file.
[0115] In this embodiment, the files to be selected are binary files. Since the firmware disassembly files in this embodiment are divided into two categories: binary files and text files, and the executable files are binary files, all text files need to be eliminated.
[0116] Specifically, the initial bytes of a text file contain a BOM header to identify the encoding method used for the file, while a binary file does not contain a BOM header. Therefore, first exclude files whose initial bytes contain a BOM, such as UTF-32BE, UTF-32LE, UTF-16BE, UTF-16LE, and UTF-8.
[0117] It should be noted that although there is a UTF-8 type BOM, BOM is mainly prepared for UTF-16 and UTF-18. Most standard UTF-8 encoded files do not have a BOM header. Therefore, only excluding files with a BOM header may miss UTF-8 encoded text files. Based on this, it is necessary to further query whether the initial byte of the file contains '\0'. From the UTF-8 encoding method, it can be seen that it does not contain zero bytes. Therefore, as long as zero bytes are scanned in the file, it can be determined that it is a binary file.
[0118] It should be noted that BOM is a marker used to determine which Unicode encoding a text file is. It itself is a Unicode character ("\uFEFF") located at the header of a text file.
[0119] S305: Filter out executable files from the candidate files according to preset data type information of the executable files.
[0120] In this embodiment, the files to be selected mainly include x-executable executable files, x-sharedlib link libraries, octet-stream dynamic streams, and x-object objects, among which the system function library functions are all in the format of link libraries. In order to improve the simulation efficiency and eliminate the dependence on the architecture and physical devices, the library functions are not dynamically simulated, and only the simulation of executable files is considered, that is, only x-executable executable files are filtered.
[0121] S306: Determine the cross-architecture simulation firmware according to the firmware disassembly file by using the cross-architecture simulation model.
[0122] In this embodiment, it specifically includes:
[0123] A cross-platform compilation file is determined according to a virtual machine monitor VMM, an initialization file and an executable file in a cross-architecture simulation model.
[0124] According to the cross-platform compiled file and the current operating system, a host coding file is determined. The host coding file is used to call the service of the current operating system to obtain resources to realize the virtualization of the hardware device corresponding to the firmware. The cross-architecture simulation firmware is the host coding file.
[0125] Specifically, open source cross-architecture binary simulation tools such as Qiling framework and unicorn are used to simulate the selected initialization binary files and executable binary files. The architecture of the cross-architecture binary simulation tools is implemented by pure software, and the IoT firmware compiled by a certain architecture can be run on the architecture of the simulation system in the form of virtualization VMM. VMM acts as an intermediate medium, calling the service process of the operating system of the simulation system to obtain resources, and realizes the virtualization of CPU, memory and I / O devices. The virtualization is mainly implemented by reorganizing and translating the initialization binary files and executable binary files into intermediate codes, i.e., cross-platform compiled files, and then compiling the intermediate codes according to the simulation system, i.e., the current operating system, i.e., compiling them into codes that can be recognized and run by the simulation system, i.e., host codes.
[0126] S307 , using a port scanning tool to scan the second IP open port of the cross-architecture simulation firmware.
[0127] In this step, the number of ports opened by the second IP is greater than or equal to the number of ports opened by the first IP.
[0128] Specifically, after obtaining the cross-architecture simulation firmware, run the cross-architecture simulation firmware in the simulation system for simulation, and then scan it with a port scanning tool to obtain the second IP open port. At this time, the scanned second IP open port includes the first IP open port that comes with the simulation system, and the IP development port included in the cross-architecture simulation firmware, that is, the third IP open port.
[0129] S308. Determine the vulnerable port according to the first IP open port and the second IP open port.
[0130] This step specifically includes:
[0131] Comparing the first IP open port with the second IP open port, and determining a third IP open port according to the comparison result, wherein the third IP open port is an IP open port in the second IP open port that is different from the first IP open port;
[0132] The vulnerable port is determined according to the third IP open port and the vulnerable port library.
[0133] It should be noted that the vulnerable ports include: port 22, port 23, port 80, port 443, port 5280 and port 5555.
[0134] It should also be noted that the vulnerability port library can be maintained independently and updated regularly, so that the types of vulnerable ports can be continuously enriched and the vulnerabilities of IoT firmware can be detected more accurately.
[0135] Specifically, use a port scanning tool (such as nmap) to scan the IP open ports of the simulation system. After using the binary simulation tool to simulate and execute the initialization file, use the port scanning tool again to scan the IP open ports of the simulation system. Compare the results of the two port scans, and the extra open ports are considered to be the open ports after the firmware starts the service. Determine whether the scanned open ports contain the most common vulnerable port types such as port 22, port 23, port 80, port 443, port 5280, and port 5555.
[0136] S309: Use vulnerability detection tools to perform vulnerability scanning on the cross-architecture simulation firmware to determine vulnerability data of the IoT firmware.
[0137] In this embodiment, for common vulnerability types in firmware, they are divided into logical vulnerabilities (XSS, authentication bypass) and memory vulnerabilities (buffer overflows), vulnerability detection tools such as the vulnerability exploitation module of the metasploit tool are used to query the corresponding vulnerability exploits and generate a vulnerability exploitation list. Then, the cross-architecture Founder firmware is used to execute the vulnerability exploitation program in the vulnerability exploitation list, and the corresponding vulnerability data can be detected, so that it can be determined whether the corresponding IoT firmware has the corresponding vulnerability.
[0138] It should be noted that the firmware dynamic detection method of this embodiment supports CPU architectures including X86, X86_64, Arm, Arm64, MIPS, etc.
[0139] This embodiment provides a method for dynamic detection of IoT firmware, which uses a disassembly tool to disassemble the system file of the IoT firmware to determine the firmware disassembly file, then uses a cross-architecture simulation model to convert the hardware devices in the IoT firmware into cross-architecture simulation firmware, and finally uses a vulnerability detection tool to perform vulnerability scanning on the cross-architecture simulation firmware to determine the vulnerability data of the IoT firmware. This solves the technical problems in the prior art that firmware security detection heavily relies on physical devices, has a low degree of automation, requires full system simulation of the device, is very difficult to simulate, and has limited simulation architecture support, and realizes dynamic detection of IoT firmware through cross-architecture, achieving the technical effect of more efficiently and accurately discovering IoT firmware vulnerabilities.
[0140] This embodiment does not require full system simulation firmware, and the entire firmware can be analyzed and detected through the binary file of the firmware file system. For the screening of executable binary files, the x-executable file type is directly matched, and the system library can be directly excluded. In order to solve the problem that the firmware IP cannot be obtained by running only the binary file, this patent uses a method of scanning the host machine IP twice and then comparing the ports to detect open ports, and uses an open source vulnerability exploitation library. After the vulnerability is successfully exploited, it is determined that the vulnerability exists, and the known vulnerabilities are scanned to solve the problem that crashes obtained through fuzz testing require professional analysis and are difficult to automate, and logical vulnerabilities are difficult to discover by capturing crashes.
[0141] Figure 4 This is a schematic diagram of the structure of a device for dynamic detection of firmware of the Internet of Things provided in this application. The device for dynamic detection of firmware of the Internet of Things 400 can be implemented by software, hardware or a combination of both.
[0142] like Figure 4 As shown, the IoT firmware dynamic detection device 400 includes:
[0143] The disassembly module 401 is used to disassemble the system file of the IoT firmware using a disassembly tool to determine the firmware disassembly file;
[0144] A simulation module 402, used to convert the hardware device in the IoT firmware into a cross-architecture simulation firmware using a cross-architecture simulation model, wherein the cross-architecture simulation is fixedly used to simulate the hardware device in multiple compilation architectures;
[0145] The vulnerability detection module 403 is used to use a vulnerability detection tool to perform vulnerability scanning on the cross-architecture simulation firmware to determine vulnerability data of the Internet of Things firmware.
[0146] In a possible design, the simulation module 402 is used to convert the hardware device in the IoT firmware into a cross-architecture simulation firmware using a cross-architecture simulation model, including:
[0147] The simulation module 402 is used to determine an initialization file and an executable file according to the firmware disassembly file by using a preset screening algorithm, wherein the initialization file is used to initialize the hardware device and the executable file is used to call the hardware device;
[0148] The simulation module 402 is further configured to utilize the cross-architecture simulation model to determine the cross-architecture simulation firmware according to the initialization file and the executable file.
[0149] In a possible design, the simulation module 402 is used to use a preset screening algorithm to determine the initialization file and the executable file according to the firmware disassembly file, including:
[0150] The simulation module 402 is used to filter out the initialization file according to the initialization characteristics of the firmware disassembly file, wherein the initialization characteristics include a file storage path, a file type, a file name, and an initialization process field;
[0151] The simulation module 402 is further used to determine a candidate file according to the initial bytes of the firmware disassembly file, wherein the initial bytes are used to identify the encoding method of the firmware disassembly file;
[0152] The simulation module 402 is further configured to filter out the executable file from the candidate files according to the preset data type information of the executable file.
[0153] Optionally, before the disassembly module 401 is used to disassemble the system file of the IoT firmware using a disassembly tool to determine the firmware disassembly file, it also includes:
[0154] A port scanning module 404 is used to scan the first IP open port of the simulation system using a port scanning tool;
[0155] Correspondingly, after the simulation module 402 is used to convert the hardware devices in the IoT firmware into cross-architecture simulation firmware using a cross-architecture simulation model, it also includes:
[0156] The port scanning module 404 is further used to use the port scanning tool to scan the second IP open port of the cross-architecture simulation firmware, and the port number of the second IP open port is greater than or equal to the port number of the first IP open port;
[0157] The vulnerability detection module 403 is further configured to determine a vulnerable port according to the first IP open port and the second IP open port.
[0158] In a possible design, the vulnerability detection module 403 is further used to determine the vulnerable port according to the first IP open port and the second IP open port, including:
[0159] The vulnerability detection module 403 is further configured to compare the first IP open port with the second IP open port, and determine a third IP open port according to the comparison result, wherein the third IP open port is an IP open port in the second IP open port that is different from the first IP open port;
[0160] The vulnerability detection module 403 is further configured to determine the vulnerable port according to the third IP open port and the vulnerable port library.
[0161] Optionally, the vulnerable ports include: port 22, port 23, port 80, port 443, port 5280 and port 5555.
[0162] In a possible design, the simulation module 402 is used to convert the hardware device in the IoT firmware into a cross-architecture simulation firmware using a cross-architecture simulation model, including:
[0163] The simulation module 402 is used to determine a cross-platform compiled file according to the virtual machine monitor VMM in the cross-architecture simulation model, according to the initialization file and the executable file;
[0164] The simulation module 402 is also used to determine the host encoding file based on the cross-platform compiled file and the current operating system. The host encoding file is used to call the service of the current operating system to obtain resources to realize the virtualization of the hardware device corresponding to the firmware. The cross-architecture simulation firmware is the host encoding file.
[0165] Optionally, the firmware disassembly file includes: a binary file and a text file;
[0166] Correspondingly, the initialization file and the executable file are binary files.
[0167] It is worth mentioning that Figure 4 The IoT firmware dynamic detection device provided in the illustrated embodiment can execute the method provided in any of the above-mentioned method embodiments. Its specific implementation principles, technical features, professional terminology explanations and technical effects are similar and will not be repeated here.
[0168] Figure 5 This is a schematic diagram of the structure of an electronic device provided in this application. Figure 5 As shown, the electronic device 500 may include: at least one processor 501 and a memory 502 . Figure 5An electronic device is shown using a processor as an example.
[0169] The memory 502 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer operation instructions.
[0170] The memory 502 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0171] The processor 501 is used to execute the computer-executable instructions stored in the memory 502 to implement the methods described in the above method embodiments.
[0172] The processor 501 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0173] Optionally, the memory 502 may be independent or integrated with the processor 501. When the memory 502 is a device independent of the processor 501, the electronic device 500 may further include:
[0174] The bus 503 is used to connect the processor 501 and the memory 502. The bus may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.
[0175] Optionally, in a specific implementation, if the memory 502 and the processor 501 are integrated on a chip, the memory 502 and the processor 501 can communicate through an internal interface.
[0176] The present application also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used for the methods in the above-mentioned method embodiments.
[0177] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for dynamic detection of IoT firmware, characterized in that: include: Use disassembly tools to disassemble the system files of IoT firmware to determine the firmware disassembly files; Using a cross-architecture simulation model, converting the hardware device in the IoT firmware into a cross-architecture simulation firmware, wherein the cross-architecture simulation is fixedly used to simulate the hardware device in multiple compilation architectures; Perform vulnerability scanning on the cross-architecture simulation firmware using a vulnerability detection tool to determine vulnerability data of the IoT firmware; The method of converting the hardware device in the IoT firmware into a cross-architecture simulation firmware by using a cross-architecture simulation model includes: Determine an initialization file and an executable file according to the firmware disassembly file by using a preset screening algorithm, wherein the initialization file is used to initialize the hardware device and the executable file is used to call the hardware device; The cross-architecture simulation firmware is determined by utilizing the cross-architecture simulation model according to the initialization file and the executable file.
2. The method for dynamic detection of IoT firmware according to claim 1, characterized in that: The method of using a preset screening algorithm to disassemble the firmware file and determine the initialization file and the executable file includes: Filtering the initialization file according to the initialization characteristics of the firmware disassembly file, wherein the initialization characteristics include a file storage path, a file type, a file name, and an initialization process field; Determine a file to be selected according to an initial byte of the firmware disassembly file, wherein the initial byte is used to identify an encoding method of the firmware disassembly file; The executable file is selected from the candidate files according to the preset data type information of the executable file.
3. The method for dynamic detection of IoT firmware according to claim 1 or 2, characterized in that: Before the method of using the disassembly tool to disassemble the system file of the firmware to determine the firmware disassembly file, the method further includes: Use a port scanning tool to scan the first IP open port of the simulation system; Correspondingly, after converting the hardware devices in the IoT firmware into the cross-architecture simulation firmware using the cross-architecture simulation model, the method further includes: Scanning the second IP open port of the cross-architecture simulation firmware using the port scanning tool, where the number of ports of the second IP open port is greater than or equal to the number of ports of the first IP open port; Determine a vulnerable port based on the first IP open port and the second IP open port.
4. The method for dynamic detection of IoT firmware according to claim 3, characterized in that: The determining the vulnerable port according to the first IP open port and the second IP open port includes: Comparing the first IP open port with the second IP open port, and determining a third IP open port according to the comparison result, wherein the third IP open port is an IP open port in the second IP open port that is different from the first IP open port; The vulnerable port is determined according to the third IP open port and the vulnerable port library.
5. The method for dynamic detection of IoT firmware according to claim 4, characterized in that: The vulnerable ports include: port 22, port 23, port 80, port 443, port 5280 and port 5555.
6. The method for dynamic detection of IoT firmware according to claim 2, characterized in that: The method of using the cross-architecture simulation model and determining the cross-architecture simulation firmware according to the firmware disassembly file includes: Determine a cross-platform compiled file according to the virtual machine monitor VMM in the cross-architecture simulation model, the initialization file and the executable file; According to the cross-platform compiled file and the current operating system, a host coding file is determined. The host coding file is used to call the service of the current operating system to obtain resources to realize the virtualization of the hardware device corresponding to the firmware. The cross-architecture simulation firmware is the host coding file.
7. The method for dynamic detection of IoT firmware according to any one of claims 1 to 2 and 6, characterized in that: The firmware disassembly files include: binary files and text files; Correspondingly, the initialization file and the executable file are binary files.
8. A dynamic detection device for IoT firmware, characterized in that: include: A disassembly module, used to disassemble the system files of IoT firmware using a disassembly tool to determine the firmware disassembly files; A simulation module, used to convert the hardware device in the IoT firmware into a cross-architecture simulation firmware using a cross-architecture simulation model, wherein the cross-architecture simulation is fixedly used to simulate the hardware device in multiple compilation architectures; A vulnerability detection module, used to perform vulnerability scanning on the cross-architecture simulation firmware using a vulnerability detection tool to determine vulnerability data of the IoT firmware; The simulation module is specifically used to use a preset screening algorithm to determine an initialization file and an executable file according to the firmware disassembly file, wherein the initialization file is used to initialize the hardware device and the executable file is used to call the hardware device; The cross-architecture simulation firmware is determined by utilizing the cross-architecture simulation model according to the initialization file and the executable file.
9. An electronic device, characterized in that: include: processor; as well as, A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the method for dynamic detection of IoT firmware according to any one of claims 1 to 7 by executing the executable instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for dynamic detection of IoT firmware according to any one of claims 1 to 7 is implemented.
