A safety detection method and device
By extracting firmware features and matching them with the vulnerability database, the problem of poor applicability and reliability of firmware security detection technology is solved, and efficient vulnerability detection of firmware in multiple architectures or code formats is achieved, improving the accuracy of detection results.
Patent Information
- Application Number
- CN202110005308.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-05
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-01-05
AI Technical Summary
The applicability and reliability of firmware security detection technology in the prior art is poor, it is difficult to obtain firmware information and the information does not match the actual function, resulting in missed or missed detection, and is not suitable for firmware in multiple architectures or code formats.
By extracting the firmware features of the firmware, including third-party library information, and matching it with the preset vulnerability information database, similarity detection is performed, and vulnerability prompt information is output to improve the applicability and reliability of the detection.
Improves the applicability and reliability of firmware vulnerability detection, is suitable for firmware in multiple architectures or code formats, reduces missed and missed detection, and enhances the accuracy of detection results.
Smart Images

Figure CN114780960B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology of Internet of Things, and in particular to a security detection method and device. Background Art
[0002] As embedded IoT devices are increasingly used, the security of the firmware in the embedded IoT devices is crucial to the security of the IoT.
[0003] In the related technology, security detection technology can be used to detect the security of the firmware to find vulnerabilities in the firmware, so that users can discover and reinforce the vulnerabilities in time. For example, security detection technologies such as feature matching, binary difference detection, fuzzy hashing or third-party library detection are used to detect the security of the firmware.
[0004] However, security detection technology in related technologies often needs to detect firmware vulnerabilities based on firmware information such as firmware version, manufacturer, interface function, etc. However, the firmware information in related technologies is difficult to obtain, and the obtained firmware information often does not match the actual function of the firmware, resulting in poor applicability and reliability of firmware security detection technology. Summary of the invention
[0005] The embodiments of the present invention provide a security detection method and device, which can solve the problems of poor applicability and reliability of firmware security detection technology in related technologies.
[0006] To solve the above technical problems, the present invention is achieved as follows:
[0007] In a first aspect, an embodiment of the present invention provides a security detection method, the method comprising:
[0008] Acquire target firmware, and extract firmware features of the target firmware, wherein the firmware features include third-party library information called by the target firmware;
[0009] Based on the firmware features, matching the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database to obtain a first similarity, wherein the preset vulnerability information database includes information of the target third-party library with disclosed vulnerabilities in the preset vulnerability library;
[0010] Based on the firmware features, performing firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library to obtain a second similarity;
[0011] The second similarity is adjusted based on the first similarity to obtain a target similarity, and when the target similarity is greater than or equal to a similarity threshold, vulnerability prompt information is output, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library.
[0012] In a second aspect, an embodiment of the present invention provides a safety detection device, the device comprising:
[0013] An acquisition module, used to acquire a target firmware and extract firmware features of the target firmware, wherein the firmware features include third-party library information called by the target firmware;
[0014] A matching module, configured to match the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database based on the firmware feature to obtain a first similarity, wherein the preset vulnerability information database includes information of the target third-party library with disclosed vulnerabilities in the preset vulnerability library;
[0015] A detection module, configured to perform firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library based on the firmware feature, so as to obtain a second similarity;
[0016] An output module is used to adjust the second similarity based on the first similarity to obtain a target similarity, and output vulnerability prompt information when the target similarity is greater than or equal to a similarity threshold, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library.
[0017] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the security detection method described in the first aspect are implemented.
[0018] In an embodiment of the present invention, a target firmware is obtained, and a firmware feature of the target firmware is extracted, wherein the firmware feature includes information of a third-party library called by the target firmware; based on the firmware feature, the third-party library called by the target firmware is matched with a target third-party library in a preset vulnerability information database to obtain a first similarity, wherein the preset vulnerability information database includes information of a target third-party library with a disclosed vulnerability in a preset vulnerability library; based on the firmware feature, the third-party library called by the target firmware is subjected to firmware homology detection with a target third-party library in the preset vulnerability library to obtain a second similarity; based on the first similarity, the second similarity is adjusted to obtain a target similarity, and when the target similarity is greater than or equal to a similarity threshold, vulnerability prompt information is output, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library. In this way, in an embodiment of the present invention, the firmware feature obtained by extracting the firmware feature from the firmware is well matched with the actual function of the firmware, and can be applied to extract features of firmware of multiple architectures or multiple code formats, thereby improving the applicability and reliability of determining the vulnerability information of the target firmware based on the matching result of the firmware feature and the target third-party library. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0020] Figure 1 is a flow chart of a security detection method provided by an embodiment of the present invention;
[0021] Figure 2 It is a schematic diagram of the structure of embedded device firmware to which the security detection method provided by the embodiment of the present invention can be applied;
[0022] Figure 3 This is a data interaction diagram of a security detection method provided by an embodiment of the present invention;
[0023] Figure 4 It is a structural diagram of a safety detection device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] Due to the separation of R&D and production during the manufacturing process of embedded devices, different firmware may contain the same vulnerabilities. For example, different versions of firmware for the same device, or even firmware for different devices may contain a large number of identical vulnerabilities, such as buffer overflow and out-of-bounds vulnerabilities, remote command injection vulnerabilities, etc.
[0026] In the related art, in order to improve the security of firmware, a variety of firmware security detection technologies are used to detect the security of firmware, such as feature matching, binary difference detection, fuzzy hashing, third-party library detection, etc. However, the firmware security detection technology in the related art has the following defects:
[0027] On the one hand, the use of feature matching methods requires the pre-acquisition of firmware information such as the firmware version, manufacturer, and interface function in order to detect firmware vulnerabilities based on the firmware information. However, in actual applications, firmware information is difficult to obtain, and even if the firmware information is obtained, the firmware information may not match the actual function. Therefore, the feature matching method in the related art is greatly affected by the native data, and in actual applications, the numerical values in the firmware information vary according to the application scenario. Therefore, the firmware information in different application environments can easily cause different detection results, making the feature matching method in the related art prone to missed detection or false detection.
[0028] Secondly, methods such as binary differential analysis or specific code format decomposition are only effective in detecting a certain type of firmware, but are not effective in detecting firmware with different architectures or different code formats. Therefore, their scope of application is very small.
[0029] Thirdly, fuzzy hashing only calculates the similarity of the fragmented hashing of the content, such as the hard disk data execution protection (ssddep) program, and is not applicable to other firmware.
[0030] Fourthly, the above-mentioned feature matching, binary difference detection, and fuzzy hashing methods all need to be trained based on sufficient training and test samples, and therefore cannot be applied to certain application scenarios where training samples are lacking. For example, the firmware in IoT devices. Since IoT devices are currently emerging products, security incidents of IoT devices occur frequently. However, there is insufficient research on security detection of IoT device firmware. Therefore, the samples available for research are limited, making the above-mentioned feature matching, binary difference detection, and fuzzy hashing methods unsuitable for detecting the security of firmware in IoT devices.
[0031] Fifthly, in the third-party library detection method, by extracting the third-party library information from the firmware, and then detecting the similarity between the third-party library and the third-party library in the public vulnerability library, it is detected whether the firmware contains similar vulnerabilities. However, due to engineering timeliness or the developer's preference for the stability of the third-party library, multiple new and old versions of the third-party library will be set up in the public vulnerability library. At this time, different versions of the third-party library will be matched, and the data between different versions of the third-party library will be different, which will make the third-party library detection method have a high misjudgment rate.
[0032] In the security detection method provided by the embodiment of the present invention, according to the characteristic that most of the vulnerabilities existing in the third-party library called by the firmware are disclosed vulnerabilities, the third-party library called by the firmware to be detected is matched with the third-party library with disclosed vulnerabilities in the vulnerability library. In this way, when the similarity between the two is high, it can be determined that the third-party library called by the firmware and the third-party library similar to it in the vulnerability library have the same vulnerability; at the same time, in order to facilitate the matching of the third-party library called by the firmware with the third-party library with disclosed vulnerabilities in the vulnerability library, the firmware features of the firmware are extracted in advance, which can make the extracted firmware features and the preset vulnerability information database of the third-party library with disclosed vulnerabilities in the vulnerability library have the same data format, so that they can match each other. In this way, it is realized that the firmware features of the same data format are extracted from firmwares of multiple architectures or code formats, so that it can be applicable to firmwares of multiple architectures or code formats.
[0033] In implementation, the embodiments of the present invention can be applied to detect firmware installed in an embedded IoT device, or firmware in other devices or systems, to determine whether the firmware has a disclosed vulnerability.
[0034] See also Figure 1 , is a flow chart of a security detection method provided by an embodiment of the present invention, such as Figure 1 As shown, the safety detection method may include the following steps:
[0035] Step 101: Acquire target firmware and extract firmware features of the target firmware, wherein the firmware features include third-party library information called by the target firmware.
[0036] In a specific implementation, the security detection method provided by an embodiment of the present invention can be executed by a third-party server. In this case, the above-mentioned acquisition of the target firmware can be understood as: receiving the firmware to be detected (i.e., the target firmware) uploaded by the user. In this way, it is possible to avoid executing the above-mentioned security detection method on the device where the firmware to be detected is installed, and a third-party server can be used to detect the firmware in multiple devices.
[0037] In this way, by executing the above-mentioned security detection method on the server side, the detection process is not constrained by the computing performance and capacity of the IoT device, and the vulnerability information in the vulnerability library can be updated regularly or on an ongoing basis to make the vulnerability information used as the basis for matching more accurate, thereby making the output vulnerability prompt information more accurate.
[0038] In addition, the third-party library information can be understood as the version information, name, parameter information, key files, etc. of the third-party library. In addition to the third-party library information, the firmware features can also include at least one of the following: firmware version information, firmware size, vendor, product model, password file name, key file name, system architecture, and IP address of the target firmware.
[0039] Of course, depending on the firmware type, the above firmware features may also include other information, which will not be described here.
[0040] As Figure 2 Taking the structure of the embedded device firmware shown in the figure as an example, in the application, the embedded device firmware mainly includes the firmware header (i.e. Header), the boot program (i.e. Bootloader), the operating system kernel (i.e. Kennel) and the file system, among which the third-party library can be called by the file in the file system. In the embedded system, the third-party library mainly includes shared libraries and general tool sets. Common shared libraries are glibc (C runtime library) and uClibc (C standard library), both of which are saved in the " / lib" directory in the form of dynamic link libraries, and the file names are often "libc.so" and "ld-uClibc.so". All dynamic link programs written by cross-compilation will use them at runtime. Common open source tools include: BusyBox, a lightweight tool set that combines common commands for embedded systems, Boa, a small tool used as a Web server, Httpd, etc. In the process of extracting firmware features, the required firmware features can be extracted from the corresponding files. For example, glibc can obtain its version number through man-k glibc. Other shared libraries and general tool sets can use similar methods to obtain the current version number, name and key file information.
[0041] Step 102: Based on the firmware features, match the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database to obtain a first similarity, wherein the preset vulnerability information database includes information of the target third-party library with disclosed vulnerabilities in the preset vulnerability library.
[0042] In implementation, the data format in the above-mentioned preset vulnerability information database can be suitable for matching with the above-mentioned firmware features. In implementation, the vulnerability information in the preset vulnerability library (for example: Common Vulnerabilities and Exposures (CVE)) can be converted into data formats that match the firmware features in advance to obtain the preset vulnerability information database. Taking the preset vulnerability library as the CVE vulnerability library as an example, the CVE vulnerability library can include vulnerability information of a large number of publicly disclosed vulnerabilities in various third-party libraries. In view of the fact that the vulnerability information in the CVE vulnerability library is mixed with a large amount of useless information, and the old and new versions of the third-party libraries corresponding to the vulnerability information in the CVE vulnerability library are mixed, it is not convenient to directly match the third-party libraries in the CVE vulnerability library with the above-mentioned firmware features.
[0043] In this step, the CVE vulnerability library is processed into a data structure so as to establish a preset vulnerability information database using the vulnerability information published in the CVE vulnerability library, so that the preset vulnerability information database includes a large amount of third-party library information with disclosed vulnerabilities, and the third-party library information with disclosed vulnerabilities can be used to match the firmware features of the target firmware. For example, the preset vulnerability information database includes the name, version, file, function, function code and other information of the third-party library with disclosed vulnerabilities.
[0044] In this way, by matching the firmware features with each third-party library with disclosed vulnerabilities in the preset vulnerability information database (referred to as: target third-party library), the similarity between the target firmware and each target third-party library can be obtained. At this time, the above-mentioned first similarity can be a similarity with the maximum value among the similarities between the target firmware and each target third-party library, or at least one similarity greater than a preset value.
[0045] As an optional implementation, based on the firmware feature, matching the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database to obtain a first similarity includes:
[0046] Determine the maximum value of the similarity between the third-party library information and each vulnerability information data in the preset vulnerability information database as the first similarity;
[0047] The preset vulnerability information database is established based on a preset vulnerability library, which includes at least two target third-party libraries with public vulnerabilities, and the vulnerability information data in the preset vulnerability information database corresponds to the target third-party libraries.
[0048] In implementation, the vulnerability information data in the above-mentioned preset vulnerability information database corresponds to the target third-party library, which can be understood as: the preset vulnerability information database includes vulnerability information data corresponding one-to-one to the third-party libraries with disclosed vulnerabilities, and the data format of the vulnerability information data can be the same as the data format in the firmware features, thereby facilitating matching the two.
[0049] In this embodiment, by determining the maximum value of the similarity between the third-party library information and each vulnerability information data in the preset vulnerability information database as the first similarity, the one in the preset vulnerability information database that is most similar to the firmware feature can be determined, that is, a target third-party library in the preset vulnerability library that is most similar to the target firmware is determined.
[0050] Further, the determining of the maximum value of the similarity between the third-party library information and each vulnerability information data in the preset vulnerability information database as the first similarity includes:
[0051] Determine a parameter difference value between parameter information of a third-party library called by the target firmware and parameter information of a target third-party library in the preset vulnerability information database;
[0052] Performing matrix graph similarity detection on the flowchart of the third-party library called by the target firmware and the flowchart of the target third-party library to obtain flowchart similarity;
[0053] Based on the parameter difference value and the flowchart similarity, a similarity quantization value is determined, and a maximum value of the similarity quantization value is taken as the first similarity, wherein the similarity quantization value is negatively correlated with the parameter difference and positively correlated with the flowchart similarity.
[0054] In a specific implementation, the flowchart of the third-party library called by the target firmware and the flowchart of the target third-party library can be generated by tools such as visustin, AutoFlowchart, Crystal, etc., and the node information, text information, connection information, etc. of the flowchart can be obtained to save the information in a file, and then the matrix diagram similarity detection in the prior art can be used to determine the similarity between the flowchart of the third-party library called by the target firmware and the flowchart of the target third-party library.
[0055] In addition, the above parameter difference value can be obtained by performing similarity matching between the function file of the third-party library called by the target firmware and the function file of the target third-party library, which can specifically include: a parameter number difference value and a parameter value difference value;
[0056] The difference in the number of parameters can be calculated by the following formula:
[0057] S 1k =|1-t p / t k |
[0058] Among them, the t p Indicates the number of parameters included in the third-party library called by the target firmware;
[0059] The k Represents the target third-party library T in the preset vulnerability information database k Matches the third-party library called by the target firmware, and the target third-party library T k Included k parameters;
[0060] The S 1k The closer it is to 0, the more similar the third-party library called by the target firmware is to the third-party library Tk;
[0061] The parameter value difference can be calculated by the following formula:
[0062] S 2k =|1-t qk / t k |
[0063] Among them, the t qk Indicates that the parameters in the third-party library called by the target firmware are consistent with the target third-party library T k The number of parameters with different values in ;
[0064] The S 2k The closer it is to 0, the more similar the third-party library called by the target firmware is to the third-party library Tk.
[0065] In addition, the determining of the similarity quantization value based on the parameter difference value and the flowchart similarity may include:
[0066] Based on the following formula, the similarity quantization value is calculated:
[0067] T ks =min(λ1S 1k +λ2S 2k +λ3(1-S 3k ))
[0068] Among them, T ks represents the similarity quantization value, the S 3k represents the value of the similarity of the flowchart, and λ1, λ2 and λ3 are constants respectively.
[0069] It should be noted that in addition to the above formula, the parameter difference between the third-party library called by the target firmware and the target third-party library can also be determined through other processes according to the different data types included in the firmware characteristics, different application scenarios, etc., which is not specifically limited here.
[0070] In this implementation, based on the parameter difference value and the flowchart similarity, the first similarity is determined. The similarity between the two can be judged based on the parameter difference between the third-party library called by the target firmware and the target third-party library, and the process similarity between the third-party library called by the target firmware and the target third-party library, so that the obtained similarity is more accurate and the process of determining the similarity between the two is simpler.
[0071] Step 103: Based on the firmware features, perform firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library to obtain a second similarity.
[0072] It should be noted that the above-mentioned firmware homology detection technology is similar to the firmware homology detection technology in the prior art (for example, string constant matching, fuzzy hashing, commonly used machine learning algorithms, etc.), and the difference is that in the prior art, it is necessary to perform firmware homology detection based on third-party library information, thereby causing the problem of matching between third-party libraries of different versions; whereas in the embodiment of the present invention, firmware homology detection is performed based on firmware features, which will not be repeated here.
[0073] In implementation, the target third-party library corresponding to the first similarity obtained in step 102 may be a target third-party library with multiple versions. In this step, specifically, the third-party library called by the target firmware may be matched with the multiple versions of the target third-party library obtained in step 102, and a version most similar to the third-party library called by the target firmware is determined based on the second similarity. If the most similar version has certain vulnerabilities, it can be determined that the third-party library called by the target firmware has the same vulnerability, and it is very likely that the vulnerability has not been repaired.
[0074] This implementation can avoid performing firmware homology detection on the third-party library called by the target firmware and all target third-party libraries in the preset vulnerability library.
[0075] As an optional implementation, based on the firmware features, performing firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library includes:
[0076] Inputting the firmware features of the target firmware and the vulnerability information data of the target third-party library into a preset homology detection algorithm model to obtain a second similarity;
[0077] The first similarity is used as an explicit parameter, and the second similarity is adjusted to obtain a target similarity.
[0078] In an optional embodiment, the above-mentioned taking the first similarity as an explicit parameter can specifically be: taking the first similarity as an explicit parameter of the above-mentioned preset homology detection algorithm model, so as to adjust the second similarity through the preset homology detection algorithm model, that is, the above-mentioned inputting the firmware characteristics of the target firmware and the vulnerability information data of the target third-party library into the preset homology detection algorithm model to obtain the second similarity can be understood as: taking the first similarity as an explicit parameter of the preset homology detection algorithm model, and inputting the firmware characteristics of the target firmware and the vulnerability information data of the target third-party library into the preset homology detection algorithm model, and the output result of the preset homology detection algorithm model is the above-mentioned target similarity.
[0079] In this implementation, the first similarity can be used to improve the preset homology detection algorithm model to correct the second similarity obtained by the original algorithm model, which can improve the accuracy of the detection result of simply using the traditional homology detection algorithm.
[0080] Of course, in other implementations, after the second similarity is obtained by the preset homology detection algorithm model, other adjustment algorithms can be used to adjust the second similarity based on the first similarity, for example, weighted summing the first similarity and the second similarity, etc., which is not specifically limited here.
[0081] As an optional implementation, after extracting the firmware features of the target firmware, the method further includes:
[0082] Performing digital conversion processing on the firmware features to convert the firmware features into a digital standard data set;
[0083] The preset homology detection algorithm model is obtained by training based on the standard data set and the target third-party library that is most similar to the target firmware.
[0084] In implementation, based on the conversion of firmware features into a digital standard data set, the target third-party library may also be digital data.
[0085] In implementation, the process of training the preset homology detection algorithm model is an iterative process. When the accuracy of the trained preset homology detection algorithm model is higher than the preset accuracy (for example, 80% or 90%, etc.), the iteration is stopped and the final iterative result is used as the preset homology detection algorithm model.
[0086] In this embodiment, the character data in the firmware features are converted into a digital standard data set. Compared with matching the character data, the converted digital data is matched, which can simplify the complexity of the matching process.
[0087] Step 104: adjusting the second similarity based on the first similarity to obtain a target similarity, and outputting vulnerability prompt information when the target similarity is greater than or equal to a similarity threshold, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library.
[0088] In implementation, the adjustment of the second similarity based on the first similarity can be understood as: introducing the first similarity parameter as an explicit parameter in the firmware homology detection algorithm to correct the original firmware homology detection algorithm model to improve the accuracy of the original firmware homology detection algorithm model.
[0089] In an embodiment of the present invention, a target firmware is obtained, and a firmware feature of the target firmware is extracted, wherein the firmware feature includes information of a third-party library called by the target firmware; based on the firmware feature, the third-party library called by the target firmware is matched with a target third-party library in a preset vulnerability information database to obtain a first similarity, wherein the preset vulnerability information database includes information of a target third-party library with a disclosed vulnerability in a preset vulnerability library; based on the firmware feature, the third-party library called by the target firmware is subjected to firmware homology detection with a target third-party library in the preset vulnerability library to obtain a second similarity; based on the first similarity, the second similarity is adjusted to obtain a target similarity, and when the target similarity is greater than or equal to a similarity threshold, vulnerability prompt information is output, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library. In this way, in an embodiment of the present invention, the firmware feature obtained by extracting the firmware feature from the firmware is well matched with the actual function of the firmware, and can be applied to extract features of firmware of multiple architectures or multiple code formats, thereby improving the applicability and reliability of determining the vulnerability information of the target firmware based on the matching result of the firmware feature and the target third-party library.
[0090] The following is Figure 3 Taking the data interaction diagram shown as an example, the security detection method provided by the embodiment of the present invention is illustrated as follows:
[0091] like Figure 3 As shown, in the implementation, the firmware sample to be detected (detection firmware) is preprocessed first, and the preprocessing stage includes the following steps:
[0092] Step 3011, firmware analysis;
[0093] In this step, the firmware sample is parsed, for example, decompressed or decoded, so as to extract data from the firmware sample;
[0094] Step 3012: feature extraction.
[0095] In this step, feature extraction is performed on the parsed firmware to obtain firmware features of the firmware sample.
[0096] Step 3013: Convert character data into digital data to obtain a standard data set.
[0097] It should be noted that, in actual applications, step 3013 needs to be executed only during the training of the homology detection algorithm model; when the homology detection algorithm model is trained, the third-party vulnerability library similarity quantification stage can be directly entered based on the firmware features obtained in step 3012.
[0098] The similarity quantification phase of the third-party vulnerability library includes the following steps:
[0099] Step 3021: Create a third-party vulnerability library based on CVE.
[0100] The third-party vulnerability library created in this step includes information of a target third-party library with a disclosed vulnerability, and the information of the target third-party library can have the same data format as the firmware features of the firmware sample to facilitate matching the two.
[0101] Step 3022: query the third-party vulnerability database.
[0102] In this step, the target third-party library matching the firmware features of the firmware sample is queried from the third-party vulnerability library. In implementation, the target third-party library matching the firmware features of the firmware sample may have the same name or the same version as the third-party library in the firmware features.
[0103] Step 3023: quantify similarity.
[0104] In implementation, the above similarity quantification can be understood as calculating the first similarity between the firmware features of the firmware sample and the target third-party library queried in step 3022, and the first similarity is similar to Figure 1 The first similarity in the illustrated method embodiment has the same meaning and will not be described in detail herein.
[0105] It should be noted that, when the target third-party library queried in step 3022 is a target third-party library with multiple different versions, in this step, the firmware features of the firmware sample can be matched with each version of the target third-party library respectively to obtain multiple similarities, and then the maximum value of the multiple similarities is taken as the above-mentioned first similarity.
[0106] Finally, based on the first similarity obtained in the third-party vulnerability library similarity quantification phase, the firmware homology detection phase is entered. The firmware homology detection phase includes the following steps:
[0107] Step 3031: Obtain commonly used detection algorithms.
[0108] The above commonly used detection algorithm may be a homology detection algorithm in the prior art, such as string constant matching, fuzzy hashing, commonly used machine learning algorithms, etc., which are not specifically limited here.
[0109] Step 3032: Improved detection algorithm.
[0110] In this step, the first similarity obtained in the third-party vulnerability library similarity quantification stage is used to improve the commonly used detection algorithm in step 3031, for example, the first similarity is used as an explicit parameter in the commonly used detection algorithm, so as to obtain an improved detection algorithm.
[0111] Step 3033: training or testing.
[0112] It should be noted that when this step is applied to the process of training the homology detection algorithm model, it is used to train the improved detection algorithm obtained in step 3032 using the standard data set obtained in step 3013; after the homology detection algorithm model training is completed, this step is used to obtain the result output by the improved detection algorithm obtained in step 3032, so as to determine the vulnerability information of the firmware sample based on the result. For example: when the similarity between the firmware features of the firmware sample output by the improved detection algorithm and the target third-party library is greater than the similarity threshold, it is determined that the third-party library called by the firmware sample has the same vulnerability as the target third-party library.
[0113] Depend on Figure 3It can be seen that compared with the prior art, the embodiments of the present invention have the following advantages: first, the embodiments of the present invention do not need to separately obtain the firmware information of the firmware as in the prior art, so as to perform firmware homology detection based on the firmware information, thereby avoiding the problem of difficulty in obtaining firmware information; second, in the embodiments of the present invention, by extracting firmware features from the firmware, it can be applicable to extracting firmware features of firmware of multiple architectures or multiple code formats, thereby having a wide range of applications; third, in the embodiments of the present invention, the homology detection result is adjusted by applying the first similarity, so as to judge the vulnerability information of the target firmware based on the adjusted target similarity, and its accuracy is higher than the method of directly judging the vulnerability information of the target firmware based on the firmware homology detection result in the prior art, and has higher reliability.
[0114] See also Figure 4 , is a structural diagram of a safety detection device provided by an embodiment of the present invention, such as Figure 4 As shown, the safety detection device 400 includes:
[0115] The acquisition module 401 is used to acquire the target firmware and extract the firmware features of the target firmware, wherein the firmware features include the third-party library information called by the target firmware;
[0116] A matching module 402 is used to match the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database based on the firmware feature to obtain a first similarity, wherein the preset vulnerability information database includes information of the target third-party library with disclosed vulnerabilities in the preset vulnerability database;
[0117] The detection module 403 is used to perform firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library based on the firmware feature to obtain a second similarity;
[0118] The output module 404 is used to adjust the second similarity based on the first similarity to obtain a target similarity, and output vulnerability prompt information when the target similarity is greater than or equal to a similarity threshold, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library.
[0119] Optionally, the matching module 402 is specifically configured to:
[0120] Determine the maximum value of the similarity between the third-party library information and each vulnerability information data in the preset vulnerability information database as the first similarity;
[0121] The preset vulnerability information database is established based on a preset vulnerability library, which includes at least two target third-party libraries with public vulnerabilities, and the vulnerability information data in the preset vulnerability information database corresponds to the target third-party libraries.
[0122] Optionally, the firmware feature further includes at least one of the following:
[0123] The target firmware includes the firmware version information, firmware size, vendor, product model, password file name, key file name, system architecture, and IP address.
[0124] Optionally, the matching module 402 includes:
[0125] A first determining unit, configured to determine a parameter difference value between parameter information of a third-party library called by the target firmware and parameter information of a target third-party library in the preset vulnerability information database;
[0126] A detection unit, configured to perform matrix graph similarity detection on the flowchart of the third-party library called by the target firmware and the flowchart of the target third-party library to obtain flowchart similarity;
[0127] The second determining unit is used to determine a similarity quantization value based on the parameter difference value and the flowchart similarity, and take the maximum value of the similarity quantization value as the first similarity, wherein the similarity quantization value is negatively correlated with the parameter difference and positively correlated with the flowchart similarity.
[0128] Optionally, the detection module 403 includes:
[0129] An input unit, used to input the firmware features of the target firmware and the vulnerability information data of the target third-party library into a preset homology detection algorithm model to obtain a second similarity;
[0130] An adjustment unit is used to use the first similarity as an explicit parameter to adjust the second similarity to obtain a target similarity.
[0131] Optionally, the safety detection device 400 further includes:
[0132] A digital conversion module, used for performing digital conversion processing on the firmware features to convert the firmware features into a digital standard data set;
[0133] A training module is used to train the preset homology detection algorithm model based on the standard data set and the target third-party library that is most similar to the target firmware.
[0134] The safety detection device 400 provided in the embodiment of the present invention can perform the following steps: Figure 1 The various processes in the safety detection method embodiment shown in FIG. Figure 3 The data interaction process shown in the figure can achieve the same beneficial effect, and will not be described again here to avoid repetition.
[0135] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, which implements the above-mentioned Figure 1 Each process in the embodiment of the safety detection method shown in FIG. Figure 3 The data interaction process shown in the figure can achieve the same technical effect and will not be described here to avoid repetition.
[0136] The computer-readable storage medium is, for example, a ROM, RAM, a magnetic disk or an optical disk.
[0137] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0138] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0139] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A safety detection method, characterized in that: The method comprises: Acquire target firmware, and extract firmware features of the target firmware, wherein the firmware features include third-party library information called by the target firmware; Based on the firmware features, matching the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database to obtain a first similarity, wherein the preset vulnerability information database includes information of the target third-party library with disclosed vulnerabilities in the preset vulnerability library; Based on the firmware features, performing firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library to obtain a second similarity; The second similarity is adjusted based on the first similarity to obtain a target similarity, and when the target similarity is greater than or equal to a similarity threshold, vulnerability prompt information is output, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library.
2. The method according to claim 1, characterized in that: The matching, based on the firmware feature, of the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database to obtain a first similarity includes: Determine the maximum value of the similarity between the third-party library information and each vulnerability information data in the preset vulnerability information database as the first similarity; The preset vulnerability information database is established based on a preset vulnerability library, which includes at least two target third-party libraries with public vulnerabilities, and the vulnerability information data in the preset vulnerability information database corresponds to the target third-party libraries.
3. The method according to claim 2, characterized in that The firmware features also include at least one of the following: The target firmware includes the firmware version information, firmware size, vendor, product model, password file name, key file name, system architecture, and IP address.
4. The method according to claim 3, characterized in that The determining the maximum value of the similarity between the third-party library information and each vulnerability information data in the preset vulnerability information database as the first similarity includes: Determine a parameter difference value between parameter information of a third-party library called by the target firmware and parameter information of a target third-party library in the preset vulnerability information database; Performing matrix graph similarity detection on the flowchart of the third-party library called by the target firmware and the flowchart of the target third-party library to obtain flowchart similarity; Based on the parameter difference value and the flowchart similarity, a similarity quantization value is determined, and a maximum value of the similarity quantization value is taken as the first similarity, wherein the similarity quantization value is negatively correlated with the parameter difference and positively correlated with the flowchart similarity.
5. The method according to claim 1, characterized in that The step of performing firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library based on the firmware features includes: Inputting the firmware features of the target firmware and the vulnerability information data of the target third-party library into a preset homology detection algorithm model to obtain a second similarity; The first similarity is used as an explicit parameter, and the second similarity is adjusted to obtain a target similarity.
6. The method according to claim 5, characterized in that After extracting the firmware features of the target firmware, the method further includes: Performing digital conversion processing on the firmware features to convert the firmware features into a digital standard data set; The preset homology detection algorithm model is obtained by training based on the standard data set and the target third-party library that is most similar to the target firmware.
7. A safety detection device, characterized in that: The device comprises: An acquisition module, used to acquire a target firmware and extract firmware features of the target firmware, wherein the firmware features include third-party library information called by the target firmware; A matching module, configured to match the third-party library called by the target firmware with the target third-party library in a preset vulnerability information database based on the firmware feature to obtain a first similarity, wherein the preset vulnerability information database includes information of the target third-party library with disclosed vulnerabilities in the preset vulnerability library; A detection module, configured to perform firmware homology detection on the third-party library called by the target firmware and the target third-party library in the preset vulnerability library based on the firmware feature, so as to obtain a second similarity; An output module is used to adjust the second similarity based on the first similarity to obtain a target similarity, and output vulnerability prompt information when the target similarity is greater than or equal to a similarity threshold, wherein the vulnerability prompt information is used to prompt that the third-party library called by the target firmware has a vulnerability corresponding to the target third-party library.
8. The device according to claim 7, characterized in that The matching module is specifically used for: Determine the maximum value of the similarity between the third-party library information and each vulnerability information data in the preset vulnerability information database as the first similarity; The preset vulnerability information database is established based on a preset vulnerability library, which includes at least two target third-party libraries with public vulnerabilities, and the vulnerability information data in the preset vulnerability information database corresponds to the target third-party libraries.
9. The device according to claim 8, characterized in that The firmware features also include at least one of the following: The target firmware includes the firmware version information, firmware size, vendor, product model, password file name, key file name, system architecture, and IP address.
10. The device according to claim 9, characterized in that The matching module comprises: A first determining unit, configured to determine a parameter difference value between parameter information of a third-party library called by the target firmware and parameter information of a target third-party library in the preset vulnerability information database; A detection unit, configured to perform matrix graph similarity detection on the flowchart of the third-party library called by the target firmware and the flowchart of the target third-party library to obtain flowchart similarity; The second determining unit is used to determine a similarity quantization value based on the parameter difference value and the flowchart similarity, and take the maximum value of the similarity quantization value as the first similarity, wherein the similarity quantization value is negatively correlated with the parameter difference and positively correlated with the flowchart similarity.
11. The device according to claim 7, characterized in that The detection module comprises: An input unit, used to input the firmware features of the target firmware and the vulnerability information data of the target third-party library into a preset homology detection algorithm model to obtain a second similarity; An adjustment unit is used to use the first similarity as an explicit parameter to adjust the second similarity to obtain a target similarity.
12. The device according to claim 11, characterized in that Also includes: A digital conversion module, used for performing digital conversion processing on the firmware features to convert the firmware features into a digital standard data set; A training module is used to train the preset homology detection algorithm model based on the standard data set and the target third-party library that is most similar to the target firmware.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the security detection method according to any one of claims 1 to 6 are implemented.
