Application vulnerability detection method, device, storage medium and computer equipment
By extracting and analyzing vulnerability code and context information in different versions of binary files, a unified vulnerability feature and pattern collection is built, which solves the problems of inefficiency of traditional vulnerability detection methods and is difficult to overcome version differences, and achieves fast and accurate vulnerability detection.
Patent Information
- Application Number
- CN202411266711.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-09-11
AI Technical Summary
Traditional vulnerability detection methods are inefficient, difficult to cross different versions of binary files, and relying on manual analysis is easy to miss potential security risks.
By extracting vulnerability code samples and context samples from different versions of binary files, performing feature analysis to determine unified vulnerability characteristics, building a collection of patterns based on vulnerability context information, and compiling it into a search mode to search the target binary files for vulnerability.
It realizes rapid vulnerability detection of binary files in different versions, spans version differences, accurately identify different manifestations of the same vulnerability, improves the accuracy and adaptability of detection, and reduces the need for manual intervention.
Smart Images

Figure CN118779889B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer security technology, and in particular to a method, device, storage medium and computer equipment for detecting vulnerabilities in an application program. Background Art
[0002] With the rapid development of information technology, software applications have become an indispensable part of modern society and are widely used in all walks of life. However, software vulnerabilities, as a major threat to software security, frequently cause serious consequences such as data leakage, service interruption and even system crash. These vulnerabilities are often hidden in complex code logic and diverse software versions, making them difficult to be discovered and repaired in a timely manner. Traditional vulnerability detection methods mostly rely on manual analysis or matching based on known vulnerability signatures. These methods are not only inefficient, but also difficult to cope with the ever-evolving vulnerability forms and rapidly iterating software versions.
[0003] Specifically, when faced with different versions of binary files, traditional methods may show very different manifestations of the same vulnerability in different versions due to factors such as compilation optimization, code obfuscation, and architectural differences, which makes detection methods based on specific version vulnerability signatures ineffective. In addition, as software functions become increasingly complex, vulnerabilities may be hidden in deep code logic. Relying on manual analysis is not only time-consuming and laborious, but also prone to missing potential security risks.
[0004] Therefore, there is an urgent need for an efficient and automated vulnerability detection method that can accurately identify and locate vulnerabilities in software across different versions of binary files. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a method, apparatus, storage medium and computer device for detecting vulnerabilities in an application program, which can effectively detect vulnerabilities existing in a target binary file and have high adaptability and accuracy.
[0006] According to one aspect of the present application, a method for detecting a vulnerability of an application is provided, the method comprising:
[0007] For each vulnerability among the known multiple vulnerabilities, extract vulnerability code samples and vulnerability context samples corresponding to the vulnerability code samples from different versions of binary files containing the vulnerability, perform feature analysis on the vulnerability code samples to determine unified vulnerability features corresponding to different versions of binary files, and determine vulnerability context information corresponding to different versions of binary files according to the vulnerability context samples, wherein the unified vulnerability feature is an instruction sequence containing wildcards and placeholders, and the vulnerability context information includes instructions and / or function calls corresponding to the vulnerability context samples;
[0008] Determine vulnerability identification information of each vulnerability according to unified vulnerability sample features and vulnerability context information corresponding to each vulnerability, construct a pattern set containing vulnerability identification information of each vulnerability, and compile each vulnerability identification information in the pattern set into a search pattern;
[0009] The target binary file of the application to be identified is parsed to obtain a target instruction sequence, and a vulnerability search is performed on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0010] In an embodiment of the present application, optionally, each vulnerability identification information in the pattern set is compiled into a search pattern, including:
[0011] Importing the pattern set into a vulnerability search tool, and using the vulnerability search tool to compile vulnerability identification information of each vulnerability in the pattern set to obtain a search pattern for each vulnerability;
[0012] Parsing the target binary file of the application to be identified to obtain a target instruction sequence, and performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file, including:
[0013] The target binary file of the application to be identified is input into the vulnerability search tool, the target binary file is parsed into a target instruction sequence by the vulnerability search tool, and the target instruction sequence is searched for vulnerabilities according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0014] In an embodiment of the present application, optionally, performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file includes:
[0015] The vulnerability search tool creates a matching table, matches the target instruction sequence character by character from the beginning according to the search pattern, records the characters and character positions in the target instruction sequence that at least partially match the search pattern in the matching table, determines the offset length of the next vulnerability search based on the first character of the search pattern and the characters and character positions recorded in the matching table when a mismatch occurs, determines the next vulnerability search position of the target instruction sequence according to the offset length, and continues to search for vulnerabilities in the target instruction sequence based on the next vulnerability search position until the end of the target instruction sequence is searched.
[0016] In an embodiment of the present application, optionally, the search pattern includes a unified vulnerability sample feature string and a vulnerability context information string, the vulnerability context information string includes an instruction string corresponding to an instruction contained in the vulnerability context information and / or a function call string corresponding to a function call; recording characters and character positions in the target instruction sequence that at least partially match the search pattern in the matching table includes:
[0017] Recording characters and character positions in the target instruction sequence that at least partially match the unified vulnerability sample feature string in the search pattern in the matching table;
[0018] The method further comprises:
[0019] In the case of searching for a code segment that completely matches the unified vulnerability sample feature string, the to-be-identified context information corresponding to the completely matched code segment is obtained, and whether the completely matched code segment is a vulnerability is determined based on the similarity between the to-be-identified context information and the context information string, and the next vulnerability search position is determined based on the position of the completely matched code segment in the target instruction sequence to continue the vulnerability search.
[0020] In an embodiment of the present application, optionally, feature analysis is performed on the vulnerability code sample to determine unified vulnerability features corresponding to binary files of different versions, including:
[0021] Performing a sequential analysis on each of the vulnerability code samples, sequentially identifying the same instruction sequence segments and the different instruction sequence segments in each of the vulnerability code samples, determining the number of characters in the different instruction sequence segments, representing the different instruction sequence segments with a character number of 1 as the wildcard, representing the different instruction sequence segments with a character number greater than 1 as the placeholder, and sequentially splicing the same instruction sequence segments, the wildcards, and the placeholders to obtain unified vulnerability features corresponding to different versions of binary files.
[0022] In the embodiment of the present application, optionally, before parsing the target binary file of the application to be identified to obtain the target instruction sequence, the method further includes:
[0023] Dividing the instruction sequence of the unified vulnerability feature into a plurality of basic blocks, wherein the basic blocks are composed of instructions executed sequentially;
[0024] Generate a basic block node graph according to each basic block, and construct an instruction flow graph according to the calling relationship between each basic block, wherein the instruction flow graph is composed of multiple basic block node graphs and edges between the basic block node graphs;
[0025] Performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file includes:
[0026] Dividing the target instruction sequence into a plurality of target basic blocks, and drawing a target instruction flow graph corresponding to the target instruction sequence based on the calling relationship between the target basic blocks;
[0027] The target instruction flow graph is graph matched according to the instruction flow graph to obtain a suspicious instruction sequence in the target instruction sequence based on the portion of the target instruction flow graph that matches the instruction flow graph, and a vulnerability search is performed on the suspicious instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0028] In the embodiment of the present application, optionally, the method further includes:
[0029] If it is determined that there is a vulnerability in the application to be identified, a vulnerability code snippet corresponding to the vulnerability is marked in the target binary file, and a patch code corresponding to the vulnerability is obtained;
[0030] When the application to be identified is running, the patch code is loaded into the process space, the vulnerability code of the target binary file is located based on the mark of the vulnerability code fragment, and a jump instruction pointing to the patch code is inserted at the located vulnerability code fragment position, so that the target binary file skips the vulnerability code fragment and jumps back to the code after the vulnerability code fragment after the patch code execution is completed to continue running.
[0031] According to another aspect of the present application, a device for detecting a vulnerability of an application is provided, the device comprising:
[0032] A vulnerability analysis module is used to extract vulnerability code samples and vulnerability context samples corresponding to the vulnerability code samples from different versions of binary files containing the vulnerability for each vulnerability among the known multiple vulnerabilities, perform feature analysis on the vulnerability code samples to determine unified vulnerability features corresponding to different versions of binary files, and determine vulnerability context information corresponding to different versions of binary files according to the vulnerability context samples, wherein the unified vulnerability features are instruction sequences containing wildcards and placeholders, and the vulnerability context information includes instructions and / or function calls corresponding to the vulnerability context samples;
[0033] A pattern compilation module, used to determine vulnerability identification information of each vulnerability according to the unified vulnerability sample features and vulnerability context information corresponding to each vulnerability, construct a pattern set containing the vulnerability identification information of each vulnerability, and compile each vulnerability identification information in the pattern set into a search pattern;
[0034] The vulnerability detection module is used to parse the target binary file of the application to be identified to obtain a target instruction sequence, and perform a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0035] In the embodiment of the present application, optionally, the mode compilation module is further used to:
[0036] Importing the pattern set into a vulnerability search tool, and using the vulnerability search tool to compile vulnerability identification information of each vulnerability in the pattern set to obtain a search pattern for each vulnerability;
[0037] Parsing the target binary file of the application to be identified to obtain a target instruction sequence, and performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file, including:
[0038] The target binary file of the application to be identified is input into the vulnerability search tool, the target binary file is parsed into a target instruction sequence by the vulnerability search tool, and the target instruction sequence is searched for vulnerabilities according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0039] In the embodiment of the present application, optionally, the vulnerability detection module is further used to:
[0040] The vulnerability search tool creates a matching table, matches the target instruction sequence character by character from the beginning according to the search pattern, records the characters and character positions in the target instruction sequence that at least partially match the search pattern in the matching table, determines the offset length of the next vulnerability search based on the first character of the search pattern and the characters and character positions recorded in the matching table when a mismatch occurs, determines the next vulnerability search position of the target instruction sequence according to the offset length, and continues to search for vulnerabilities in the target instruction sequence based on the next vulnerability search position until the end of the target instruction sequence is searched.
[0041] In an embodiment of the present application, optionally, the search pattern includes a unified vulnerability sample feature string and a vulnerability context information string, and the vulnerability context information string includes an instruction string corresponding to an instruction contained in the vulnerability context information and / or a function call string corresponding to a function call;
[0042] The vulnerability detection module is also used for:
[0043] Recording characters and character positions in the target instruction sequence that at least partially match the unified vulnerability sample feature string in the search pattern in the matching table;
[0044] In the case of searching for a code segment that completely matches the unified vulnerability sample feature string, the to-be-identified context information corresponding to the completely matched code segment is obtained, and whether the completely matched code segment is a vulnerability is determined based on the similarity between the to-be-identified context information and the context information string, and the next vulnerability search position is determined based on the position of the completely matched code segment in the target instruction sequence to continue the vulnerability search.
[0045] In the embodiment of the present application, optionally, the vulnerability analysis module is further used to:
[0046] Performing a sequential analysis on each of the vulnerability code samples, sequentially identifying the same instruction sequence segments and the different instruction sequence segments in each of the vulnerability code samples, determining the number of characters in the different instruction sequence segments, representing the different instruction sequence segments with a character number of 1 as the wildcard, representing the different instruction sequence segments with a character number greater than 1 as the placeholder, and sequentially splicing the same instruction sequence segments, the wildcards, and the placeholders to obtain unified vulnerability features corresponding to different versions of binary files.
[0047] In the embodiment of the present application, optionally, the vulnerability analysis module is further used to:
[0048] Dividing the instruction sequence of the unified vulnerability feature into a plurality of basic blocks, wherein the basic blocks are composed of instructions executed sequentially;
[0049] Generate a basic block node graph according to each basic block, and construct an instruction flow graph according to the calling relationship between each basic block, wherein the instruction flow graph is composed of multiple basic block node graphs and edges between the basic block node graphs;
[0050] In the embodiment of the present application, optionally, the vulnerability detection module is further used to:
[0051] Dividing the target instruction sequence into a plurality of target basic blocks, and drawing a target instruction flow graph corresponding to the target instruction sequence based on the calling relationship between the target basic blocks;
[0052] The target instruction flow graph is graph matched according to the instruction flow graph to obtain a suspicious instruction sequence in the target instruction sequence based on the portion of the target instruction flow graph that matches the instruction flow graph, and a vulnerability search is performed on the suspicious instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0053] In the embodiment of the present application, optionally, the vulnerability detection module is further used to:
[0054] If it is determined that there is a vulnerability in the application to be identified, a vulnerability code snippet corresponding to the vulnerability is marked in the target binary file, and a patch code corresponding to the vulnerability is obtained;
[0055] When the application to be identified is running, the patch code is loaded into the process space, the vulnerability code of the target binary file is located based on the mark of the vulnerability code fragment, and a jump instruction pointing to the patch code is inserted at the located vulnerability code fragment position, so that the target binary file skips the vulnerability code fragment and jumps back to the code after the vulnerability code fragment after the patch code execution is completed to continue running.
[0056] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the vulnerability detection method of the above-mentioned application program is implemented.
[0057] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned application vulnerability detection method when executing the program.
[0058] By means of the above technical scheme, a vulnerability detection method, device, storage medium and computer equipment of an application provided by an embodiment of the present application extract vulnerability code samples from different versions of binary files of known vulnerabilities, extract context information related to the vulnerability code samples, including instructions and function calls; perform feature analysis on the vulnerability code samples, determine a unified vulnerability feature, which contains wildcards and placeholders to adapt to different versions of binary files; determine vulnerability context information corresponding to different versions of binary files according to the vulnerability context samples; construct vulnerability identification information according to the unified vulnerability feature and vulnerability context information, and compile this information into a search pattern; parse the target binary file of the application to be identified, obtain the target instruction sequence, and use the constructed search pattern to perform vulnerability search on the target instruction sequence to determine whether there is a vulnerability in the target binary file. The embodiment of the present application can realize rapid vulnerability detection of different versions of binary files by extracting unified vulnerability features and constructing search patterns, avoiding the inefficient process of independently analyzing each version in the traditional method, and the use of unified vulnerability features enables the detection method to cross version differences and accurately identify different manifestations of the same vulnerability. At the same time, combined with vulnerability context information, the accuracy of identification is further improved. Due to the use of mechanisms such as wildcards and placeholders, it can flexibly respond to code changes caused by compilation optimization, code obfuscation, etc., and enhance the adaptability and robustness of the detection method. In addition, the entire detection process, from vulnerability sample extraction to target binary file parsing and searching, is automated, reducing the need for manual intervention and improving detection efficiency. With the discovery of new vulnerabilities and the repair of old vulnerabilities, the vulnerability identification information library and search pattern collection can be easily updated to adapt to changing security threats.
[0059] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, 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 application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0061] Figure 1 A schematic diagram of a process flow of a method for detecting a vulnerability in an application program provided in an embodiment of the present application is shown;
[0062] Figure 2 A schematic diagram of a process flow of another application vulnerability detection method provided by an embodiment of the present application is shown;
[0063] Figure 3 A schematic diagram of the structure of a vulnerability detection device for an application program provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0064] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0065] In this embodiment, a method for detecting a vulnerability in an application is provided. Figure 1 As shown, the method includes:
[0066] Step 101, for each vulnerability among multiple known vulnerabilities, extract vulnerability code samples and vulnerability context samples corresponding to the vulnerability code samples from different versions of binary files containing the vulnerability, perform feature analysis on the vulnerability code samples to determine unified vulnerability features corresponding to different versions of binary files, and determine vulnerability context information corresponding to different versions of binary files based on the vulnerability context samples, wherein the unified vulnerability feature is an instruction sequence containing wildcards and placeholders, and the vulnerability context information includes instructions and / or function calls corresponding to the vulnerability context samples.
[0067] The embodiment of the present application proposes an efficient and automated application vulnerability detection method, which is intended to solve the problems of low efficiency and difficulty in identifying the same vulnerability across versions in traditional vulnerability detection methods. First, for each known vulnerability, binary files of different versions containing the vulnerability are collected. Then, vulnerability code samples and their corresponding vulnerability context samples are extracted from these binary files, and these samples contain the specific code segments where the vulnerability occurs and the execution environment around them. Next, feature analysis is performed on the vulnerability code samples to identify common features that are not affected by version differences, i.e., unified vulnerability features. These features are represented in the form of instruction sequences containing wildcards and placeholders to adapt to code changes under different compilation and optimization conditions. At the same time, according to the vulnerability context samples, the context information of the vulnerability occurrence is determined, including relevant instructions and / or function calls, which help to locate the vulnerability more accurately. Thereby, key information is extracted from different versions of binary files of known vulnerabilities to form a unified understanding of the vulnerability.
[0068] Step 102, determine vulnerability identification information of each vulnerability according to the unified vulnerability sample features and vulnerability context information corresponding to each vulnerability, construct a pattern set containing the vulnerability identification information of each vulnerability, and compile each vulnerability identification information in the pattern set into a search pattern.
[0069] In this embodiment, vulnerability identification information of each vulnerability is constructed based on the unified vulnerability features and vulnerability context information of each vulnerability. This information integrates the core features and occurrence environment of the vulnerability, and improves the accuracy of identification. The vulnerability identification information of all vulnerabilities is organized into a pattern set for unified management and use. Each vulnerability identification information in the pattern set is compiled into a search pattern, which will be used to perform efficient vulnerability searches in the target binary file. This realizes the conversion of the extracted vulnerability features and information into patterns that can be used for search.
[0070] Step 103: parse the target binary file of the application to be identified to obtain a target instruction sequence, and perform a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0071] In this embodiment, the binary file of the application to be detected is parsed to extract its instruction sequence, and the extracted target instruction sequence is searched using the compiled search pattern. According to the search results, it is determined whether there is a code pattern matching the known vulnerability in the target binary file, thereby determining whether there is a corresponding vulnerability. In this way, it is possible to detect whether there is a known vulnerability in the binary file of the application to be identified.
[0072] By applying the technical solution of this embodiment, vulnerability code samples are extracted from different versions of binary files of known vulnerabilities, and context information related to the vulnerability code samples is extracted, including instructions and function calls; feature analysis is performed on the vulnerability code samples to determine a unified vulnerability feature, which contains wildcards and placeholders to adapt to different versions of binary files; vulnerability context information corresponding to different versions of binary files is determined according to the vulnerability context sample; vulnerability identification information is constructed according to the unified vulnerability feature and vulnerability context information, and this information is compiled into a search pattern; the target binary file of the application to be identified is parsed to obtain the target instruction sequence, and the target instruction sequence is searched for vulnerabilities using the constructed search pattern to determine whether there is a vulnerability in the target binary file. The embodiment of the present application can realize fast vulnerability detection of different versions of binary files by extracting unified vulnerability features and constructing search patterns, avoiding the inefficient process of independent analysis of each version in the traditional method, and the use of unified vulnerability features enables the detection method to cross version differences and accurately identify different manifestations of the same vulnerability. At the same time, combined with vulnerability context information, the accuracy of identification is further improved. Due to the use of mechanisms such as wildcards and placeholders, code changes caused by compilation optimization, code obfuscation, etc. can be flexibly responded to, and the adaptability and robustness of the detection method are enhanced. In addition, the entire detection process, from vulnerability sample extraction to target binary file parsing and searching, is automated, reducing the need for manual intervention and improving detection efficiency. Moreover, as new vulnerabilities are discovered and old ones are fixed, this method can easily update the vulnerability identification information library and search pattern set to adapt to ever-changing security threats.
[0073] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another vulnerability detection method for an application is provided, such as Figure 2 As shown, the method includes:
[0074] Step 201: for each vulnerability among multiple known vulnerabilities, extract vulnerability code samples and vulnerability context samples corresponding to the vulnerability code samples from different versions of binary files containing the vulnerability; sequentially analyze each of the vulnerability code samples, sequentially identify the same instruction sequence segments and different instruction sequence segments in each of the vulnerability code samples, determine the number of characters in the different instruction sequence segments, represent the different instruction sequence segments with a character number of 1 as the wildcard, represent the different instruction sequence segments with a character number greater than 1 as the placeholder, and sequentially splice the same instruction sequence segments, the wildcards, and the placeholders to obtain unified vulnerability features corresponding to different versions of binary files; determine vulnerability context information corresponding to different versions of binary files according to the vulnerability context samples, wherein the unified vulnerability feature is an instruction sequence containing wildcards and placeholders, and the vulnerability context information includes instructions and / or function calls corresponding to the vulnerability context samples.
[0075] In this embodiment, for each known vulnerability, vulnerability code samples and their context samples are extracted from different versions of binary files containing the vulnerability. These vulnerability code samples are sequentially analyzed to identify the same and different instruction sequence segments, and the difference instruction sequence segments with a character count of 1 are represented as wildcards (for example, represented as .), and those greater than 1 are represented as placeholders (for example, represented as .*), so as to construct a unified vulnerability feature that is not affected by version differences and adapt to subtle changes in different versions. At the same time, the context information of the vulnerability is determined based on the context samples, including the relevant instructions and function calls before and after the vulnerability code.
[0076] Step 202, respectively determine the vulnerability identification information of each vulnerability according to the unified vulnerability sample features and vulnerability context information corresponding to each vulnerability, construct a pattern set containing the vulnerability identification information of each vulnerability, and import the pattern set into a vulnerability search tool, and use the vulnerability search tool to compile the vulnerability identification information of each vulnerability in the pattern set to obtain a search pattern for each vulnerability.
[0077] In this embodiment, vulnerability identification information is constructed based on the unified vulnerability features and context information of each vulnerability, and the information is organized into a pattern set and imported into a vulnerability search tool. The vulnerability search tool is used to perform binary compilation on each vulnerability identification information in the pattern set to generate an efficient search pattern.
[0078] Step 203: input the target binary file of the application to be identified into the vulnerability search tool, parse the target binary file into a target instruction sequence through the vulnerability search tool, and perform a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0079] In this embodiment, the binary file of the application to be detected is input into the vulnerability search tool, and the search tool parses the binary file into a target instruction sequence. The target instruction sequence is searched using a compiled search pattern to detect whether there is a known vulnerability.
[0080] In an embodiment of the present application, optionally, in step 203, a vulnerability search is performed on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file, including: the vulnerability search tool creates a matching table, matches the target instruction sequence character by character from the beginning according to the search pattern, records the characters and character positions in the target instruction sequence that at least partially match the search pattern in the matching table, and when a mismatch occurs, determines the offset length of the next vulnerability search based on the first character of the search pattern and the characters and character positions recorded in the matching table, determines the next vulnerability search position of the target instruction sequence according to the offset length, and continues to search for vulnerabilities in the target instruction sequence based on the next vulnerability search position until the end of the target instruction sequence is searched.
[0081] In the above embodiment, in order to efficiently determine whether there are known vulnerabilities in the target binary file, the vulnerability search tool adopts a character-by-character matching strategy based on a matching table. This strategy is intended to reduce unnecessary search space, improve search efficiency, and ensure that all possible vulnerability locations can be covered. Specifically, the vulnerability search tool first creates a matching table based on the compiled search pattern. This matching table is used to record the characters and their positions in the target instruction sequence that at least partially match the search pattern. The design of the matching table can be optimized according to the specific characteristics of the search pattern and the characteristics of the target instruction sequence. The search tool starts from the beginning of the target instruction sequence and matches the search pattern character by character. This matching method from beginning to end ensures the comprehensiveness of the search, that is, no potential vulnerability locations are missed. During the matching process, whenever a character in the target instruction sequence is found to match a character in the search pattern, the search tool will record the character and its position in the matching table. These matching information are crucial for the subsequent search process because they provide direct evidence of the similarity between the target instruction sequence and the search pattern. When a mismatch occurs during the search process (i.e., a character in the target instruction sequence does not match the corresponding character in the search pattern), the search tool determines the offset length of the next vulnerability search based on the characters and character positions recorded in the match table and the first character of the search pattern. This offset length determines the next position where the search tool continues to search in the target instruction sequence. If the match table contains the same character as the first character of the search pattern (except for the first character recorded in the match table), the offset length of the next vulnerability search is determined based on the character position. If the match table does not contain the same character as the first character of the search pattern, the offset length of the next vulnerability search is determined based on the character position of the last character in the match table. After determining the offset length, the match table is cleared to determine the offset length next time. Then, based on the calculated offset length, the search tool determines the next search position in the target instruction sequence and continues to match the search pattern character by character from this position. This process is repeated until the end of the target instruction sequence is searched. When the search tool reaches the end of the target instruction sequence, the search process ends. At this point, based on the matching information recorded in the match table, the search tool can determine whether there is a vulnerability code fragment matching the search pattern in the target binary file. If there is such a match, it indicates that there is a known vulnerability in the target binary file. The embodiment of the present application creates a matching table and a character-by-character matching strategy. This method can reduce unnecessary search space and improve search efficiency. In particular, when processing large binary files, the character-by-character matching method from beginning to end ensures the comprehensiveness of the search, that is, no potential vulnerability locations are missed. By calculating the offset length and determining the next search position, the method can flexibly handle mismatches and continue searching for possible vulnerability locations.
[0082] In an embodiment of the present application, optionally, the search pattern includes a unified vulnerability sample feature string and a vulnerability context information string, the vulnerability context information string includes an instruction string corresponding to the instruction contained in the vulnerability context information and / or a function call string corresponding to the function call; the characters and character positions in the target instruction sequence that at least partially match the search pattern are recorded in the matching table, including: the characters and character positions in the target instruction sequence that at least partially match the unified vulnerability sample feature string in the search pattern are recorded in the matching table; in the case of searching for a code segment that completely matches the unified vulnerability sample feature string, obtaining the context information to be identified corresponding to the completely matching code segment, determining whether the completely matching code segment is a vulnerability based on the similarity between the context information to be identified and the context information string, and determining the next vulnerability search position based on the position of the completely matching code segment in the target instruction sequence to continue the vulnerability search.
[0083] In the above embodiment, the search pattern is extended to include a unified vulnerability sample feature string and a vulnerability context information string, which further improves the accuracy and efficiency of vulnerability detection. Specifically, the search pattern is no longer just a unified vulnerability sample feature string, but includes a context information string related to the vulnerability. These context information strings may include instruction strings corresponding to specific instructions in the vulnerability context information and / or function call strings corresponding to function calls. During the search process, when the characters in the target instruction sequence at least partially match the unified vulnerability sample feature string in the search pattern, these characters and their positions will be recorded in the matching table. If the search tool finds a code segment that completely matches the unified vulnerability sample feature string in the target instruction sequence, it will further obtain the context information to be identified corresponding to the code segment. These context information to be identified may be part of the instruction sequence or function call sequence, which needs to be compared with the context information string in the search pattern. The search tool compares the similarity between the context information to be identified and the context information string. This similarity can be calculated by a variety of methods, such as string matching, edit distance, similarity algorithm, semantic matching, etc. Based on the similarity result, the search tool can determine whether the completely matched code segment is indeed a vulnerability. Once the vulnerability is confirmed (or not confirmed), the search tool determines the starting position of the next vulnerability search based on the position of the fully matched code segment in the target instruction sequence. This position may be the code immediately following the confirmed vulnerability, or a new position determined according to a certain strategy (such as a fixed offset, a jump based on the code structure, etc.). Starting from the new search position, the search tool will continue to search the target instruction sequence using the same search pattern until the end of the sequence is reached or other stop conditions are met. By introducing the context information string in the embodiment of the present application, the search tool can more accurately determine whether the code segment in the target instruction sequence is indeed a vulnerability. This reduces the possibility of false positives and improves the accuracy of detection. Considering the context information of the vulnerability enables the search tool to more comprehensively understand the environment in which the vulnerability occurs, thereby locating the vulnerability more accurately. The search pattern can contain different types of context information strings as needed, which makes the method highly flexible and scalable. As the understanding of the vulnerability deepens, the search pattern can be easily updated to include new context information. By quickly identifying the fully matched code segment and calculating the context similarity, the search tool can determine the existence of the vulnerability more quickly, thereby optimizing the search efficiency.
[0084] Step 204: If it is determined that a vulnerability exists in the application to be identified, a vulnerability code snippet corresponding to the vulnerability is marked in the target binary file, and a patch code corresponding to the vulnerability is obtained.
[0085] In this embodiment, if a vulnerability is detected, the vulnerable code fragment is marked in the target binary file, and the patch code corresponding to the vulnerability is obtained in preparation for repair.
[0086] Step 205, when the application to be identified is running, the patch code is loaded into the process space, the vulnerability code of the target binary file is located based on the mark of the vulnerability code fragment, and a jump instruction pointing to the patch code is inserted at the located vulnerability code fragment position, so that the target binary file skips the vulnerability code fragment and jumps back to the code after the vulnerability code fragment after the patch code execution is completed to continue running.
[0087] In this embodiment, when the application is running, the patch code is dynamically loaded into the process space, and the vulnerability position is located at runtime according to the mark of the vulnerability code fragment. A jump instruction is inserted before the vulnerability code fragment, so that the program skips the vulnerability code and executes the patch code. After the patch code is executed, the code after the vulnerability code fragment is returned to continue execution through the jump instruction.
[0088] In an embodiment of the present application, optionally, before parsing the target binary file of the application to be identified to obtain the target instruction sequence, the method further includes: dividing the instruction sequence of the unified vulnerability feature into a plurality of basic blocks, wherein the basic blocks are composed of sequentially executed instructions; generating a basic block node graph according to each basic block, and constructing an instruction flow graph according to the calling relationship between each basic block, wherein the instruction flow graph is composed of a plurality of basic block node graphs and edges between the basic block node graphs;
[0089] Accordingly, a vulnerability search is performed on the target instruction sequence according to the search pattern to determine whether there are vulnerabilities in the target binary file, including: dividing the target instruction sequence into multiple target basic blocks, and drawing a target instruction flow graph corresponding to the target instruction sequence based on the calling relationship between the target basic blocks; performing graph matching on the target instruction flow graph according to the instruction flow graph to obtain a suspicious instruction sequence in the target instruction sequence based on the part of the target instruction flow graph that matches the instruction flow graph, and performing a vulnerability search on the suspicious instruction sequence according to the search pattern to determine whether there are vulnerabilities in the target binary file.
[0090] In the above embodiment, the instruction sequences of unified vulnerability features are first determined (these are extracted from known vulnerabilities and used to build search patterns), and these instruction sequences are divided into multiple basic blocks (Basic Blocks). Each basic block is a set of instructions executed sequentially, in which there are no other jumps or branches except for the entry and exit points. According to the divided basic blocks, a basic block node graph is generated. In this graph, each node represents a basic block, and the connection between nodes (if any) represents the jump or call relationship between basic blocks. According to the call relationship between basic blocks, a complete instruction flow graph is further constructed. This graph contains not only basic block nodes, but also edges representing the control flow transfer between basic blocks. For the target binary file of the application to be identified, the binary code is converted into an instruction sequence using disassembly or decompilation technology, and the instruction sequence is divided into multiple target basic blocks. Based on the call relationship between the target basic blocks, a target instruction flow graph is drawn. This graph reflects the execution process of the instructions in the target binary file. In the vulnerability search stage, a graph matching algorithm (such as subgraph isomorphism, graph similarity algorithm, etc.) is used to compare the instruction flow graph with the target instruction flow graph. The goal is to find the parts of the target instruction flow graph that match the instruction flow graph, which may contain potential vulnerability code. Based on the results of graph matching, extract the parts of the target instruction sequence that match the instruction flow graph in the search pattern, that is, the suspicious instruction sequence. Apply the search pattern to the extracted suspicious instruction sequence for detailed vulnerability search. This includes checking whether the specific instructions, function calls, data flows, etc. in the suspicious instruction sequence match the known vulnerability features. If the search pattern finds a full or partial match in the suspicious instruction sequence, it can be preliminarily determined that there is a vulnerability in the target binary file. Further verification can be continued on the code that is preliminarily determined to be a vulnerability to ensure that it is indeed a vulnerability, not a false positive. If it is confirmed to be a vulnerability, a corresponding repair plan is formulated according to the severity and scope of the vulnerability, and the repair is implemented as soon as possible. In addition, the vulnerability discovery, verification and repair process can be recorded as a report for subsequent security audits and vulnerability management. In this way, potential vulnerabilities in the target binary file can be identified more accurately, false positives and missed negatives can be reduced, and the efficiency and accuracy of vulnerability search can be improved.
[0091] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a vulnerability detection device for an application program, such as Figure 3 As shown, the device comprises:
[0092] A vulnerability analysis module is used to extract vulnerability code samples and vulnerability context samples corresponding to the vulnerability code samples from different versions of binary files containing the vulnerability for each vulnerability among the known multiple vulnerabilities, perform feature analysis on the vulnerability code samples to determine unified vulnerability features corresponding to different versions of binary files, and determine vulnerability context information corresponding to different versions of binary files according to the vulnerability context samples, wherein the unified vulnerability features are instruction sequences containing wildcards and placeholders, and the vulnerability context information includes instructions and / or function calls corresponding to the vulnerability context samples;
[0093] A pattern compilation module, used to determine vulnerability identification information of each vulnerability according to the unified vulnerability sample features and vulnerability context information corresponding to each vulnerability, construct a pattern set containing the vulnerability identification information of each vulnerability, and compile each vulnerability identification information in the pattern set into a search pattern;
[0094] The vulnerability detection module is used to parse the target binary file of the application to be identified to obtain a target instruction sequence, and perform a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0095] In the embodiment of the present application, optionally, the mode compilation module is further used to:
[0096] Importing the pattern set into a vulnerability search tool, and using the vulnerability search tool to compile vulnerability identification information of each vulnerability in the pattern set to obtain a search pattern for each vulnerability;
[0097] Parsing the target binary file of the application to be identified to obtain a target instruction sequence, and performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file, including:
[0098] The target binary file of the application to be identified is input into the vulnerability search tool, the target binary file is parsed into a target instruction sequence by the vulnerability search tool, and the target instruction sequence is searched for vulnerabilities according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0099] In the embodiment of the present application, optionally, the vulnerability detection module is further used to:
[0100] The vulnerability search tool creates a matching table, matches the target instruction sequence character by character from the beginning according to the search pattern, records the characters and character positions in the target instruction sequence that at least partially match the search pattern in the matching table, determines the offset length of the next vulnerability search based on the first character of the search pattern and the characters and character positions recorded in the matching table when a mismatch occurs, determines the next vulnerability search position of the target instruction sequence according to the offset length, and continues to search for vulnerabilities in the target instruction sequence based on the next vulnerability search position until the end of the target instruction sequence is searched.
[0101] In an embodiment of the present application, optionally, the search pattern includes a unified vulnerability sample feature string and a vulnerability context information string, and the vulnerability context information string includes an instruction string corresponding to an instruction contained in the vulnerability context information and / or a function call string corresponding to a function call;
[0102] The vulnerability detection module is also used for:
[0103] Recording characters and character positions in the target instruction sequence that at least partially match the unified vulnerability sample feature string in the search pattern in the matching table;
[0104] In the case of searching for a code segment that completely matches the unified vulnerability sample feature string, the to-be-identified context information corresponding to the completely matched code segment is obtained, and whether the completely matched code segment is a vulnerability is determined based on the similarity between the to-be-identified context information and the context information string, and the next vulnerability search position is determined based on the position of the completely matched code segment in the target instruction sequence to continue the vulnerability search.
[0105] In the embodiment of the present application, optionally, the vulnerability analysis module is further used to:
[0106] Performing a sequential analysis on each of the vulnerability code samples, sequentially identifying the same instruction sequence segments and the different instruction sequence segments in each of the vulnerability code samples, determining the number of characters in the different instruction sequence segments, representing the different instruction sequence segments with a character number of 1 as the wildcard, representing the different instruction sequence segments with a character number greater than 1 as the placeholder, and sequentially splicing the same instruction sequence segments, the wildcards, and the placeholders to obtain unified vulnerability features corresponding to different versions of binary files.
[0107] In the embodiment of the present application, optionally, the vulnerability analysis module is further used to:
[0108] Dividing the instruction sequence of the unified vulnerability feature into a plurality of basic blocks, wherein the basic blocks are composed of instructions executed sequentially;
[0109] Generate a basic block node graph according to each basic block, and construct an instruction flow graph according to the calling relationship between each basic block, wherein the instruction flow graph is composed of multiple basic block node graphs and edges between the basic block node graphs;
[0110] In the embodiment of the present application, optionally, the vulnerability detection module is further used to:
[0111] Dividing the target instruction sequence into a plurality of target basic blocks, and drawing a target instruction flow graph corresponding to the target instruction sequence based on the calling relationship between the target basic blocks;
[0112] The target instruction flow graph is graph matched according to the instruction flow graph to obtain a suspicious instruction sequence in the target instruction sequence based on the portion of the target instruction flow graph that matches the instruction flow graph, and a vulnerability search is performed on the suspicious instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
[0113] In the embodiment of the present application, optionally, the vulnerability detection module is further used to:
[0114] If it is determined that there is a vulnerability in the application to be identified, a vulnerability code snippet corresponding to the vulnerability is marked in the target binary file, and a patch code corresponding to the vulnerability is obtained;
[0115] When the application to be identified is running, the patch code is loaded into the process space, the vulnerability code of the target binary file is located based on the mark of the vulnerability code fragment, and a jump instruction pointing to the patch code is inserted at the located vulnerability code fragment position, so that the target binary file skips the vulnerability code fragment and jumps back to the code after the vulnerability code fragment after the patch code execution is completed to continue running.
[0116] It should be noted that for other corresponding descriptions of the functional units involved in the vulnerability detection device for an application provided in the embodiment of the present application, reference can be made to Figure 1 to Figure 2 The corresponding description in the method will not be repeated here.
[0117] The embodiment of the present application also provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.
[0118] Those skilled in the art will appreciate that the structure of the above-mentioned computer device is only a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components, or combine certain components, or have a different arrangement of components.
[0119] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0120] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0121] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0122] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0123] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0124] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for detecting a vulnerability in an application program, characterized in that: The method comprises: For each vulnerability among the known multiple vulnerabilities, extract vulnerability code samples and vulnerability context samples corresponding to the vulnerability code samples from different versions of binary files containing the vulnerability, perform feature analysis on the vulnerability code samples to determine unified vulnerability features corresponding to different versions of binary files, and determine vulnerability context information corresponding to different versions of binary files according to the vulnerability context samples, wherein the unified vulnerability feature is an instruction sequence containing wildcards and placeholders, and the vulnerability context information includes instructions and / or function calls corresponding to the vulnerability context samples; Determine vulnerability identification information of each vulnerability according to unified vulnerability sample features and vulnerability context information corresponding to each vulnerability, construct a pattern set containing vulnerability identification information of each vulnerability, and compile each vulnerability identification information in the pattern set into a search pattern; Parsing a target binary file of the application to be identified to obtain a target instruction sequence, and performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file; Among them, feature analysis is performed on the vulnerability code samples to determine unified vulnerability features corresponding to different versions of binary files, including: sequential analysis is performed on each of the vulnerability code samples, identical instruction sequence segments and different instruction sequence segments in each of the vulnerability code samples are sequentially identified, the number of characters in the different instruction sequence segments is determined, the different instruction sequence segments with a character number of 1 are represented as the wildcard, the different instruction sequence segments with a character number greater than 1 are represented as the placeholder, and the identical instruction sequence segments, the wildcard and the placeholder are sequentially spliced to obtain unified vulnerability features corresponding to different versions of binary files.
2. The method for detecting application vulnerabilities according to claim 1, characterized in that: Compile each vulnerability identification information in the pattern set into a search pattern, including: Importing the pattern set into a vulnerability search tool, and using the vulnerability search tool to compile vulnerability identification information of each vulnerability in the pattern set to obtain a search pattern for each vulnerability; Parsing the target binary file of the application to be identified to obtain a target instruction sequence, and performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file, including: The target binary file of the application to be identified is input into the vulnerability search tool, the target binary file is parsed into a target instruction sequence by the vulnerability search tool, and the target instruction sequence is searched for vulnerabilities according to the search pattern to determine whether there is a vulnerability in the target binary file.
3. The method for detecting application vulnerabilities according to claim 2, characterized in that: Performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file includes: The vulnerability search tool creates a matching table, matches the target instruction sequence character by character from the beginning according to the search pattern, records the characters and character positions in the target instruction sequence that at least partially match the search pattern in the matching table, determines the offset length of the next vulnerability search based on the first character of the search pattern and the characters and character positions recorded in the matching table when a mismatch occurs, determines the next vulnerability search position of the target instruction sequence according to the offset length, and continues to search for vulnerabilities in the target instruction sequence based on the next vulnerability search position until the end of the target instruction sequence is searched.
4. The method for detecting application vulnerabilities according to claim 3, characterized in that: The search pattern includes a unified vulnerability sample feature string and a vulnerability context information string, wherein the vulnerability context information string includes an instruction string corresponding to an instruction contained in the vulnerability context information and / or a function call string corresponding to a function call; Recording characters and character positions in the target instruction sequence that at least partially match the search pattern in the matching table includes: Recording characters and character positions in the target instruction sequence that at least partially match the unified vulnerability sample feature string in the search pattern in the matching table; The method further comprises: In the case of searching for a code segment that completely matches the unified vulnerability sample feature string, the to-be-identified context information corresponding to the completely matched code segment is obtained, and whether the completely matched code segment is a vulnerability is determined based on the similarity between the to-be-identified context information and the context information string, and the next vulnerability search position is determined based on the position of the completely matched code segment in the target instruction sequence to continue the vulnerability search.
5. The method for detecting a vulnerability in an application according to any one of claims 1 to 4, characterized in that: Before parsing the target binary file of the application to be identified to obtain the target instruction sequence, the method further includes: Dividing the instruction sequence of the unified vulnerability feature into a plurality of basic blocks, wherein the basic blocks are composed of instructions executed sequentially; Generate a basic block node graph according to each basic block, and construct an instruction flow graph according to the calling relationship between each basic block, wherein the instruction flow graph is composed of multiple basic block node graphs and edges between the basic block node graphs; Performing a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file includes: Dividing the target instruction sequence into a plurality of target basic blocks, and drawing a target instruction flow graph corresponding to the target instruction sequence based on the calling relationship between the target basic blocks; The target instruction flow graph is graph matched according to the instruction flow graph to obtain a suspicious instruction sequence in the target instruction sequence based on the portion of the target instruction flow graph that matches the instruction flow graph, and a vulnerability search is performed on the suspicious instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file.
6. The method for detecting a vulnerability in an application program according to any one of claims 1 to 4, characterized in that: The method further comprises: If it is determined that there is a vulnerability in the application to be identified, a vulnerability code snippet corresponding to the vulnerability is marked in the target binary file, and a patch code corresponding to the vulnerability is obtained; When the application to be identified is running, the patch code is loaded into the process space, the vulnerability code of the target binary file is located based on the mark of the vulnerability code fragment, and a jump instruction pointing to the patch code is inserted at the located vulnerability code fragment position, so that the target binary file skips the vulnerability code fragment and jumps back to the code after the vulnerability code fragment after the patch code execution is completed to continue running.
7. A device for detecting a vulnerability in an application program, characterized in that: The device comprises: A vulnerability analysis module is used to extract vulnerability code samples and vulnerability context samples corresponding to the vulnerability code samples from different versions of binary files containing the vulnerability for each vulnerability among the known multiple vulnerabilities, perform feature analysis on the vulnerability code samples to determine unified vulnerability features corresponding to different versions of binary files, and determine vulnerability context information corresponding to different versions of binary files according to the vulnerability context samples, wherein the unified vulnerability features are instruction sequences containing wildcards and placeholders, and the vulnerability context information includes instructions and / or function calls corresponding to the vulnerability context samples; A pattern compilation module, used to determine vulnerability identification information of each vulnerability according to the unified vulnerability sample features and vulnerability context information corresponding to each vulnerability, construct a pattern set containing the vulnerability identification information of each vulnerability, and compile each vulnerability identification information in the pattern set into a search pattern; A vulnerability detection module is used to parse the target binary file of the application to be identified to obtain a target instruction sequence, and perform a vulnerability search on the target instruction sequence according to the search pattern to determine whether there is a vulnerability in the target binary file; The vulnerability analysis module is also used to: perform sequential analysis on each of the vulnerability code samples, sequentially identify the same instruction sequence segments and the different instruction sequence segments in each of the vulnerability code samples, determine the number of characters in the different instruction sequence segments, represent the different instruction sequence segments with a character number of 1 as the wildcard, represent the different instruction sequence segments with a character number greater than 1 as the placeholder, and sequentially splice the same instruction sequence segments, the wildcards and the placeholders to obtain unified vulnerability features corresponding to different versions of binary files.
8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Similar vulnerability detection method and device for binary program
CN113468525A
Binary code-oriented reproduction vulnerability detection method and system
CN115129591A
