Binary software component analysis method, device, electronic device and storage medium
By extracting multi-type feature fingerprints and performing feature matching, the problem of insufficient ASCII string features in the existing technology is solved, and more accurate binary software component analysis and security detection are achieved.
Patent Information
- Application Number
- CN202311724616.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-13
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-12-13
AI Technical Summary
The existing technology relies on ASCII string features in binary software component analysis, which cannot comprehensively and accurately reflect software features, resulting in omissions and false positives, making it difficult to achieve accurate component analysis.
Extract multiple types of feature fingerprints to be analyzed (including digital signature classes, symbol table features, dependency features and string features) and set matching priorities. By matching features with the knowledge base, calculate feature similarity for component analysis.
It improves the accuracy and efficiency of binary software component analysis, can more accurately identify the components of binary files, and performs security detection based on the analysis results, including vulnerability vulnerability, license terms compliance and open source license compatibility detection.
Smart Images

Figure CN117707953B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of network security technology, and in particular to a binary software component analysis method, device, electronic device and storage medium. Background Art
[0002] At present, open source components are gradually becoming the core infrastructure of software development, but in the process of using open source components, some risks and security risks are also brought. In embedded systems such as industrial systems and Internet of Vehicles systems, many source programs may be lost for a long time or private, making it impossible to evaluate their security at the source code level. Therefore, binary software component analysis and risk detection technology are needed to detect the open source components used and potential risks.
[0003] In the prior art, the main method for component analysis and risk detection of binary software is: first, search for ASCII strings in binary files, extract string feature information in the ASCII strings, such as version number information, to identify the version of the binary file, and then match the software and versions known to have security vulnerability risks based on the identified binary file name, version information, etc., to achieve vulnerability scanning of the binary file.
[0004] The inventors discovered that since string features are only one of the typical features of binary software, and some commercial software may modify string features during the development and compilation process, the extracted ASCII string cannot fully and accurately reflect the features of the binary software, that is, it is impossible to perform accurate component analysis on the binary software, which can easily lead to underreporting or even false alarms. Summary of the invention
[0005] In view of this, the embodiments of the present disclosure provide a binary software component analysis method, device, electronic device and storage medium, which can perform accurate component analysis on binary software.
[0006] In a first aspect, the present disclosure provides a binary software component analysis method, which adopts the following technical solution:
[0007] The binary software component analysis method comprises:
[0008] Get the binary file to be analyzed in the binary software;
[0009] Extracting multiple types of feature fingerprints to be analyzed from the binary file to be analyzed;
[0010] Setting matching priorities for the multiple types of feature fingerprints to be analyzed;
[0011] According to the matching priority, feature matching is performed between the feature fingerprint to be analyzed and the knowledge base to obtain a feature matching result;
[0012] According to the feature matching result, component analysis is performed on the binary file to be analyzed.
[0013] Optionally, obtaining the binary file to be analyzed in the binary software includes:
[0014] Obtaining binary files of multiple file formats in the binary software;
[0015] Identifying the binary files in the multiple file formats to obtain the binary file to be analyzed;
[0016] The binary file to be analyzed is an executable file, a relocatable file or a shared object file.
[0017] Optionally, extracting multiple types of feature fingerprints to be analyzed from the binary file to be analyzed includes:
[0018] Extracting a plurality of original features of the binary file to be analyzed;
[0019] Performing data cleaning on the multiple original features;
[0020] The multiple original features after data cleaning are classified to obtain the multiple categories of feature fingerprints to be analyzed.
[0021] Optionally, the original features include hash values, MD5, SHA1 values, symbol table information, file dependency library information, disassembled code symbols and ASCII strings.
[0022] Optionally, the multiple categories of feature fingerprints to be analyzed include: digital signature feature fingerprints to be analyzed, symbol table feature fingerprints to be analyzed, dependency feature fingerprints to be analyzed and string feature fingerprints to be analyzed; the digital signature feature fingerprint to be analyzed has a first matching priority; the knowledge base includes multiple known binary components and their corresponding digital signature feature fingerprints, symbol table feature fingerprints, dependency feature fingerprints and string feature fingerprints.
[0023] Optionally, performing feature matching on the feature fingerprint to be analyzed and the knowledge base according to the matching priority to obtain a feature matching result includes:
[0024] Perform feature matching between the digital signature feature fingerprint to be analyzed and the digital signature feature fingerprints of each known binary component;
[0025] If the match is successful, a first feature matching result is obtained, and the first feature matching result is that the binary file to be analyzed is a known binary component;
[0026] If the match fails, feature matching is performed between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component in the knowledge base to obtain a first matching result, where i is 1, 2, 3, ..., P, and P is the total number of known binary components in the knowledge base;
[0027] Perform feature matching on the character string feature fingerprint to be analyzed and the character string feature fingerprint of the i-th known binary component to obtain a second matching result;
[0028] Feature matching is performed between the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component to obtain a third matching result.
[0029] Optionally, the first matching result is the number of matches between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component, the second matching result is the number of matches between the string feature fingerprint to be analyzed and the string feature fingerprint of the i-th known binary component, and the third matching result is the number of matches between the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component.
[0030] Optionally, performing component analysis on the binary file to be analyzed according to the feature matching result includes:
[0031] Obtaining a feature similarity between the binary file to be analyzed and the i-th known binary component according to the first matching result, the second matching result and the third matching result;
[0032] According to the highest feature similarity, the component analysis results are obtained.
[0033] Optionally, obtaining the feature similarity between the binary file to be analyzed and the i-th known binary component according to the first matching result, the second matching result and the third matching result includes:
[0034] Calculate a first scoring factor K1 according to the first matching result, K1∈[0,1];
[0035] Calculate a second scoring factor K2 according to the second matching result, K2∈[0,1];
[0036] Calculate a third scoring factor K3 according to the third matching result, K3∈[0,1];
[0037] The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights.
[0038] Optionally, the calculating the feature similarity according to the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights includes:
[0039] Preset a first weight N1 for the first scoring factor K1, preset a second weight N2 for the second scoring factor K2, and preset a third weight N3 for the third scoring factor K3, N1∈[0,1], N2∈[0,1], N3∈[0,1];
[0040] When the third scoring factor K3=1, the value of the third weight N3 is corrected to 1;
[0041] The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3, the first weight N1, the second weight N2 and the corrected third weight N3.
[0042] Optionally, obtaining the component analysis result according to the highest feature similarity includes:
[0043] If the highest feature similarity is greater than or equal to the preset threshold, then the component analysis result is that the main component of the binary file to be analyzed is the known binary component corresponding to the highest feature similarity;
[0044] If the highest feature similarity is less than the preset threshold, then the component analysis result is that the main component of the binary file to be analyzed is not a known binary component.
[0045] Optionally, the binary software component analysis method further includes: performing security detection on the binary file to be analyzed based on the component analysis result and the multiple types of feature fingerprints to be analyzed.
[0046] Optionally, performing security detection on the binary file to be analyzed according to the component analysis result and the multiple types of feature fingerprints to be analyzed includes:
[0047] If the component analysis result shows that the binary file to be analyzed is a known binary component, then searching for relevant information in the knowledge base according to the known binary component, and performing vulnerability detection and license terms compliance detection on the binary file to be analyzed according to the relevant information;
[0048] If the component analysis result shows that the main component of the binary file to be analyzed is a known binary component, then searching for relevant information in the knowledge base according to the known binary component, and performing vulnerability detection, license terms compliance detection, and open source license compatibility detection on the binary file to be analyzed according to the relevant information;
[0049] If the component analysis result is that the main component of the binary file to be analyzed is not a known binary component, then the binary file to be analyzed is subjected to a license terms compliance check and an open source license compatibility check according to the multiple types of feature fingerprints to be analyzed.
[0050] In a second aspect, the embodiment of the present disclosure further provides a binary software component analysis device, which adopts the following technical solution:
[0051] The binary software component analysis device comprises:
[0052] A file acquisition module, used to acquire the binary file to be analyzed in the binary software;
[0053] A feature extraction module, used to extract multiple types of feature fingerprints to be analyzed from the binary file to be analyzed;
[0054] A priority setting module, used to set matching priorities for the multiple types of feature fingerprints to be analyzed;
[0055] A feature matching module is used to perform feature matching between the feature fingerprint to be analyzed and the knowledge base according to the matching priority to obtain a feature matching result;
[0056] The component analysis module is used to perform component analysis on the binary file to be analyzed according to the feature matching result.
[0057] In a third aspect, the present disclosure also provides an electronic device, which adopts the following technical solution:
[0058] The electronic device comprises:
[0059] at least one processor; and,
[0060] a memory communicatively connected to the at least one processor; wherein,
[0061] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform any of the above-mentioned binary software component analysis methods.
[0062] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute any of the binary software component analysis methods described above.
[0063] The disclosed embodiments provide a binary software component analysis method, device, electronic device and storage medium, wherein the binary software component analysis method extracts multiple types of feature fingerprints to be analyzed from the binary file to be analyzed, and performs component analysis on the binary file to be analyzed by matching the feature fingerprints of the multiple types of feature fingerprints to be analyzed with the feature matching results of the knowledge base, which has higher accuracy than the solution of performing component analysis only through ASCII strings in the prior art. In addition, in the analysis method, matching priorities are set for the multiple types of feature fingerprints to be analyzed, and feature matching is performed between the feature fingerprints to be analyzed and the knowledge base according to the matching priorities to obtain feature matching results, which can also improve the efficiency of component analysis.
[0064] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following preferred embodiments are specifically cited and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0066] Figure 1 A flowchart of a binary software component analysis method provided by an embodiment of the present disclosure;
[0067] Figure 2 A specific flow chart of step S1 provided in the embodiment of the present disclosure;
[0068] Figure 3 A specific flow chart of step S2 provided in the embodiment of the present disclosure;
[0069] Figure 4 A specific flow chart for constructing a knowledge base provided in an embodiment of the present disclosure;
[0070] Figure 5 A specific flow chart of step S4 provided in the embodiment of the present disclosure;
[0071] Figure 6 A specific flow chart of step S5 provided in the embodiment of the present disclosure;
[0072] Figure 7 A specific flow chart of security detection provided by the embodiment of the present disclosure;
[0073] Figure 8A principle block diagram of a binary software component analysis device provided by an embodiment of the present disclosure;
[0074] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0075] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0076] It should be clear that the following embodiments of the present disclosure are described by specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other in the absence of conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0077] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0078] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0079] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0080] The present disclosure provides a binary software component analysis method, specifically, Figure 1 As shown, the binary software component analysis method includes:
[0081] Step S1: Obtain a binary file to be analyzed in binary software.
[0082] The above binary software can be independent binary software or binary software obtained by decompressing a binary software package. A binary software may contain one or more binary files (also called binary components, which are the smallest unit of component analysis). In the actual analysis process, it is necessary to obtain the binary files to be analyzed from the binary software.
[0083] Alternatively, if Figure 2 As shown, step S1 of obtaining the binary file to be analyzed in the binary software specifically includes:
[0084] Sub-step S11: Obtain binary files of multiple file formats in the binary software.
[0085] Obtain the binary software or binary software package uploaded by the user. If the binary software uploaded by the user is already an executable file, directly proceed to sub-step S12. If the binary software package uploaded by the user is a binary software package, it is necessary to perform recursive parsing on the binary software package to extract binary files of multiple file formats in the binary software package.
[0086] Exemplarily, the binary software package may be a compressed file, an executable file, a firmware image, or other file types.
[0087] Exemplarily, the above recursive parsing process includes: performing an unpacking operation on the uploaded binary software package according to the file type of the binary software package, for example, a ZIP decompression tool can be used to extract files and directories in a compressed file, and a corresponding tool can be used to unpack the firmware image. The directory tree after the binary software package is decompressed can be obtained through recursive parsing.
[0088] The process of extracting binary files of various file formats in a binary software package includes: identifying the file types of files under a directory tree, the file types including executable linkable files, compressed files, code files, configuration files, data files, plain text files, other files, etc.
[0089] Sub-step S12: identifying binary files of various file formats to obtain binary files to be analyzed.
[0090] Exemplarily, the binary file to be analyzed is an executable file, a relocatable file, or a shared object file.
[0091] Exemplarily, executable and linkable files are identified, and executable files, relocatable files and shared target files therein are extracted. The compressed files can be unpacked and then corresponding identification operations are performed according to the file types of the unpacked files.
[0092] Step S2: extract multiple types of feature fingerprints to be analyzed from the binary file to be analyzed.
[0093] Alternatively, if Figure 3 As shown, step S2 extracts multiple types of feature fingerprints to be analyzed from the binary file to be analyzed, including:
[0094] Sub-step S21: extracting multiple original features of the binary file to be analyzed.
[0095] Optionally, the original features include hash values, MD5, SHA1 values, symbol table information, file dependency library information, disassembled code symbols, and ASCII strings. In the disclosed embodiment, the above original features can be extracted by system commands, tools, or by writing a program according to the construction method of the binary file. For example, use Python's hashlib library to extract the hash value, MD5, and SHA1 value of the binary file; use disassembly tools such as objdump to extract the symbol table information and disassembled code symbols of the binary file; use system tools such as ldd (Linux) or dumpbin / DEPENDENTS (Windows) to extract the file dependency library information of the binary file, such as the dependency library list; use the system command strings to extract the ASCII string in the binary file.
[0096] Sub-step S22: performing data cleaning on multiple original features.
[0097] By performing data cleaning on the original features, invalid features can be eliminated and key features useful for component analysis can be retained.
[0098] Exemplarily, data cleaning includes one or more of the following: (1) Removing missing values: detecting and deleting missing values in the original features, such as a large number of blank lines; (2) Removing duplicate values: detecting and deleting duplicate features, which is mostly applied to ASCII strings; (3) Removing outliers: detecting and deleting abnormal features that are too long or too short, which is mostly applied to symbol table information, ASCII strings, etc.; (4) Standardizing data: converting hash values, MD5, SHA1 values, file dependency library information, etc. into a standard data format; (5) Cross-validation: using cross-validation to ensure that there are no conflicting features, which is mostly applied to cross-validation of symbol table information, version numbers in ASCII strings, etc.
[0099] Sub-step S23: classify the multiple original features after data cleaning to obtain multiple types of feature fingerprints to be analyzed.
[0100] The multiple original features after data cleaning are equivalent to the metadata that identifies the binary file to be analyzed. According to the fingerprint attributes of each original feature, multiple types of feature fingerprints to be analyzed can be obtained by classification. Exemplarily, the fingerprint attributes include four categories: digital signature fingerprints, symbol table fingerprints, dependency fingerprints, and string fingerprints. The multiple original features after data cleaning are classified to obtain digital signature feature fingerprints to be analyzed, symbol table feature fingerprints to be analyzed, dependency feature fingerprints to be analyzed, and string feature fingerprints to be analyzed. Among them, each type of feature fingerprint to be analyzed includes at least one feature fingerprint, preferably including multiple feature fingerprints, for example, the digital signature feature fingerprint to be analyzed includes: one or more of hash value, MD5 value, SHA1 value, etc.; the symbol table feature fingerprint to be analyzed includes: one or more of symbol table information, disassembled code symbols, etc.; the dependency feature fingerprint to be analyzed includes: file dependency library information; the string feature fingerprint to be analyzed includes: ASCII string.
[0101] Step S3: setting matching priorities for multiple types of feature fingerprints to be analyzed.
[0102] Optionally, since the digital signature feature fingerprint to be analyzed is unique and the matching result obtained therefrom has a higher credibility, a first matching priority is set for the digital signature feature fingerprint to be analyzed. On this basis, the symbol table feature fingerprint to be analyzed, the dependency feature fingerprint to be analyzed, and the string feature fingerprint to be analyzed may all have a second matching priority, or the symbol table feature fingerprint to be analyzed and the string feature fingerprint to be analyzed have the second matching priority, and the dependency feature fingerprint to be analyzed has a third matching priority.
[0103] Step S4: According to the matching priority, feature matching is performed between the feature fingerprint to be analyzed and the knowledge base to obtain a feature matching result.
[0104] Exemplarily, the knowledge base includes a plurality of known binary components and their corresponding digital signature feature fingerprints, symbol table feature fingerprints, dependency feature fingerprints, and string feature fingerprints. The knowledge base may be pre-built, and when performing binary file component analysis, the pre-built knowledge base can be loaded. It should be noted that in the disclosed embodiment, if the manufacturers and names of two binary components are the same but the version information is different, then the two are considered to be two different binary components in the knowledge base, and this principle applies in subsequent steps.
[0105] For example, Figure 4 As shown in the figure, the process of pre-building a knowledge base includes:
[0106] (1) Obtaining known binary components: Known binary components, binary software, or binary software packages can be downloaded from software vendors or open source communities (such as GitHub) through automated crawlers and other technical methods.
[0107] (2) Obtaining product information of known binary components: You can obtain product information such as manufacturer information, version information, MD5, applicable environment, programming language, etc. of binary components from the release page of binary components, binary software, or binary software packages.
[0108] (3) Obtaining component information of known binary components: You can obtain dependent component and version information (such as the pom.xml file of a JAVA package will mark dependencies), license information used, etc. from the release page of the binary component, binary software, or binary package, and obtain associated known vulnerability information from vulnerability release websites (such as NVD, CNNVD, etc.).
[0109] (4) Constructing a unique identifier for a known binary component: CPE (Common Platform Enumeration) can be used as a unique identifier for a binary component.
[0110] (5) Obtaining feature fingerprints of known binary components: Obtaining digital signature feature fingerprints, symbol table feature fingerprints, dependency feature fingerprints, and string feature fingerprints of known binary components. These feature fingerprints contain all the features of the known binary component in the knowledge base.
[0111] (6) Store the information or content obtained from (1) to (5) above to complete the knowledge base construction.
[0112] During the application process, all feature fingerprints of the knowledge base can be loaded by default, or some feature fingerprints of the knowledge base can be selectively loaded according to the type of binary file, user configuration, etc. For example, when the suffix of the binary file to be analyzed is .jar, it means that its programming language is JAVA. At this time, only JAVA-related feature fingerprints in the knowledge base can be loaded.
[0113] Alternatively, if Figure 5 As shown, step S4 performs feature matching between the feature fingerprint to be analyzed and the knowledge base according to the matching priority to obtain feature matching results, including:
[0114] Sub-step S41, feature matching is performed between the digital signature feature fingerprint to be analyzed and the digital signature feature fingerprints of each known binary component.
[0115] Since the digital signature class feature fingerprint to be analyzed has the first matching priority, the digital signature class feature fingerprint to be analyzed is first feature matched with the digital signature class feature fingerprints of each known binary component. For example, the type and value of the digital signature class feature fingerprint to be analyzed are used as query conditions to find out whether it is the digital signature class feature fingerprint of a known binary component in the knowledge base. If so, the match is successful, otherwise, the match fails.
[0116] Sub-step S42: If the match is successful, a first feature matching result is obtained. The first feature matching result is that the binary file to be analyzed is a known binary component. For example, the first feature matching result includes the manufacturer, name and version information of the matched known binary component.
[0117] If the digital signature feature fingerprint to be analyzed is successfully matched, the first feature matching result obtained has already indicated that the binary file to be analyzed is a known binary component in the knowledge base, and there is no need to perform component analysis on it subsequently. It can also be understood that the first feature matching result is directly used as the component analysis result.
[0118] Sub-step S43: If the match fails, feature matching is performed between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component in the knowledge base to obtain a first matching result, where i is 1, 2, 3, ..., P, and P is the total number of known binary components in the knowledge base.
[0119] Exemplarily, with the symbol table feature fingerprint to be analyzed as a condition, a match is performed in the symbol table feature fingerprint of the i-th known binary component in the knowledge base, and a regular matching, string matching, etc. can be used to obtain a first matching result. Among them, i takes all values between 1 and P, that is, the symbol table feature fingerprint to be analyzed is feature matched with the symbol table feature fingerprints of all known binary components in the knowledge base, respectively, to obtain multiple first matching results.
[0120] Exemplarily, the first matching result is the number of matches between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component.
[0121] Sub-step S44: performing feature matching on the character string feature fingerprint to be analyzed and the character string feature fingerprint of the i-th known binary component to obtain a second matching result.
[0122] For example, with the character string feature fingerprint to be analyzed as a condition, a match is performed in the character string feature fingerprint of the i-th known binary component in the knowledge base, and regular matching, string matching, etc. can be used to obtain the second matching result. Among them, i takes all values between 1 and P, that is, the character string feature fingerprint to be analyzed is feature matched with the character string feature fingerprints of all known binary components in the knowledge base, respectively, to obtain multiple second matching results.
[0123] Exemplarily, the second matching result is the number of matches between the character string feature fingerprint to be analyzed and the character string feature fingerprint of the i-th known binary component.
[0124] Sub-step S45: feature matching is performed between the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component to obtain a third matching result.
[0125] Exemplarily, based on the dependency feature fingerprint to be analyzed, a match is performed on the dependency feature fingerprint of the i-th known binary component in the knowledge base. In specific implementation, the number of dependency components can be compared first, and when the number is the same, the dependency component lists are compared for consistency, and finally a third matching result is obtained.
[0126] Exemplarily, the third matching result is the number of matches between the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component.
[0127] It should be noted that there is no restriction on the order of execution among the feature matching of the symbol table feature fingerprint to be analyzed, the feature matching of the string feature fingerprint to be analyzed, and the feature matching of the dependency feature fingerprint to be analyzed. Feature matching can be performed on any one of them first, or feature matching can be performed on the symbol table feature fingerprint to be analyzed and the string feature fingerprint to be analyzed at the same time, and then feature matching can be performed on the dependency feature fingerprint to be analyzed.
[0128] Step S5: Perform component analysis on the binary file to be analyzed according to the feature matching result.
[0129] Alternatively, if Figure 6 As shown, step S5 performs component analysis on the binary file to be analyzed according to the feature matching result, including:
[0130] Sub-step S51: obtaining the feature similarity between the binary file to be analyzed and the i-th known binary component according to the first matching result, the second matching result and the third matching result.
[0131] Optionally, sub-step S51 specifically includes:
[0132] Calculate a first scoring factor K1 according to the first matching result, K1∈[0,1];
[0133] Calculate a second scoring factor K2 according to the second matching result, K2∈[0,1];
[0134] A third scoring factor K3 is calculated according to the third matching result, K3∈[0,1];
[0135] The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights.
[0136] The higher the scoring factor K (collectively referred to as the first scoring factor K1, the second scoring factor K2, and the third scoring factor K3), the higher the similarity between the corresponding feature fingerprint to be analyzed and the corresponding feature fingerprint of the known binary component of the knowledge base.
[0137] Exemplarily, the specific formula for calculating the scoring factor K (collectively referred to as the first scoring factor K1, the second scoring factor K2, and the third scoring factor K3) is as follows:
[0138]
[0139] Among them, K is a scoring factor, A is the number of features included in the feature fingerprint to be analyzed (the number of features included in the symbol table feature fingerprint to be analyzed, the string feature fingerprint to be analyzed, or the dependency feature fingerprint to be analyzed), B is the number of features included in the knowledge base feature fingerprint (the number of features included in the symbol table feature fingerprint, the string feature fingerprint, or the dependency feature fingerprint), and M is the number of matches. It is certainly understandable that if the scoring factor K is the first scoring factor K1, then A is the number of features included in the string feature fingerprint to be analyzed, B is the number of features included in the string feature fingerprint in the knowledge base, and M is the number of matches corresponding to the first matching result.
[0140] In the above process of calculating the scoring factor K, only the intersection and union of the feature fingerprint to be analyzed and the feature fingerprint of the known binary component of the knowledge base are concerned, and no complex mathematical operations or distance metrics are required. The processing efficiency of discrete data is high and the calculation speed is fast.
[0141] Optionally, the feature similarity is calculated according to the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights, including:
[0142] A first weight N1 is preset for the first scoring factor K1, a second weight N2 is preset for the second scoring factor K2, and a third weight N3 is preset for the third scoring factor K3, N1∈[0,1], N2∈[0,1], N3∈[0,1].
[0143] When the third scoring factor K3=1, the value of the third weight N3 is corrected to 1. The third scoring factor K3=1 indicates that the third matching result is completely consistent with the known binary component in the knowledge base, indicating that the binary file to be analyzed may be a known open source component compiled directly from the source code of the known binary component, or compiled after source code modification.
[0144] The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3, the first weight N1, the second weight N2 and the modified third weight N3.
[0145] Since the first scoring factor K1, the second scoring factor K2, and the third scoring factor K3 are used for combined calculation, the calculated feature similarity is more comprehensive and more accurate.
[0146] Exemplarily, the calculation formula of feature similarity S is:
[0147]
[0148] Sub-step S52: Obtain component analysis results based on the highest feature similarity.
[0149] When determining the highest feature similarity, a confidence threshold (eg, 0.4) may be set to directly exclude feature similarities with feature similarities lower than the confidence threshold, thereby simplifying the process of determining the highest feature similarity.
[0150] Optionally, sub-step S52 specifically includes:
[0151] Determine the relationship between the highest feature similarity and a preset threshold;
[0152] If the highest feature similarity is greater than or equal to a preset threshold, then the component analysis result is that the main component of the binary file to be analyzed is the known binary component corresponding to the highest feature similarity. For example, the component analysis result includes the manufacturer, name and version information of the known binary component with the highest feature similarity;
[0153] If the highest feature similarity is less than a preset threshold, then the component analysis result is that the main component of the binary file to be analyzed is not a known binary component.
[0154] The above preset thresholds may be set according to actual conditions. For example, considering that due to different construction methods of binary components, there may be errors in the extraction of symbol table information and string information, the preset threshold is set to 0.9.
[0155] Optionally, the binary software component analysis method in the disclosed embodiment also includes: performing security detection on the binary file to be analyzed based on the component analysis results and multiple types of feature fingerprints to be analyzed. Specifically, if the component analysis result shows that the binary file to be analyzed is a known binary component, then the relevant information is searched in the knowledge base based on the known binary component, and vulnerability detection and license terms compliance detection are performed on the binary file to be analyzed based on the relevant information; if the component analysis result shows that the main component of the binary file to be analyzed is a known binary component, then the relevant information is searched in the knowledge base based on the known binary component, and vulnerability detection, license terms compliance detection and compatibility detection between open source licenses are performed on the binary file to be analyzed based on the relevant information; if the component analysis result shows that the main component of the binary file to be analyzed is not a known binary component, then the license terms compliance detection and compatibility detection between open source licenses are performed on the binary file to be analyzed based on the multiple types of feature fingerprints to be analyzed.
[0156] In the process of security detection, when the binary file to be analyzed is a known binary component, or the main component is a known binary component, the component analysis result contains the name and version information of the known binary component, then its vulnerability vulnerability can be detected. When the binary file to be analyzed is a known binary component, there is no compatibility issue between open source licenses at all, so there is no need to detect this risk. When the main component of the binary file to be analyzed is not a known binary component, although it cannot be detected for vulnerability, it can be tested for license terms compliance and compatibility between open source licenses through multiple categories of feature fingerprints to be analyzed.
[0157] For the case where the main component of the binary file to be analyzed is not a known binary component, the embodiments of the present disclosure have more obvious technical advantages, as follows:
[0158] In the prior art, since it extracts string feature information from ASCII strings to identify the version of binary files, and then matches software and versions known to have security vulnerability risks based on the identified binary file name, version information, etc., to achieve vulnerability scanning of binary files, it is impossible to perform any security testing on the binary software without analyzing the components and versions of the binary software.
[0159] In the present application, since multiple categories of feature fingerprints to be analyzed are first extracted from the binary file to be analyzed, security detection is performed on the binary file to be analyzed based on the component analysis results and the multiple categories of feature fingerprints to be analyzed. Even if the component analysis results show that the main component of the binary file to be analyzed is not a known binary component, compliance detection of license terms and compatibility detection between open source licenses can be performed based on the multiple categories of feature fingerprints to be analyzed.
[0160] During the above security testing process, not only the binary files are tested for vulnerability vulnerabilities and compliance with open source license terms, but also the compatibility risks between multiple open source licenses contained in the binary files are tested, thus maximizing the security requirements of the binary files.
[0161] For example, Figure 7 As shown, according to the component analysis results, the process of security detection of the binary file to be analyzed includes one or more of the following steps:
[0162] (1) Construct a unique identifier for a binary component: Construct a standard CPE data format based on the component manufacturer, name, and version information;
[0163] (2) Knowledge base query: Using the constructed CPE as the query condition, query the knowledge base for product information, known security vulnerability information, open source license information, and dependency component relationships of known binary components;
[0164] (3) Constructing a dependency graph of binary components: When the dependency components are found in the previous step, a recursive query is performed, including the direct and indirect dependent components of the component, and finally a dependency graph of the binary component is generated;
[0165] (4) Safety testing, including one or more of the following:
[0166] Vulnerability detection: Perform security detection on all binary components on the dependency graph, identify known security vulnerabilities in the components, and determine the vulnerability of the components based on the vulnerability description and risk level;
[0167] Compliance detection of license terms: Identify the terms of the open source component license. Generally, the terms will protect the intellectual property rights of the release and use of the component, and impose behavioral restrictions on the use, modification, and distribution of the component (for example, if a binary component uses the GPLv2 license, if the component is referenced for code modification, the source code must be open sourced according to its terms). Compliance detection of license terms can avoid business risks.
[0168] Compatibility detection between open source licenses: If binary software references multiple open source components based on different licenses during the development process, and the terms of these licenses contain conflicting requirements, there is a compatibility issue between open source licenses.
[0169] In the binary software component analysis method provided in the embodiment of the present disclosure, multiple categories of feature fingerprints to be analyzed are extracted from multiple dimensions, thereby enriching the dimensions of binary file feature recognition. The binary file to be analyzed is subjected to component analysis by feature matching results of multiple categories of feature fingerprints to be analyzed with a knowledge base, which has higher accuracy than the solution of only performing component analysis through ASCII strings in the prior art. In addition, in the analysis method, matching priorities are set for multiple categories of feature fingerprints to be analyzed, and feature matching is performed between the feature fingerprints to be analyzed and the knowledge base according to the matching priorities to obtain feature matching results, which can also improve the efficiency of component analysis and effectively reduce resource overhead.
[0170] In addition, the present disclosure also provides a binary software component analysis device, such as Figure 8 As shown, the binary software component analysis device includes:
[0171] A file acquisition module, used to acquire the binary file to be analyzed in the binary software;
[0172] A feature extraction module is used to extract multiple types of feature fingerprints to be analyzed from binary files to be analyzed;
[0173] A priority setting module is used to set matching priorities for multiple types of feature fingerprints to be analyzed;
[0174] The feature matching module is used to perform feature matching between the feature fingerprint to be analyzed and the knowledge base according to the matching priority to obtain the feature matching result;
[0175] The component analysis module is used to perform component analysis on the binary file to be analyzed based on the feature matching results.
[0176] Optionally, the binary software component analysis device also includes: a security detection module, which is used to search for relevant information in a knowledge base according to the known binary component when the binary file to be analyzed is a known binary component, and perform vulnerability detection and license terms compliance detection on the binary file to be analyzed according to the relevant information; or, when the main component of the binary file to be analyzed is a known binary component, search for relevant information in a knowledge base according to the known binary component, and perform vulnerability detection, license terms compliance detection and compatibility detection between open source licenses on the binary file to be analyzed according to the relevant information; or, when the binary file to be analyzed is not a known binary component, perform license terms compliance detection and compatibility detection between open source licenses on the binary file to be analyzed according to multiple categories of feature fingerprints to be analyzed.
[0177] In order to facilitate those skilled in the art to better understand and implement the binary software component analysis method in the embodiment of the present disclosure, two specific embodiments are provided below for illustration.
[0178] Example 1
[0179] In Example 1, JavaSample.jar is subjected to component analysis, specifically including:
[0180] (1) Obtain JavaSample.jar, identify its file format as JAR, and directly perform the decompression operation to obtain the decompressed file directory tree.
[0181] (2) Traversing the decompressed file directory tree, we found that the files mainly consisted of class files compiled from Java code and package manager feature files (pom.xml), among which the binary file was JavaSample.jar.
[0182] (3) Extract the original features of JavaSample.jar, including the file MD5 value, file dependency library information, and ASCII string. The JAR binary file does not involve symbol table information, so it is not extracted.
[0183] (4) Perform data cleaning on the above original features, including standardizing the file dependency library information and removing duplicate values and outliers from ASCII strings.
[0184] (5) Crawl component product information, component dependency information, component known security vulnerability information, binary files and their digital signature information. Based on the product information, digital signature information, dependency, known security vulnerability, and open source license information of the binary components contained in the above crawled information, and extracting ASCII string features based on the binary files, complete the construction of the knowledge base of the jaxen1.1.4 component. The unique identifier of the component is: a:jaxen:jaxen:1.1.14.
[0185] (6) According to the file format of JavaSample.jar, the JAVA knowledge base of step (5) is loaded, and the digital signature class feature fingerprint in the feature fingerprint extracted in step (4) is matched with the digital signature class feature fingerprint extracted based on the known binary component in the knowledge base. During the matching process, the digital signature class feature fingerprint type and its value in the feature fingerprint extracted in step (4) are used as query conditions, and the MD5 value match is found in the knowledge base, indicating that JavaSample.jar is a known binary component (a:jaxen:jaxen:1.1.14), and the feature matching and component analysis process is directly exited.
[0186] (7) Based on the knowledge base, the direct and indirect dependency relationships of component a:jaxen:jaxen:1.1.14 are analyzed and security checks are performed. Security checks are performed on all binary components on the dependency graph to identify known security vulnerabilities. A total of 7 known security vulnerabilities were identified.
[0187] (8) Compliance testing of license terms was performed and a total of 1 open source license was identified. Its terms were compliant and it was a low-risk open source license.
[0188] Example 2
[0189] In Example 2, component analysis is performed on CSample, specifically including:
[0190] (1) Get CSample and identify its file format as an executable file.
[0191] (2) Extract the original features of CSample, including the MD5 value of the binary file, symbol table information, file dependency library information, and ASCII string.
[0192] (3) Perform data cleaning on the above original features, including standardizing the file dependency library information and removing duplicate values and outliers from ASCII strings.
[0193] (4) According to the file format of CSample, the binary C program knowledge base is loaded, and the digital signature class feature fingerprint in the feature fingerprint extracted in step (3) is matched with the digital signature class feature fingerprint extracted based on the known binary component in the knowledge base. In the matching process, the digital signature class feature fingerprint type and its value, i.e., the MD5 value, in the feature fingerprint extracted in step (3) are used as query conditions to search in the knowledge base. If no known binary component in the knowledge base is matched, then the string feature fingerprint, symbol table feature fingerprint and dependency feature fingerprint in the feature fingerprint extracted in step (3) are matched with the corresponding feature fingerprints of each known binary component in the knowledge base to obtain corresponding multiple matching results.
[0194] (5) Based on the matching results of each known binary component, calculate the feature similarity between CSample and each known binary component:
[0195] The original features of CSample extracted in step (2) include: 2415 string features, 630 symbol table features, and 22 dependency features. For a known binary component a:rdesktop:rdesktop:1.8.3, 3110 string features, 710 symbol table features, and 22 dependency features of a:rdesktop:rdesktop:1.8.3 are extracted from the knowledge base. The number of features matched by the two is: 2156 string features, 597 symbol table features, and 22 dependency features.
[0196] String Scoring Factor:
[0197] Symbol table scoring factors:
[0198] Dependency Scoring Factor:
[0199] The importance weights are set as follows: string weight N1 is 0.8, symbol table weight N2 is 0.9, and dependency weight N3 is 0.7. Since K3=1, N3 is adjusted to 1 in subsequent calculations.
[0200] Then the feature similarity between CSample and a:rdesktop:rdesktop:1.8.3 is:
[0201]
[0202] The above feature similarity calculation process is performed on all known binary components in the knowledge base to obtain multiple feature similarities. Among them, the known binary component with the highest feature similarity is a:rdesktop:rdesktop:1.8.3. Since it reaches the preset threshold of 0.8, it is considered that CSample is directly quoted and source code modified based on a:rdesktop:rdesktop:1.8.3, and its main components are the same as a:rdesktop:rdesktop:1.8.3.
[0203] (6) Based on the knowledge base analysis, the direct dependency and indirect dependency relationship of component a:rdesktop:rdesktop:1.8.3 is analyzed to perform security testing. The security testing includes: on the one hand, since CSample is modified and referenced based on a:rdesktop:rdesktop:1.8.3, it is necessary to test the compliance of the license terms. Based on a:rdesktop:rdesktop:1.8.3, the Apache-2.0 open source license is identified, and its terms are compliant and it is a low-risk open source license. On the other hand, based on the symbol table information, it is found that CSample also uses the GPLv2.0 license, and its terms are a high-risk open source license that does not allow users to distribute modified code or derivative software as commercial software. On the other hand, CSample uses both Apache v2.0 code and GPLv2.0 code and releases them in combination, which has compatibility issues because Apache v2.0 explicitly grants users patent licenses and certain patent termination and infringement protection clauses, while GPLv2.0 prohibits patent licenses.
[0204] The electronic device according to an embodiment of the present disclosure includes a memory and a processor. The memory is used to store non-temporary computer-readable instructions. Specifically, the memory may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may, for example, include a read-only memory (ROM), a hard disk, a flash memory, etc.
[0205] The processor may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of the present disclosure, the processor is used to run the computer-readable instructions stored in the memory, so that the electronic device performs all or part of the steps of the binary software component analysis method of each embodiment of the present disclosure.
[0206] Those skilled in the art should be able to understand that in order to solve the technical problem of how to obtain a good user experience, the present embodiment may also include well-known structures such as a communication bus and an interface, and these well-known structures should also be included in the protection scope of the present disclosure.
[0207] like Fig. 9 The present invention provides a schematic diagram of the structure of an electronic device according to an embodiment of the present invention, which is suitable for implementing the electronic device in the embodiment of the present invention. Fig. 9The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0208] like Fig. 9 As shown, the electronic device may include a processor (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the electronic device are also stored. The processor, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0209] Typically, the following devices can be connected to the I / O interface: input devices such as sensors or visual information acquisition devices; output devices such as display screens; storage devices such as magnetic tapes and hard disks; and communication devices. The communication device can allow the electronic device to communicate with other devices (such as edge computing devices) wirelessly or by wire to exchange data. Fig. 9 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0210] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processor, all or part of the steps of the binary software component analysis method of the embodiment of the present disclosure are executed.
[0211] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0212] According to the computer-readable storage medium of the embodiment of the present disclosure, non-transitory computer-readable instructions are stored thereon. When the non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the binary software component analysis method of each embodiment of the present disclosure are executed.
[0213] The above-mentioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or mobile hard disk), media with built-in rewritable non-volatile memory (e.g., memory card) and media with built-in ROM (e.g., ROM box).
[0214] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0215] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0216] In the present disclosure, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. The block diagrams of the devices, devices, equipment, and systems involved in the present disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, devices, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.
[0217] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0218] It should also be noted that in the system and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0219] Various changes, substitutions, and modifications of the techniques described herein may be made without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of the present disclosure is not limited to the specific aspects of the processes, machines, manufactures, compositions of events, means, methods, and actions described above. Currently existing or later to be developed processes, machines, manufactures, compositions of events, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects described herein may be utilized. Thus, the appended claims include such processes, machines, manufactures, compositions of events, means, methods, or actions within their scope.
[0220] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0221] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A binary software component analysis method, characterized in that: include: Get the binary file to be analyzed in the binary software; Extracting multiple types of feature fingerprints to be analyzed from the binary file to be analyzed; Setting matching priorities for the multiple types of feature fingerprints to be analyzed; According to the matching priority, feature matching is performed between the feature fingerprint to be analyzed and the knowledge base to obtain a feature matching result; According to the feature matching result, performing component analysis on the binary file to be analyzed; The multiple types of feature fingerprints to be analyzed include: digital signature feature fingerprints to be analyzed, symbol table feature fingerprints to be analyzed, dependency feature fingerprints to be analyzed, and string feature fingerprints to be analyzed; the digital signature feature fingerprints to be analyzed have a first matching priority; the knowledge base includes multiple known binary components and their corresponding digital signature feature fingerprints, symbol table feature fingerprints, dependency feature fingerprints, and string feature fingerprints; According to the matching priority, feature matching is performed between the feature fingerprint to be analyzed and the knowledge base to obtain a feature matching result, including: Perform feature matching between the digital signature feature fingerprint to be analyzed and the digital signature feature fingerprints of each known binary component; If the match is successful, a first feature matching result is obtained, and the first feature matching result is that the binary file to be analyzed is a known binary component; If the match fails, feature matching is performed between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component in the knowledge base to obtain a first matching result, where i is 1, 2, 3, ..., P, and P is the total number of known binary components in the knowledge base; Perform feature matching on the character string feature fingerprint to be analyzed and the character string feature fingerprint of the i-th known binary component to obtain a second matching result; Perform feature matching on the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component to obtain a third matching result; The first matching result is the number of matches between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component, the second matching result is the number of matches between the string feature fingerprint to be analyzed and the string feature fingerprint of the i-th known binary component, and the third matching result is the number of matches between the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component; The step of performing component analysis on the binary file to be analyzed according to the feature matching result includes: Obtaining a feature similarity between the binary file to be analyzed and the i-th known binary component according to the first matching result, the second matching result and the third matching result; According to the highest feature similarity, the component analysis results are obtained; Obtaining feature similarity between the binary file to be analyzed and the i-th known binary component according to the first matching result, the second matching result, and the third matching result, including: Calculate a first scoring factor K1 according to the first matching result, K1∈[0,1]; Calculate a second scoring factor K2 according to the second matching result, K2∈[0,1]; Calculate a third scoring factor K3 according to the third matching result, K3∈[0,1]; Calculate the feature similarity according to the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights; The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights, including: Preset a first weight N1 for the first scoring factor K1, preset a second weight N2 for the second scoring factor K2, and preset a third weight N3 for the third scoring factor K3, N1∈[0,1], N2∈[0,1], N3∈[0,1]; When the third scoring factor K3=1, the value of the third weight N3 is corrected to 1; The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3, the first weight N1, the second weight N2 and the corrected third weight N3.
2. The binary software component analysis method according to claim 1, characterized in that: The step of obtaining the binary file to be analyzed in the binary software includes: Obtaining binary files of multiple file formats in the binary software; Identifying the binary files in the multiple file formats to obtain the binary file to be analyzed; The binary file to be analyzed is an executable file, a relocatable file or a shared object file.
3. The binary software component analysis method according to claim 1, characterized in that: The step of extracting multiple types of feature fingerprints to be analyzed from the binary file to be analyzed includes: Extracting a plurality of original features of the binary file to be analyzed; Performing data cleaning on the multiple original features; The multiple original features after data cleaning are classified to obtain the multiple categories of feature fingerprints to be analyzed.
4. The binary software component analysis method according to claim 3, characterized in that: The original features include hash values, MD5, SHA1 values, symbol table information, file dependency library information, disassembled code symbols and ASCII strings.
5. The binary software component analysis method according to claim 1, characterized in that: The component analysis results are obtained according to the highest feature similarity, including: If the highest feature similarity is greater than or equal to a preset threshold, then the component analysis result is that the component of the binary file to be analyzed is a known binary component corresponding to the highest feature similarity; If the highest feature similarity is less than a preset threshold, then the component analysis result is that the component of the binary file to be analyzed is not a known binary component.
6. The binary software component analysis method according to claim 5, characterized in that: Also includes: According to the component analysis result and the multiple types of feature fingerprints to be analyzed, security detection is performed on the binary file to be analyzed.
7. The binary software component analysis method according to claim 6, characterized in that: The step of performing security detection on the binary file to be analyzed according to the component analysis result and the multiple types of feature fingerprints to be analyzed includes: If the component analysis result shows that the binary file to be analyzed is a known binary component, then searching for relevant information in the knowledge base according to the known binary component, and performing vulnerability detection and license terms compliance detection on the binary file to be analyzed according to the relevant information; If the component analysis result is that the component of the binary file to be analyzed is a known binary component, then searching for relevant information in the knowledge base according to the known binary component, and performing vulnerability detection, license terms compliance detection, and open source license compatibility detection on the binary file to be analyzed according to the relevant information; If the component analysis result is that the component of the binary file to be analyzed is not a known binary component, then the binary file to be analyzed is subjected to a license terms compliance check and an open source license compatibility check according to the multiple types of feature fingerprints to be analyzed.
8. A binary software component analysis device, characterized in that: include: A file acquisition module, used to acquire the binary file to be analyzed in the binary software; A feature extraction module, used to extract multiple types of feature fingerprints to be analyzed from the binary file to be analyzed; A priority setting module, used to set matching priorities for the multiple types of feature fingerprints to be analyzed; A feature matching module is used to perform feature matching between the feature fingerprint to be analyzed and the knowledge base according to the matching priority to obtain a feature matching result; A component analysis module, used for performing component analysis on the binary file to be analyzed according to the feature matching result; The multiple types of feature fingerprints to be analyzed include: digital signature feature fingerprints to be analyzed, symbol table feature fingerprints to be analyzed, dependency feature fingerprints to be analyzed, and string feature fingerprints to be analyzed; the digital signature feature fingerprints to be analyzed have a first matching priority; the knowledge base includes multiple known binary components and their corresponding digital signature feature fingerprints, symbol table feature fingerprints, dependency feature fingerprints, and string feature fingerprints; According to the matching priority, feature matching is performed between the feature fingerprint to be analyzed and the knowledge base to obtain a feature matching result, including: Perform feature matching between the digital signature feature fingerprint to be analyzed and the digital signature feature fingerprints of each known binary component; If the match is successful, a first feature matching result is obtained, and the first feature matching result is that the binary file to be analyzed is a known binary component; If the match fails, feature matching is performed between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component in the knowledge base to obtain a first matching result, where i is 1, 2, 3, ..., P, and P is the total number of known binary components in the knowledge base; Perform feature matching on the character string feature fingerprint to be analyzed and the character string feature fingerprint of the i-th known binary component to obtain a second matching result; Perform feature matching on the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component to obtain a third matching result; The first matching result is the number of matches between the symbol table feature fingerprint to be analyzed and the symbol table feature fingerprint of the i-th known binary component, the second matching result is the number of matches between the string feature fingerprint to be analyzed and the string feature fingerprint of the i-th known binary component, and the third matching result is the number of matches between the dependency feature fingerprint to be analyzed and the dependency feature fingerprint of the i-th known binary component; The step of performing component analysis on the binary file to be analyzed according to the feature matching result includes: Obtaining a feature similarity between the binary file to be analyzed and the i-th known binary component according to the first matching result, the second matching result and the third matching result; According to the highest feature similarity, the component analysis results are obtained; Obtaining feature similarity between the binary file to be analyzed and the i-th known binary component according to the first matching result, the second matching result, and the third matching result, including: Calculate a first scoring factor K1 according to the first matching result, K1∈[0,1]; Calculate a second scoring factor K2 according to the second matching result, K2∈[0,1]; Calculate a third scoring factor K3 according to the third matching result, K3∈[0,1]; Calculate the feature similarity according to the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights; The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3 and their corresponding weights, including: Preset a first weight N1 for the first scoring factor K1, preset a second weight N2 for the second scoring factor K2, and preset a third weight N3 for the third scoring factor K3, N1∈[0,1], N2∈[0,1], N3∈[0,1]; When the third scoring factor K3=1, the value of the third weight N3 is corrected to 1; The feature similarity is calculated based on the first scoring factor K1, the second scoring factor K2, the third scoring factor K3, the first weight N1, the second weight N2 and the corrected third weight N3.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the binary software component analysis method described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the binary software component analysis method described in any one of claims 1-7.
Citation Information
Patent Citations
Detecting transparent network communication interception appliances
CN104169904A
Fingerprint identification method and device
CN116311388A
Binary component retrieval method and device
CN116804980A
Automatic applet security risk assessment method and related equipment
CN116932381A
Identifying whether electronic data under test includes particular information from a database
US8365247B1
