A large-scale software vulnerability detection method and system using vulnerability slicing

By using the vulnerability slicing method in large-scale software to extract and calculate vulnerability and patch characteristics, the vulnerability detection problem introduced by code cloning is solved, efficient and accurate vulnerability detection is achieved, and misjudgment of patch codes is avoided.

CN114186240BActive Publication Date: 2024-10-01NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111371625.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-18
Publication Date
2024-10-01
Estimated Expiration
2041-11-18

AI Technical Summary

Technical Problem

Existing technology is difficult to accurately detect vulnerabilities introduced by code cloning in large-scale software, and it is easy to misjudge patch code as vulnerable code, resulting in unsatisfactory vulnerability detection results.

Method used

The vulnerability slicing method is used to extract code blocks containing vulnerability characteristics and patch characteristics, establish indexes, and calculate similarities to improve the accuracy and recall rate of vulnerability detection and prevent patch code from being misjudged as vulnerable code.

Benefits of technology

Effectively extract vulnerability information in large-scale software, improve the accuracy and recall rate of vulnerability detection, reduce the number of code block comparisons, improve detection efficiency, and avoid misjudgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114186240B_ABST
    Figure CN114186240B_ABST
Patent Text Reader

Abstract

The present invention discloses a large-scale software vulnerability detection method and system using vulnerability slicing, including extracting a function code block containing function features from the detected software; extracting a vulnerable code block containing vulnerability features and patch features from a vulnerable code library using a program slicing method; using the vulnerable code block to establish an index, using the function code block to query the index, and obtaining a candidate set; for each function code block in the detected software, calculating the similarity between the function features of the code block in the candidate set and the vulnerability features and patch features of the function code block, and obtaining the vulnerability detection result of the function code block according to the similarity. The present invention takes into account the effect and applicable scale of detection, can be applied to large-scale software vulnerability detection scenarios, can fully extract vulnerability information in vulnerable codes, can effectively improve the accuracy and recall rate of vulnerability detection, and can prevent patch codes from being misjudged as vulnerable codes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical fields of code cloning, program slicing and vulnerability detection, and in particular to a large-scale software vulnerability detection method and system using vulnerability slicing. Background Art

[0002] When a piece of code is copied to a new software without modification or with modification and becomes part of the software, this operation is called code cloning. Code cloning can speed up software development and reduce the cost of software development, so it is common in actual software development. Studies show that in general software projects, there is a common 5%-20% of duplicate code. Even high-quality systems recognized in the computing field such as X Windows System have 19% code clones. In recent years, the number of open source projects has increased rapidly. In October 2021, the number of open source projects published on GitHub, the world's largest open source project website, has exceeded 200 million. The disclosure, sharing and reuse of code in open source projects have made code cloning more common. In 2021, the Synopsys Cybersecurity Research Center conducted an open source component reuse analysis and audit on anonymous data from more than 1,500 commercial code repositories in 17 industries. The results show that 98% of the code repositories audited contain open source components.

[0003] While code cloning shortens the software development cycle and reduces development costs, it also brings many disadvantages, such as increasing the cost of software maintenance, reducing software quality, easily causing legal conflicts, and even causing the spread of code vulnerabilities. Among them, the spread of code vulnerabilities caused by code cloning is very serious and threatens the security of software to a large extent. For example, the OpenSSL Heart-bleed vulnerability (CVE-2014-0160) has seriously affected a variety of software systems including websites, operating systems, and Web applications. The reason is that these systems use the OpenSSL library or reuse a part of the OpenSSL library in their own software projects. Due to the widespread existence of code cloning, even if a vulnerability in a software is discovered and repaired, it cannot be guaranteed that all the same vulnerabilities in the software or other software that reuses the corresponding code are repaired. This means that there are a large number of vulnerabilities that have been made public in the source code that will not be discovered and repaired. Research reports show that there are a large number of vulnerabilities introduced by code cloning in existing software that have not yet been discovered. How to effectively detect these vulnerabilities has gradually attracted the attention of more and more researchers. Many methods have been proposed to support vulnerability detection, that is, to detect vulnerable fragments in software. Such as static analysis, fuzzy methods or symbolic execution. These methods use common vulnerability feature extraction and other means to find vulnerabilities in the code. The vulnerabilities propagated by code clones have the characteristics of code similarity. Based on this, more and more researchers are trying to solve this problem from the perspective of similarity.

[0004] Vulnerability detection methods based on code similarity have a long history. Early methods directly used vulnerable functions as inputs and found similar functions through code clone detection. These found functions were confirmed to be vulnerable functions. Code clone detection methods were not designed to detect software vulnerabilities at the beginning, and the detection effect of such methods was not ideal. Subsequently, researchers proposed methods for targeted processing or optimization for vulnerability detection based on clone detection. Unlike previous clone detection methods, such methods have made special treatments for vulnerability detection. They extract vulnerability features from known vulnerable codes and then find potential vulnerable codes through feature matching methods. This method has greatly improved the method based on function matching, but there are still shortcomings in the existing related work, and it is impossible to accurately find vulnerabilities in large-scale codes. For example, ReDeBug uses a sliding window method to extract vulnerability features and uses a Bloom filter to speed up the execution of the method. This method uses the modified part of the patch and the previous and next lines as the source of vulnerability features, and the extracted vulnerability information is insufficient. MVP uses a slicing-based vulnerability extraction method and performs detection based on code attribute graphs, which can capture rich vulnerability information. However, the generation of code attribute graphs takes a long time and is not suitable for large-scale code scenarios. VUDDY effectively improves detection accuracy based on the proposed abstraction and regularization methods. At the same time, it improves the efficiency of large-scale code processing by using length filtering methods. However, this method has the problem of mistaking patches in the code for vulnerable code. Summary of the invention

[0005] Technical problem to be solved by the present invention: In view of the above-mentioned problems in the prior art, a large-scale software vulnerability detection method and system using vulnerability slicing are provided. The present invention takes into account both the detection effect and the applicable scale, can be applied to large-scale software vulnerability detection scenarios, can fully extract the vulnerability information in the vulnerable code, and can effectively improve the accuracy and recall rate of vulnerability detection; by extracting patch features during feature extraction, the patch features will be taken into account when calculating the code similarity, which can prevent the patch code from being misjudged as vulnerable code.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A large-scale software vulnerability detection method using vulnerability slicing, comprising:

[0008] 1) Extract the function code blocks containing function features from the detected software; use the program slicing method to extract the vulnerable code blocks containing vulnerability features and patch features from the vulnerable code library;

[0009] 2) Use the vulnerable code block to create an index, and use the function code block to query the index to obtain a candidate set;

[0010] 3) For each function code block in the software to be detected, calculate the similarity between the function features of the code blocks in the candidate set and the vulnerability features and patch features of the function code block, and obtain the vulnerability detection result of the function code block according to the similarity.

[0011] Optionally, in step 1), extracting the function code blocks containing function features from the software to be detected includes:

[0012] 1.1A) Obtain and scan the software to be detected, and extract the functions in the code at the function granularity.

[0013] 1.2A) For each function, extract the function features to obtain the Token sequence.

[0014] 1.3A) Count the frequencies of various Tokens in each level of features respectively, save them as function code blocks in the form of binary tuples <Token, frequency>, and output and save them as the intermediate file of the software to be detected.

[0015] Optionally, the program slicing method in step 1) refers to using the modified parts before and after the vulnerability file repair as the slicing criterion, and slicing forward and backward.

[0016] Optionally, in step 1), using the program slicing method to extract the vulnerability code blocks containing vulnerability features and patches from the vulnerability code library includes:

[0017] 1.1B) Scan the vulnerability code library and extract the vulnerability functions and patch functions therein.

[0018] 1.2B) For each vulnerability function, first use the tool to obtain the program dependence graph of the function, and then use the deleted lines before and after the vulnerability file repair by differential comparison as the slicing criterion, and slice forward and backward in the program dependence graph. The statements obtained by slicing are the extracted vulnerability information; for each vulnerability function, first use the tool to obtain the program dependence graph of the function, and then use the added lines before and after the vulnerability file repair by differential comparison as the slicing criterion, and slice forward and backward in the program dependence graph. The statements obtained by slicing are the extracted patch information.

[0019] 1.3B) Extract the vulnerability features for the vulnerability information; extract the patch features for the patch information.

[0020] 1.4B) Count the frequencies of various Tokens in the vulnerability features and patch features respectively, save them as vulnerability code blocks in the form of binary tuples <Token, frequency>, and output and form the intermediate file of the vulnerability information library.

[0021] Optionally, step 2) includes:

[0022] 2.1) Load the intermediate file of the vulnerability information library and establish a global token frequency table according to the token sequence in the vulnerability feature;

[0023] 2.2) According to the global token frequency table, the vulnerable features in the vulnerable code block are sorted from low to high by frequency, and the first specified number of tokens are extracted as sub-blocks, and the sub-blocks are used to create indexes;

[0024] 2.3) Load the intermediate file of the software to be tested, sort the function features in the function code block from low to high according to the usage frequency according to the global token frequency table, and extract the first specified number of tokens as sub-blocks;

[0025] 2.4) Use the token of the sub-block in the function code block to query the index, and the returned result is used as the candidate set.

[0026] Optionally, the first specified number of tokens in step 2.2) refers to the first |t*θ| tokens, where t represents the length of the feature, and θ represents the set similarity threshold.

[0027] Optionally, the first specified number of tokens in step 2.3) refers to the first |t*θ| tokens, where t represents the length of the feature, and θ represents the set similarity threshold.

[0028] Optionally, step 3) includes: for each function code block in the detected software, calculating the similarity between the function features of the function code block and the vulnerability features of the code blocks in the candidate set, the calculation method is to first calculate the number of identical tokens between the two features, and then calculate the ratio of the number of identical tokens here to the total number of tokens of the corresponding vulnerable code block as the vulnerability similarity. If the vulnerability similarity is lower than the set threshold, it is determined that the function code block does not contain the vulnerable code, and the process directly returns to the end; otherwise, the similarity between the function features of the function code block and the patch features of the code blocks in the candidate set is calculated. If the similarity is higher than the threshold, it is determined that the queried function code block has been patched and is not vulnerable; otherwise, the queried function code block is determined to be a vulnerable function code block.

[0029] In addition, the present invention also provides a large-scale software vulnerability detection system using vulnerability slicing, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute the steps of the large-scale software vulnerability detection method using vulnerability slicing.

[0030] In addition, the present invention also provides a computer-readable storage medium, which stores a computer program, and the computer program is used to be programmed or configured by a computer device to execute the steps of the large-scale software vulnerability detection method using vulnerability slicing.

[0031] Compared with the prior art, the present invention has the following advantages: The present invention uses the program slicing method to effectively extract accurate vulnerability information, making the extraction of representation more representative. In order to enable the method to run on large-scale codes, the present invention adopts a sub-block filtering method to reduce the number of code block comparisons, effectively improving the efficiency of the method. At the same time, a time-saving Token-based method is used to design the method. By extracting patch features during feature extraction, the patch features will be taken into account when calculating code similarity, which can prevent the patch code from being misjudged as vulnerable code. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 The figure is a schematic diagram of the method flow of an embodiment of the present invention.

[0033] Figure 2 The figure is a flowchart of the steps of extracting function code blocks in an embodiment of the present invention.

[0034] Figure 3 The figure is a flow chart of the steps of extracting vulnerable code blocks in an embodiment of the present invention.

[0035] Figure 4 The figure is a flowchart of the step of extracting a candidate set in an embodiment of the present invention.

[0036] Figure 5 Flow chart of vulnerability detection steps in an embodiment of the present invention. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0038] like Figure 1 As shown, the large-scale software vulnerability detection method using vulnerability slicing in this embodiment includes:

[0039] 1) Extract the function code blocks containing function features from the detected software; use the program slicing method to extract the vulnerable code blocks containing vulnerability features and patch features from the vulnerable code library;

[0040] 2) Use the vulnerable code block to create an index, and use the function code block to query the index to obtain a candidate set;

[0041] 3) For each function code block in the software to be detected, calculate the similarity between the function features of the code blocks in the candidate set and the vulnerability features and patch features of the function code block, and obtain the vulnerability detection result of the function code block based on the similarity.

[0042] This embodiment of the large-scale software vulnerability detection method using vulnerability slicing involves two types of software code. One is the software to be detected, which refers to the code input by the user and needs to detect the vulnerabilities therein. The other is the vulnerability code library, which collects public vulnerabilities and patches for comparison with the software to be detected. The first step of this method requires preprocessing the software to be detected to extract function code blocks. Extract the functions in the project and extract function features for the functions; this embodiment preprocesses the vulnerability code library to extract vulnerability code blocks. In the vulnerability code library, there are vulnerability codes and patches. To extract vulnerability features, first use the slicing method to extract information related to vulnerabilities. Specifically, use the modified part in the vulnerability file as the slicing criterion and slice forward and backward. Then use the same method to extract vulnerability features from the vulnerability information. Use the same method for patches to extract patch features. Package the vulnerability features and patch features to form vulnerability code blocks.

[0043] As Figure 2 shown, the extraction of function code blocks containing function features from the software to be detected in step 1) of this embodiment includes:

[0044] 1.1A) Obtain and scan the software to be detected, and extract the functions in the code at the function granularity;

[0045] 1.2A) For each function, extract function features to obtain a Token (word) sequence;

[0046] 1.3A) Statistically count the frequencies of various Tokens in each level of features, save them in the form of a binary tuple <Token, frequency> as a function code block, and output and save them as an intermediate file of the software to be detected.

[0047] In this embodiment, the program slicing method in step 1) refers to using the modified parts before and after the repair of the vulnerability file as the slicing criterion and slicing forward and backward. Specifically, as Figure 3 shown, the extraction of vulnerability code blocks containing vulnerability features and patches from the vulnerability code library using the program slicing method in step 1) includes:

[0048] 1.1B) Scan the vulnerability code library and extract the vulnerability functions and patch functions therein;

[0049] 1.2B) For each vulnerability function, first use a tool (such as the Joern tool in this embodiment, and other similar tools can also be used) to obtain the program dependence graph of the function, and then use the deleted lines before and after the repair of the vulnerability file by differential comparison (implemented by the diff tool in this embodiment) as the slicing criterion, and slice forward and backward in the program dependence graph. The statements obtained by slicing are the extracted vulnerability information; for each vulnerability function, first use a tool (such as the Joern tool in this embodiment, and other similar tools can also be used) to obtain the program dependence graph of the function, and then use the newly added lines before and after the repair of the vulnerability file by differential comparison (implemented by the diff tool in this embodiment) as the slicing criterion, and slice forward and backward in the program dependence graph. The statements obtained by slicing are the extracted patch information;

[0050] 1.3B) Extract vulnerability features for vulnerability information; extract patch features for patch information;

[0051] 1.4B) Count the frequencies of various Tokens in the vulnerability features and patch features respectively, save them in the form of a binary tuple <Token, frequency> as the vulnerability code block, and output the intermediate file for forming the vulnerability information library.

[0052] As Figure 4 shown, step 2) of this embodiment includes:

[0053] 2.1) Load the intermediate file of the vulnerability information library, and establish a global Token frequency table according to the Token sequence in the vulnerability features;

[0054] 2.2) According to the global Token frequency table, sort the vulnerability features in the vulnerability code block from low to high according to the frequency, and extract the first specified number of Tokens as sub-blocks, and use the sub-blocks to establish an index;

[0055] 2.3) Load the file, and sort the function features in the function code block from low to high according to the usage frequency according to the global Token frequency table, and extract the first specified number of Tokens as sub-blocks;

[0056] 2.4) Use the Tokens of the sub-blocks in the function code block to query the index, and the returned result is used as the candidate set.

[0057] In this embodiment, the first specified number of Tokens in step 2.2) refers to the first |t*θ| Tokens, where t represents the length of the feature and θ represents the set similarity threshold.

[0058] In this embodiment, the first specified number of tokens in step 2.3) refers to the first |t*θ| tokens, where t represents the length of the feature, and θ represents the set similarity threshold.

[0059] like Figure 5 As shown, step 3) of this embodiment includes: for each function code block in the detected software, calculating the similarity between the function feature of the function code block and the vulnerability feature of the code block in the candidate set, the calculation method is to first calculate the number of identical tokens between the two features, and then calculate the ratio of the number of identical tokens here to the total number of tokens of the corresponding vulnerable code block as the vulnerability similarity. If the vulnerability similarity is lower than the set threshold, it is determined that the function code block does not contain the vulnerable code, and the process directly returns to the end; otherwise, the similarity between the function feature of the function code block and the patch feature of the code block in the candidate set is calculated. If the similarity is higher than the threshold, it is determined that the queried function code block has been patched and does not have a vulnerability; otherwise, the queried function code block is determined to be a vulnerable function code block.

[0060] In summary, the large-scale software vulnerability detection method using vulnerability slicing in this embodiment first extracts the function code block for the detected software; then extracts the vulnerability features and patch features from the vulnerable code library to form a vulnerable code block; then uses the vulnerable code to establish an index, uses the function code block to query the index, and obtains a candidate set; finally, calculates the similarity between the candidate set and the queried function code block to obtain the vulnerability detection result. This example of a large-scale software vulnerability detection method using vulnerability slicing can extend the vulnerability detection method to large-scale scenarios while ensuring the accuracy and recall of the detection. By extracting the patch features during feature extraction, the patch features will be taken into account when calculating the code similarity, which can prevent the patch code from being misjudged as vulnerable code. In order to meet the efficiency requirements of large-scale code vulnerability detection, this embodiment adopts a large-scale software vulnerability detection method of vulnerability slicing based on the Token method to extract features, and only processes at the code lexical level, without involving grammatical processing such as code structure tree and attribute graph with large time and space loss, which can greatly improve the code application scale; this embodiment adopts a large-scale software vulnerability detection method of vulnerability slicing using a code similarity analysis method based on sub-block filtering, first screens out code blocks that may contain vulnerable codes, so as to avoid one-to-one comparison between function code blocks and vulnerable code blocks, which can effectively reduce the number of comparisons between code blocks, thereby effectively improving the efficiency of code vulnerability detection. In order to improve the accuracy and high recall rate of vulnerability detection, this embodiment adopts a large-scale software vulnerability detection method of vulnerability slicing using a program slicing method to improve the accuracy of vulnerability information extraction in the code, avoid interference from invalid information, and thus improve the vulnerability detection effect; during vulnerability detection, the repaired code patch is often mistaken for vulnerable code. To solve this problem, this embodiment adopts a large-scale software vulnerability detection method of vulnerability slicing, adding patch information as a reference. Therefore, the large-scale software vulnerability detection method using vulnerability slicing in this embodiment can effectively improve the high precision and high recall rate of detection while improving the efficiency of large-scale code vulnerability detection.

[0061] In addition, the present embodiment also provides a large-scale software vulnerability detection system using vulnerability slicing, including: a preprocessing unit: performing some preprocessing on the input file, including removing comments, deleting spaces, tabs, line breaks, renaming identifiers, renaming variables, replacing string constants, replacing function calls, program slicing and other preprocessing functions, extracting corresponding features and outputting intermediate results; a candidate set extraction unit: using vulnerable code blocks to establish indexes, and using function code blocks to query indexes to extract candidate sets; a vulnerability detection unit: calculating the vulnerability similarity and patch similarity between the query code block and the candidate set. If the vulnerability similarity exceeds a threshold and the patch code similarity is lower than a threshold, the query code block is regarded as a vulnerability function. This embodiment adopts a large-scale software vulnerability detection method based on vulnerability slicing, which takes into account both the detection effect and the applicable scale. By using a Token-based preprocessing method and a sub-block filtering-based detection method, the method can be applied to large-scale software vulnerability detection scenarios; at the same time, a program slicing-based feature extraction method is adopted to fully extract the vulnerability information in the vulnerable code, which can effectively improve the accuracy and recall rate of vulnerability detection; by extracting patch features during feature extraction, the patch features will be taken into account when calculating code similarity, which can prevent the patch code from being misjudged as vulnerable code.

[0062] In addition, this embodiment also provides a large-scale software vulnerability detection system using vulnerability slicing, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute the steps of the aforementioned large-scale software vulnerability detection method using vulnerability slicing.

[0063] In addition, this embodiment also provides a computer-readable storage medium, which stores a computer program, and the computer program is used to be programmed or configured by a computer device to execute the steps of the aforementioned large-scale software vulnerability detection method using vulnerability slicing.

[0064] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0065] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A large-scale software vulnerability detection method using vulnerability slicing, characterized in that: Including: 1) Extract function code blocks containing function features from the software to be detected; use the program slicing method for the vulnerability code library to extract vulnerability code blocks containing vulnerability features and patch features; 2) Establish an index using the vulnerability code blocks, query the index using the function code blocks, and obtain a candidate set; 3) For each function code block in the software to be detected, calculate the similarity between the function features of the code blocks in the candidate set and the vulnerability features and patch features of the function code block, and obtain the vulnerability detection result of the function code block according to the similarity; In step 1), using the program slicing method for the vulnerability code library to extract vulnerability code blocks containing vulnerability features and patches includes: 1.1B) Scan the vulnerability code library and extract the vulnerability functions and patch functions therein; 1.2B) For each vulnerability function, first use a tool to obtain the program dependence graph of the function, and then use the deleted lines before and after the vulnerability file is repaired by differential comparison as the slicing criterion to slice forward and backward in the program dependence graph. The statements obtained by slicing are the extracted vulnerability information; for each vulnerability function, first use a tool to obtain the program dependence graph of the function, and then use the newly added lines before and after the vulnerability file is repaired by differential comparison as the slicing criterion to slice forward and backward in the program dependence graph. The statements obtained by slicing are the extracted patch information; 1.3B) Extract vulnerability features for the vulnerability information; extract patch features for the patch information; 1.4B) Count the frequencies of various Tokens in the vulnerability features and patch features respectively, save them in the form of a binary tuple <Token, frequency> as the vulnerability code block, and output and form an intermediate file of the vulnerability information library; Step 3) includes: For each function code block in the software to be detected, calculate the similarity between the function features of the function code block and the vulnerability features of the code blocks in the candidate set. The calculation method is to first calculate the number of identical Tokens between the two features, and then calculate the ratio of the number of identical Tokens here to the total number of Tokens in the corresponding vulnerability code block as the vulnerability similarity. If the vulnerability similarity is lower than the set threshold, it is determined that the function code block does not contain vulnerability code, and directly return and end; otherwise, calculate the similarity between the function features of the function code block and the patch features of the code blocks in the candidate set. If the similarity is higher than the threshold, it is determined that the queried function code block has been patched and does not have vulnerability; otherwise, it is determined that the queried function code block is a vulnerable function code block.

2. The large-scale software vulnerability detection method using vulnerability slicing according to claim 1 is characterized in that: In step 1), extracting function code blocks containing function features from the software to be detected includes: 1.1A) Obtain and scan the software to be detected, and extract the functions in the code at the function granularity; 1.2A) For each function, extract the function features and obtain a Token sequence; 1.3A) Count the frequencies of various Tokens in each level of features respectively, save them in the form of a binary tuple <Token, frequency> as the function code block, and output and save it as an intermediate file of the software to be detected.

3. The large-scale software vulnerability detection method using vulnerability slicing according to claim 2 is characterized in that: The program slicing method in step 1) refers to slicing forward and backward using the modified parts of the vulnerable file before and after repair as a slicing criterion.

4. The large-scale software vulnerability detection method using vulnerability slicing according to claim 1 is characterized in that: Step 2) includes: 2.1) Load the intermediate file of the vulnerability information library and establish a global token frequency table according to the token sequence in the vulnerability feature; 2.2) According to the global token frequency table, the vulnerable features in the vulnerable code block are sorted from low to high by frequency, and the first specified number of tokens are extracted as sub-blocks, and the sub-blocks are used to create indexes; 2.3) Load the intermediate file of the software to be tested, sort the function features in the function code block from low to high according to the global token frequency table, and extract the first specified number of tokens as sub-blocks; 2.4) Use the token of the sub-block in the function code block to query the index, and the returned result is used as the candidate set.

5. The large-scale software vulnerability detection method using vulnerability slicing according to claim 4 is characterized in that: The first specified number of tokens in step 2.2) refers to the first |t*θ| tokens, where t represents the length of the feature and θ represents the set similarity threshold.

6. The large-scale software vulnerability detection method using vulnerability slicing according to claim 4 is characterized in that: The first specified number of tokens in step 2.3) refers to the first |t*θ| tokens, where t represents the length of the feature and θ represents the set similarity threshold.

7. A large-scale software vulnerability detection system using vulnerability slicing, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the steps of the large-scale software vulnerability detection method using vulnerability slicing as described in any one of claims 1 to 6.

8. A computer-readable storage medium having a computer program stored therein, characterized in that: The computer program is used to be programmed or configured by a computer device to execute the steps of the large-scale software vulnerability detection method using vulnerability slicing as described in any one of claims 1 to 6.