Vulnerability alarm initial ranking method based on path input symbolic execution
Through a method based on path input symbolic execution, the accessibility and context sensitivity of the vulnerability alert path are analyzed, and the true probability of the vulnerability alert is calculated, which solves the problem of poor initial ranking of vulnerability alerts in the existing technology and achieves a more accurate Initial ranking of vulnerability alerts and reduction in false positive rate.
Patent Information
- Application Number
- CN202410970668.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-29
AI Technical Summary
Existing vulnerability alert initial ranking methods cannot effectively utilize the specific characteristics of vulnerability alert paths, resulting in poor ranking results and high false positive rates.
Using a method based on path input symbolic execution, by analyzing the path reachability, context sensitivity and vulnerability pattern satisfaction of the vulnerability alert path, the true probability of the vulnerability alert is calculated, and an initial ranking is performed to filter out unreachable vulnerability alerts to reduce the risk of vulnerability alerts. False alarm rate.
It effectively improves the accuracy of the initial ranking of vulnerability alerts, reduces the false positive rate, and improves the initial ranking effect of vulnerability alerts through path characteristic analysis.
Smart Images

Figure CN118862090A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vulnerability alarms, and relates to a vulnerability alarm initial ranking method based on path input symbol execution. Background Art
[0002] Initial ranking of vulnerability alert results from static program analysis is the key and prerequisite for the entire vulnerability alert re-ranking work. The quality of the initial ranking will greatly affect the effect of subsequent vulnerability alert re-ranking. However, the alert results obtained from static program analysis are not initially ranked, and their ranking is random. Because in the taint analysis of graph reachability, for a given program to be analyzed and analysis requirements, many path results that meet the conditions will be obtained; from the perspective of the analysis results, the probability of these paths being true is the same, because these paths all meet the analysis requirements. Therefore, it is necessary to design a method to use the specific characteristics of the path in the process of taint analysis to calculate the probability of these paths being true, so as to perform an overall initial ranking of vulnerability alerts. In previous research work, the research on the initial ranking of vulnerability alerts is still in a relatively preliminary stage, mainly simply assigning the same initial confidence to vulnerability alerts, and then randomly ranking the vulnerability alerts; or weighting the vulnerability alerts according to the vulnerability alert type to calculate a rough initial ranking. These methods cannot well reflect the probability that a vulnerability alert may be true, and the effect is not good. At present, there is no method in the existing research work that can make good use of the specific characteristics of the vulnerability warning path itself to initially rank vulnerability alerts, and the initial ranking effect of vulnerability alerts is not good.
[0003] Based on the above analysis, a vulnerability alert initial ranking method based on path input symbolic execution is currently proposed, which can use the specific characteristics of the alert path to analyze the probability that the vulnerability alert is initially true and perform effective initial ranking of vulnerability alerts. Summary of the invention
[0004] In response to the situation where the initial ranking of vulnerability alerts is not effective, the present invention describes an initial ranking method for vulnerability alerts based on symbolic execution of path input, which aims to use the specific characteristics of the alert path to analyze the probability that the vulnerability alert is initially true, and to perform effective initial ranking of vulnerability alerts.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] A method for initial ranking of vulnerability alerts based on path input symbolic execution includes the following steps: performing vulnerability identification on the intermediate representation of a program to be analyzed to obtain vulnerability alerts; also includes: analyzing the path of the vulnerability alert in combination with the satisfiability module theory to obtain the path accessibility and vulnerability pattern satisfaction of the vulnerability alert; preliminarily screening out false positives of the vulnerability alert based on the path accessibility of the vulnerability alert, and evaluating and optimizing the effect of the preliminary screening based on the path input symbol; calculating the probability that the path is true based on the path accessibility, context sensitivity, and vulnerability pattern satisfaction of the vulnerability alert, and initially ranking the vulnerability alerts based on the probability.
[0007] Furthermore, the vulnerability identification of the intermediate representation of the program to be analyzed includes: performing data flow analysis and taint analysis on the intermediate representation of the program to be analyzed, and identifying the vulnerabilities of the program to be analyzed according to security analysis requirements.
[0008] Furthermore, the path analysis of the vulnerability alert path includes: analyzing path accessibility, context sensitivity and vulnerability pattern satisfaction.
[0009] Furthermore, the path analysis of the vulnerability alert is performed in combination with the satisfiability modulo theory to obtain the path reachability of the vulnerability alert, including: after encrypting the vulnerability-related variables, the alarm path nodes are named according to the row numbers where the vulnerability-related variables are located to obtain one or more possible execution paths of the vulnerability alert; and the path reachability of the vulnerability alert is determined in combination with the one or more possible execution paths of the vulnerability alert and the control flow graph of the functions involved in the paths.
[0010] Furthermore, the one or more possible execution paths of the vulnerability alert are combined with the control flow graph of the function involved in the path to determine the path reachability of the vulnerability alert, and the determination basis includes: when any possible execution path of the vulnerability alert meets the reachability, it indicates that the path of the vulnerability alert is reachable; otherwise, it indicates that the path of the vulnerability alert is unreachable.
[0011] Furthermore, the path of the vulnerability alert is analyzed in combination with the satisfiability module theory to obtain the path reachability and vulnerability pattern satisfiability of the vulnerability alert, which is achieved through the following steps: generating constraints on the path reachability and vulnerability pattern satisfiability, submitting the constraints to the SMT tool for solving, and analyzing the reachability and vulnerability pattern satisfiability of one or more possible execution paths based on the solution results.
[0012] Furthermore, the constraints of generating path reachability and vulnerability pattern satisfaction are achieved through the following steps: obtaining relevant code involved in the path according to the nodes in the possible execution path, compiling the relevant code into an abstract syntax tree, performing symbolic execution on the abstract syntax tree, and collecting path constraints along the data flow.
[0013] Furthermore, the context sensitivity of the vulnerability alert is obtained by the following steps: using a context-sensitive static analysis tool to analyze the function call chain of the path corresponding to the vulnerability alert.
[0014] Furthermore, the optimization is performed based on the effect of preliminary screening based on path input symbol evaluation, including: comparing multiple vulnerability types before and after preliminary screening, and the false alarm rate of the ELAID method; the ELAID method includes identifying potential vulnerabilities in the program through indirect call analysis and taint analysis, generating and solving constraints of potential vulnerabilities through symbolic execution, thereby filtering false alarms.
[0015] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0016] The present invention proposes a vulnerability alarm initial ranking method based on path input symbolic execution, which can use the specific characteristics of the alarm path to analyze the probability that the vulnerability alarm is initially true, and effectively perform initial ranking of the vulnerability alarm. The present invention proposes a vulnerability alarm initial ranking method based on path input symbolic execution, which calculates the probability that the vulnerability alarm is true by analyzing the path accessibility, context sensitivity and vulnerability pattern satisfaction of the vulnerability alarm path, and performs an overall initial ranking of the vulnerability alarm according to the probability. By analyzing the accessibility of the path, the vulnerability alarms with unreachable paths are screened out, and the false alarm rate of the vulnerability alarm is initially reduced; the vulnerability alarm false alarms are initially screened by analyzing the accessibility of the path, and the performance of the initial screening of the vulnerability alarm false alarms is experimentally evaluated, so that the false alarm rate is slightly reduced. The present invention uses the specific characteristics of the alarm path to analyze the probability that the vulnerability alarm is initially true, and effectively performs initial ranking of the vulnerability alarms. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 The present invention provides an implementation framework for the vulnerability alert initial ranking method based on path input symbolic execution.
[0018] Figure 2 Control flow graph for vulfunc function;
[0019] Figure 3 This is the control flow graph of cmd_inject1 function;
[0020] Figure 4 Generate and solve flow charts for constraints. DETAILED DESCRIPTION
[0021] The technical solution provided by the present invention will be described in detail below in conjunction with specific embodiments. It should be understood that the following specific implementation methods are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0022] The present invention proposes a vulnerability alert initial ranking method based on path input symbolic execution, and the implementation steps are as follows: Figure 1 As shown, it includes identifying vulnerabilities in the intermediate representation of the program to be analyzed to obtain vulnerability alerts; analyzing the paths of vulnerability alerts in combination with the satisfiability module theory to obtain the path reachability and vulnerability pattern satisfiability of vulnerability alerts; preliminarily screening out false positives of vulnerability alerts based on the path reachability of vulnerability alerts, and evaluating and optimizing the effect of the preliminary screening based on the path input symbol; calculating the probability that the path is true based on the path reachability, context sensitivity, and vulnerability pattern satisfiability of the vulnerability alert, and initially ranking the vulnerability alerts based on the probability.
[0023] Furthermore, the vulnerability identification of the intermediate representation of the program to be analyzed includes: performing data flow analysis and taint analysis on the intermediate representation of the program to be analyzed, and identifying the vulnerabilities of the program to be analyzed according to security analysis requirements.
[0024] Furthermore, the path analysis of the vulnerability alert path includes: analyzing path accessibility, context sensitivity and vulnerability pattern satisfaction.
[0025] Furthermore, the path analysis of the vulnerability alert is performed in combination with the satisfiability modulo theory to obtain the path reachability of the vulnerability alert, including: after encrypting the vulnerability-related variables, the alarm path nodes are named according to the row numbers where the vulnerability-related variables are located to obtain one or more possible execution paths of the vulnerability alert; and the path reachability of the vulnerability alert is determined in combination with the one or more possible execution paths of the vulnerability alert and the control flow graph of the functions involved in the paths.
[0026] Furthermore, the one or more possible execution paths of the vulnerability alert are combined with the control flow graph of the function involved in the path to determine the path reachability of the vulnerability alert, and the determination basis includes: when any possible execution path of the vulnerability alert meets the reachability, it indicates that the path of the vulnerability alert is reachable; otherwise, it indicates that the path of the vulnerability alert is unreachable.
[0027] Furthermore, the path of the vulnerability alert is analyzed in combination with the satisfiability module theory to obtain the path reachability and vulnerability pattern satisfiability of the vulnerability alert, which is achieved through the following steps: generating constraints on the path reachability and vulnerability pattern satisfiability, submitting the constraints to the SMT tool for solving, and analyzing the reachability and vulnerability pattern satisfiability of one or more possible execution paths based on the solution results.
[0028] Furthermore, the constraints of generating path reachability and vulnerability pattern satisfaction are achieved through the following steps: obtaining relevant code involved in the path according to the nodes in the possible execution path, compiling the relevant code into an abstract syntax tree, performing symbolic execution on the abstract syntax tree, and collecting path constraints along the data flow.
[0029] Furthermore, the context sensitivity of the vulnerability alert is obtained by the following steps: using a context-sensitive static analysis tool to analyze the function call chain of the path corresponding to the vulnerability alert.
[0030] Furthermore, the optimization is performed based on the effect of preliminary screening based on path input symbol evaluation, including: comparing multiple vulnerability types before and after preliminary screening, and the false alarm rate of the ELAID method; the ELAID method includes identifying potential vulnerabilities in the program through indirect call analysis and taint analysis, generating and solving constraints of potential vulnerabilities through symbolic execution, thereby filtering false alarms.
[0031] Specifically, the method of the present invention comprises the following steps:
[0032] Vulnerability identification: This part mainly performs data flow analysis and taint analysis on the intermediate representation (IR) of the program to be analyzed, identifies the security risks in the program to be analyzed according to the security analysis requirements, and reports the corresponding vulnerability alerts. This paper mainly studies the post-processing work after obtaining the vulnerability alert, so this part of the work will not be introduced in detail.
[0033] Path analysis and false positive screening: mainly conduct path analysis on the path of vulnerability alerts, including path accessibility, context sensitivity, and vulnerability pattern satisfaction. Preliminary screening of vulnerability alert false positives is performed based on the path accessibility of vulnerability alerts, and the probability of vulnerability alerts being true is calculated based on the path accessibility, context sensitivity, and vulnerability pattern satisfaction of vulnerability alerts, and initial ranking of vulnerability alerts as a whole is performed.
[0034] Through the vulnerability alert itself, we can only know the node information and related code information related to its path. If we want to analyze the properties of the path such as reachability, we need to combine the Satisfiability Modulo Theories (SMT), first collect the constraints of the alert path, then submit the constraints to the SMT tool for solution, and then analyze the various properties of the alert path based on the solution results. To generate constraints, the first step is to obtain the possible execution path involved in the alert path. This possible execution path determines the various properties of the alert path. After obtaining the possible execution path, we can only get the code itself. We need to design rules to generate constraints from the code itself, and then submit the constraints to the SMT tool for solution. To obtain the initial ranking of the vulnerability alert as a whole, the last step is to design an algorithm to calculate the probability of the alert path being true based on the various properties of the path, and perform an initial ranking of the vulnerability alerts based on this probability. The specific vulnerability alert initial ranking algorithm is shown in Algorithm 1:
[0035] Algorithm 1: Initial ranking algorithm for vulnerability alerts
[0036] Input: vulnerability alert paths
[0037] Output: initial ranking
[0038] 1: PepsDit = {}, Ps = {} / / PepsDit: all possible execution paths, Ps: the probability of all paths being true
[0039] 2:for(path in paths)do
[0040] 3: Funcs = getAllFuncs (path) / / Get all functions involved in path
[0041] 4: CFGs = getCFGs (Funcs) / / Get the CFG of all functions
[0042] 5: Peps = getPeps (CFGs, path) / / Get all possible execution paths Peps based on CFGs and path
[0043] 6:add(path,Peps)to PepsDit
[0044] 7:for(path in PepsDit)do
[0045] 8:reachabilities=[], bugSatisfibilities=[]
[0046] 9:for(Pep in Peps)do
[0047] 10Constraints=genConstraints(Pep) / / Generate constraints based on Pep
[0048] 11reachability,bugSatisfiability=Z3(Constrains)
[0049] 12add reachability to reachabilities
[0050] 13add bugSatisfiability to bugSatisfibilities
[0051] 14if(all reachability in reachabilities is false)then
[0052] 15delete path / / This path is unreachable and is removed
[0053] 16continue
[0054] 17bugSatisfiability= / n
[0055] 18chainLength,nodeLength=getLength(path) / / Calculate the call chain length and node length of the path
[0056] 19P=fomula1(chainLength,nodeLength,bugSatisfiability)
[0057] 20add(path,P)to Ps
[0058] 21ranking=desSort(Ps) / / Sort in descending order to get the initial ranking
[0059] 22return ranking
[0060] Taking the C++ program shown in Algorithm 2 as an example, the design of this method is introduced in detail from three aspects: obtaining possible execution paths, generating and solving constraints, and initial ranking of vulnerability alerts. Finally, its principle and effect in the initial screening of false alarms are introduced. In the program example, the 5th line encrypts the variables as a decontamination point; the IF statement in the 11th line does not meet the judgment condition, and the data flow passing through this line is unreachable; the cmd_inject1 function and the cmd_inject2 function directly call the system function to execute their parameters. If the parameters are controllable, it will cause a command injection vulnerability.
[0061] Algorithm 2: C++ program example
[0062] 1void vulfunc(){
[0063] 2char cmdbuf1
[128] ;
[0064] 3bool flag = false;
[0065] 4cin>>cmdbuf1;
[0066] 5char*tmpstring1=buf encrypt(cmdbuf1);
[0067] 6char*tmpstring2=bufnotencrypt(cmdbuf1);
[0068] 7valPass1(tmpstring1);
[0069] 8cmd inject1(tmpstring1);
[0070] 9strcpy(cmdbuf1,tmpstring2);
[0071] 10valPass1(cmdbuf1);
[0072] 11if(flag)
[0073] 12cmd_inject2(tmpstring2);
[0074] 13}
[0075] 14void valPass1(char*buf){
[0076] 15valPass2(buf);
[0077] 16}
[0078] 17void valPass2(char*buf){
[0079] 18cmd inject1(buf);
[0080] 19}
[0081] 20voidcmd inject1(char*cmd){
[0082] 21system(cmd);
[0083] twenty two}
[0084] 23 void cmd inject2(char* cmd) {
[0085] 24system(cmd);
[0086] 25}
[0087] When applying, after using static analysis tools to analyze the above C++ program, four command injection vulnerability alerts are obtained. The alert path node is named Li according to the line number of the vulnerability-related variable, indicating that it is located in the i-th line. The paths corresponding to these four vulnerability alerts are shown in Table 3-1 below:
[0088] Table 3-1 Vulnerability alert results
[0089] Vulnerability Alert Alarm Path Alarm1 L4-L5-L7-L15-L18-L21 Alarm2 L4-L5-L8-L21 Alarm3 L4-L6-L9-L10-L15-L18-L21 Alarm4 L4-L6-L12-L24
[0090] Among them, the alarm paths corresponding to alarms 1 and 2 have undergone decontamination 5, and the string variables will be encrypted, making them unable to be controlled and exploited later, so they are false vulnerability alarms; the string variables in the alarm path corresponding to alarm 3 are controllable throughout the entire process, and it is a real vulnerability alarm; although the string variables in the alarm path corresponding to alarm 4 have not been encrypted and are controllable throughout the entire process, they do not meet the jump condition at line 11, and their path is unreachable, so it is also a false vulnerability alarm.
[0091] From the path of the vulnerability alert, we can see that if we only get the relevant code from the path itself, we can only get the code of the lines where the key variables are located, and we may miss some code that will affect the path accessibility and other properties. For example, in Alert 4, if we only consider the code of the lines where the nodes L4, L6, L12, and L24 in the path are located, as shown in Algorithm 3 below, we can see from the figure that if we only consider these codes, we will conclude that this path is reachable; but from the example in Algorithm 2, we can easily know that the jump code at node L11 will make this path actually unreachable, and from the program logic of this code, if we want to actually walk through this path, we must pass through node L11, which will lead to misjudgment when we only get the relevant code from the path itself to judge the path accessibility.
[0092] Algorithm 3: Alarm 4 path node related code
[0093] 4cin>>cmdbuf1;
[0094] 6char*tmpstring2=buf_notencrypt(cmdbuf1);
[0095] 12cmd_inject2(tmpstring2);
[0096] 23void cmd_inject2(char*cmd){
[0097] 24system(cmd);
[0098] 25}
[0099] To correctly judge the reachability of the path, a feasible method is to make a judgment from the control flow graph (CFG) of the functions involved in the path. The control flow graph is a graphical tool used in software engineering to describe the control structure of the program. It shows various possible paths and processes when the program is executed. The control flow graph consists of nodes and edges, where the nodes represent the basic blocks (BB) of the program execution and the edges represent the flow of the program execution. Through the control flow graph, we can intuitively understand the execution process of the program, including various situations such as sequential execution, conditional judgment, and loop iteration. By combining the control flow graph of the vulnerability alert path and the functions involved in the path, we can get all possible execution paths in these functions that contain the vulnerability alert path. The specific definition of the possible execution path is as follows: all the nodes of the vulnerability alert path, starting from the vulnerability alert path start node and ending at the vulnerability alert end node, and all the continuous paths that meet the pre-requirements in the control flow graph involved.
[0100] According to the definition of possible execution paths, we can know that there may be many possible execution paths for a vulnerability alert. Among these possible execution paths, as long as there is an execution path that satisfies reachability, it means that this vulnerability alert path is reachable; conversely, if all possible execution paths do not meet reachability, then this vulnerability alert path is unreachable.
[0101] To obtain the possible execution path, we must first obtain the control flow graph based on the program. The specific process of obtaining the Basic Block based on the three-address code is shown in Algorithm 4 below. The method of obtaining the three-address code based on the program code is not discussed in this chapter.
[0102] Algorithm 4: Basic Block construction algorithm
[0103] Input: a three-address code sequence P
[0104] Output: A sequence of Basic Blocks of P
[0105] 1:Determine the leaders in P:
[0106] 2:The first instruction in P is a leader
[0107] 3: Any target instruction of a conditional or unconditional jump is a leader
[0108] 4:Any instruction that immediately follows a conditional or unconditional jump is a leader
[0109] 5:Builds BBs for P:
[0110] 6:A BB consists of a leader and all its subsequent instructions until the next leader
[0111] 7: return BBs
[0112] After obtaining all the Basic Blocks (BB) of the program, connect the BBs with edges according to the control flow information of the program, and then add two empty basic blocks, Entry and Exit, before and after respectively, to obtain the control flow graph of the program.
[0113] Consider Algorithm 2: C++ program example, and use Algorithm 4: Basic Block construction algorithm to obtain the control flow graph of all functions involved in Alert 4 as follows: Figure 2 vulfunc function control flow graph, Figure 3 As shown in the control flow graph of the cmd_inject1 function, it can be seen from the control flow graph that the only possible execution path containing alert 4 is B1-B2-B4. So far, all possible execution paths of path 4 have been obtained. Next, we need to determine the reachability of each possible execution path, and then determine the reachability of the vulnerability alert path based on the reachability of the possible execution path.
[0114] After obtaining all possible execution paths of vulnerability alerts, it is necessary to further analyze the reachability and vulnerability pattern satisfaction of these possible execution paths. To complete the analysis of these properties, it is necessary to use symbolic execution technology and SMT tools; first, the corresponding constraints for these possible execution paths must be generated, and after obtaining the constraints, the constraints must be handed over to the SMT tool Z3 for solution, and the various properties of these possible execution paths must be analyzed based on the solution results.
[0115] One of the biggest drawbacks of symbolic execution technology is the path explosion problem. In traditional symbolic execution, the program path space will grow exponentially with the software scale, resulting in the path explosion problem. The symbolic execution based on path input used in the method proposed in the present invention limits the software scale to the set of possible execution paths, so there is no path explosion problem; moreover, after analysis by this module, the analysis results of the previous taint analysis tool can be made path-sensitive.
[0116] This method first obtains the relevant code involved in the path based on the nodes in the possible execution path. Here, the relevant code refers to the continuous path from source to sink, not just the code involved in the vulnerability alert path node, because the code on the entire continuous path will affect the path's accessibility and vulnerability pattern satisfaction. Then use pycparser to compile the relevant code into an abstract syntax tree (AST), and then perform symbolic execution on the AST to collect path constraints along the data flow. After collecting the constraints, the constraints are handed over to Z3 for solution. The path that meets the conditional constraints is considered reachable, otherwise it is considered unreachable. The constraint generation and solution process is as follows: Figure 4 shown.
[0117] First, we obtain all possible execution paths for the vulnerability alert path, because the related code involved in the possible execution path will determine the path's accessibility, context sensitivity, and vulnerability pattern satisfaction. After obtaining the related code, we collect the path sensitivity and vulnerability pattern constraints along the path and hand them over to the SMT solver Z3 for solution. Based on the solution results, we calculate the probability of the path being true, and perform an overall initial ranking of the vulnerability alerts based on the probability.
[0118] For path reachability, in this method, constraints are generated for assignment statements, jump statements, loop statements, etc. Finally, the jump conditions of jump statements are mainly judged for satisfaction. For vulnerability pattern satisfaction, specific constraints are generated based on the characteristics of the vulnerability pattern.
[0119] Alarm 4 in the C++ program example of Algorithm 2 is an example of path reachability. The constraint results generated for assignment statements, jump statements, etc. are shown in Algorithm 5. Because the flag is not true, the jump statement at node L11 is not established, and the constraint has no solution, so the possible execution path B1-B2-B4 is unreachable; Alarm 4 has only this one possible execution path, and all possible execution paths of Alarm 4 are unreachable, so Alarm 4 is unreachable.
[0120] Algorithm 5: Alert 4 Constraints
[0121] [reachability=true,flag==false,If(flag==true,None,reachability=false),reachability=true]
[0122] Regarding the vulnerability pattern satisfaction, the following Algorithm 5 is an example of a double free vulnerability in CWE415 in the C++ test case dataset Juliet1.3. It can be seen that in this example, the free operations for the pointer pvVar2 are in the if block and the else block respectively. Obviously, it is impossible for these two free operations to satisfy the reachability at the same time. This is a false double free vulnerability. However, for taint analysis, when its path is insensitive, it is impossible to identify this erroneous control flow information, that is, the data flow analysis tool will treat this example as a real vulnerability alert.
[0123] Algorithm 8: Double free example in Juliet
[0124] 1void goodB2G(void)
[0125] 2{
[0126] 3int iVar1;
[0127] 4void*pvVar2; 5
[0129] 6iVar1=globalReturnsTrueOrFalse();
[0130] 7if(iVar1==0){
[0131] 8pvVar2 = malloc(800);
[0132] 9if(pvVar2==(void*)0×0){
[0133] 10 / *WARNING:Subroutine does not return* /
[0134] 11exit(-1);
[0135] 12}
[0136] 13free(pvVar2);
[0137] 14}
[0138] 15else{
[0139] 16pvVar2 = malloc(800);
[0140] 17if(pvVar2==(void*)0×0){
[0141] 18 / *WARNING:Subroutine does not return* /
[0142] 19exit(-1);
[0143] 20}
[0144] 21free(pvVar2);
[0145] twenty two}
[0146] 23globalReturnTrueOrFalse();
[0147] 24return;
[0148] 25}
[0149] In this method, after generating AST for this code, path reachability and CWE415 constraints are generated based on the generated AST. For the CWE415 vulnerability pattern, the specific constraint generated is to calculate the number of times the pointer is released. In this example, the number of times pvVar2_free_count is released is collected to determine whether the number of times it is released is greater than or equal to 2. The collection result is shown in Algorithm 9. After collecting the conditional constraints, the constraints are given to Z3 for solution. In this example, because iVar1 cannot simultaneously satisfy iVar1==0 and iVar1!=0, that is, the number of times pvVar2_free_count is released in this example is less than 2, which does not satisfy the CWE415 vulnerability pattern.
[0150] Algorithm 9: Double free example constraints
[0151] [pvVar2_free_count==0,iVar1==0,If(iVar1==0,pvVar2_free_count==pvVar2_free_count+1, pv Var2_free_count==pvVar2_free_count+1),pvVar2_free_count>=2]
[0152] In the taint analysis of graph reachability, for a given program to be analyzed and analysis requirements, many paths that meet the conditions will be obtained. From the perspective of the analysis results, the probability of these paths being true is the same, because these paths all meet the analysis requirements. Therefore, it is necessary to use the specific characteristics of the paths in the taint analysis process to calculate the probability of these paths being true.
[0153] Taking the program in Algorithm 2 as an example, after obtaining the analysis results of the static analysis tool, we must first calculate the probability that the path results are true and perform an initial ranking on them. In the method proposed in this chapter, the probability that the path is true is mainly analyzed from three perspectives: path accessibility, context sensitivity, and vulnerability pattern satisfaction. First, for paths that do not meet the path accessibility, because all possible execution paths do not meet the accessibility, that is, any possible program execution path in actual situations is unreachable, it must be a false vulnerability alarm and will be directly screened out. After screening out the unreachable paths, the context sensitivity of the path and the vulnerability pattern satisfaction are combined to calculate the probability that the path is true.
[0154] After filtering out vulnerability alerts with unreachable paths, this method will analyze the context sensitivity, vulnerability pattern satisfaction, and path reachability of the remaining paths to calculate the probability that these paths are true; although vulnerability alerts with unreachable paths are filtered out, the remaining paths that meet path reachability are not necessarily reachable paths. They only have theoretical solutions. Whether they are reachable in actual situations still needs to be analyzed on a case-by-case basis. Therefore, when analyzing the probability that a path is true, the probability that the path is reachable still needs to be considered. Finally, the vulnerability alerts are initially ranked according to the probabilities obtained from the analysis.
[0155] Normally, the number of contexts maintained by context-sensitive static analysis tools is generally less than or equal to 3, because the more contexts maintained, the more accurate the results will be, but the analysis speed will be slower accordingly. That is to say, when the call chain of the path is very long, for example, when the length is greater than the number of contexts maintained, the context information will be lost, which will reduce the probability of the path being true. In this method, this article believes that the longer the function call chain of the path corresponding to the vulnerability alert is, the lower the probability of it being true.
[0156] When analyzing the reachability probability of a path, because this method performs symbolic execution on the path, if some variables involved are not initialized in the relevant code, in order to know the values of these variables, it is necessary to diffuse the data flow of the variables forward to obtain their values or value ranges; the variable diffusion strategy adopted by this method is that if the variable source has not been reached after diffusion N layers, its value is considered to be the value range of the type to which the variable belongs. Therefore, if the path constraint of a certain path has no solution, it must be unreachable, because the variable related to the constraint condition still has no solution when the value is the entire value range of the variable type, then it must be unsolvable when obtaining its actual value. If the constraint condition has a solution, then its path may be reachable, but its actual situation may also be unsolvable, that is, the probability that a certain node is true P<1. Obviously, the more nodes a path contains, the lower the probability that the path is true as a whole.
[0157] From the previous analysis, we can know that the probability of a path being true is related to the call chain length, the number of nodes and the bug pattern satisfaction of the path. The call chain length of the path is chainLength, the number of nodes is nodeLength, and the bug pattern satisfaction is bugSatisfiability. The calculation formula for the path being true in this method is as follows. Because chainLength ≥ 1, nodeLength ≥ 2, and bugSatisfiability of all paths are 0 or 1, 0 <P≤1。
[0158]
[0159] After calculating the probability of the path being true for the example in Algorithm 2, the initial ranking is shown in Table 3-2 below. Alert 4 has been screened out because it does not meet the reachability requirements.
[0160] Table 3-2 Initial ranking of vulnerability alerts
[0161] Rank Belief Alarm 1 0.58 Alarm1(L4-L5-L7-L21) 2 0.37 Alarm2(L4-L5-L7-L15-L18-L21) 3 0.34 Alarm3(L4-L6-L9-L10-L15-L18-L21)
[0162] In addition to the initial ranking of vulnerability alerts, symbolic execution based on path input can also preliminarily screen false alarms in vulnerability alerts according to the accessibility of vulnerability paths, screen out vulnerability alerts that do not meet path accessibility, and preliminarily reduce the false alarm rate of alarm results. The effect of path accessibility in preliminarily screening false alarms of vulnerability alerts is evaluated by using symbolic execution based on path input. First, the experimental environment and the selected data set are explained, and the effectiveness of the proposed method and its advancement relative to other methods are explained through experiments. This experiment was conducted in the Ubuntu 22.04.2LTS environment. The main hardware parameters of the experimental platform are Intel (R) Core (TM) i5-1135G7, 16GB of memory, NVIDIA GeForce MX450 GPU, and 8GB of video memory. The data set used in this embodiment is Juliet Test Suite v1.3, which is a test suite developed by NIST. It contains more than 81,000 defective programs about C / C++ and JAVA. These programs can be used as test cases for testing the effectiveness of static analysis tools and other software assurance tools. It contains 118 CWE types.
[0163] Before using the method proposed in this embodiment to post-process the static analysis results, it is necessary to use a static analysis tool to perform static analysis on the programs in the data set. To ensure the effectiveness of the subsequent experiments in this article, it is necessary to select a public static analysis tool; the static analysis tool used in this article is the Broken Shell platform. The Broken Shell platform is an online platform that can reliably analyze binary code. It analyzes the binary code, stores the analysis results in a graph database, and then uses a specific query language to dig deeper defects in the code. It is a static program analysis tool that can be used for vulnerability discovery and research.
[0164] In order to verify the proposed method, hereinafter referred to as IRM, the effect of reducing the false alarm rate of vulnerability alarms after the initial screening of vulnerability alarms, this section of the experiment compares the false alarm rate of vulnerability alarms of multiple CWE vulnerability types in the Juliet dataset before and after the initial screening, and compares it with the effect of the ELAID method on false alarm initial screening. The ELAID method first identifies the potential IO2BO (Integer Overflow to Buffer Overflow) vulnerability in the program through indirect call analysis and taint analysis, and then generates the constraints of the potential vulnerability through symbolic execution and solves it to filter the false alarms. In the proposed method, after obtaining the analysis results of the shell platform, it first queries the source code in Juliet according to the path in the analysis results to obtain the path-related source code, and then gives the relevant source code to the pycparser library in Python to compile it into AST, and generates path constraints based on AST. After collecting the path constraints, the constraints are given to Z3 for solution.
[0165] Table 3-3 below is a comparison of the false positive rate of vulnerability alerts before and after the initial screening of CWEs such as command injection, double free, and UAF in the Juliet dataset. Among them, the vulnerability alerts are obtained by writing a specific query language for the Broken Shell platform based on the characteristics of each CWE binary query for each CWE in Juliet. It cannot query all test cases in Juliet, and there will be a large proportion of false positive rates. From the table, it can be seen that the proposed method can effectively reduce the false positive rate of vulnerability alerts. Among them, CWE416 (Use After Free) has the largest reduction, reaching 11.2%; the average reduction of all CWEs is 5.23%. It can also be seen from the figure that CWE78, CWE121, CWE134, and CWE680 have a small reduction. This paper believes that one of the main reasons for this phenomenon is that the Juliet dataset did not pay much attention to the construction of path-insensitive false positive examples during the construction of these CWEs, resulting in the false positive rate of these CWEs not being significantly reduced after the proposed method. Compared with ELAID, the method proposed in this chapter has better overall effect and has significantly improved the false positive screening effect. However, on CWE121 and CWE680, the effect of ELAID is more obvious than the method proposed in this chapter. ELAID is a method designed specifically for the IO2BO vulnerability, so it is more prominent in buffer overflow vulnerabilities.
[0166] Table 3-3 Results of initial screening test for vulnerability alerts
[0167]
[0168] In summary, the embodiment of the present application provides a method for initial ranking of vulnerability alerts based on symbolic execution of path input: specifically including obtaining possible execution paths, generating and solving path constraints, and initial ranking of vulnerability alerts. This embodiment first analyzes the research problem that the method is intended to solve, then introduces the specific design scheme of the method in detail, and finally verifies the initial screening effect of the proposed method on false alarms of vulnerability alerts in experiments. This method combines symbolic execution technology and static analysis technology of graph reachability, performs effective initial ranking of the analysis results of the graph reachability static analysis tool, and effectively screens false alarms of vulnerability alerts based on the path reachability of the analysis results, thereby reducing the false alarm rate of vulnerability alerts.
Claims
1. A vulnerability alert initial ranking method based on path input symbolic execution, characterized in that: The method includes the following steps: performing vulnerability identification on the intermediate representation of the program to be analyzed to obtain vulnerability alerts; analyzing the paths of vulnerability alerts in combination with the satisfiability module theory to obtain the path accessibility and vulnerability pattern satisfiability of vulnerability alerts; preliminarily screening out false positives of vulnerability alerts based on the path accessibility of vulnerability alerts, and evaluating and optimizing the effect of the preliminary screening based on the path input symbol; calculating the probability that the path is true based on the path accessibility, context sensitivity, and vulnerability pattern satisfiability of the vulnerability alerts, and initially ranking the vulnerability alerts based on the probability.
2. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 1, characterized in that: The vulnerability identification of the intermediate representation of the program to be analyzed includes: performing data flow analysis and taint analysis on the intermediate representation of the program to be analyzed, and identifying the vulnerabilities of the program to be analyzed according to security analysis requirements.
3. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 1, characterized in that: The path analysis of the vulnerability alert path includes: analyzing the path accessibility, context sensitivity and vulnerability pattern satisfaction.
4. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 1, characterized in that: The path analysis of the vulnerability alarm is performed in combination with the satisfiability modulo theory to obtain the path reachability of the vulnerability alarm, including: after encrypting the vulnerability-related variables, the alarm path nodes are named according to the row number where the vulnerability-related variables are located to obtain one or more possible execution paths of the vulnerability alarm; and the path reachability of the vulnerability alarm is determined by combining the one or more possible execution paths of the vulnerability alarm and the control flow graph of the function involved in the path.
5. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 4, characterized in that: The one or more possible execution paths of the vulnerability alert and the control flow graph of the function involved in the path are combined to determine the path reachability of the vulnerability alert, and the determination basis includes: when any possible execution path of the vulnerability alert meets the reachability, it indicates that the path of the vulnerability alert is reachable; otherwise, it indicates that the path of the vulnerability alert is unreachable.
6. According to claim 4, there is a vulnerability alert initial ranking method based on path input symbolic execution, characterized in that: The path of the vulnerability alert is analyzed in combination with the satisfiability module theory to obtain the path reachability and vulnerability pattern satisfiability of the vulnerability alert, which is achieved through the following steps: generating constraint conditions for path reachability and vulnerability pattern satisfiability, submitting the constraint conditions to the SMT tool for solving, and analyzing the reachability and vulnerability pattern satisfiability of one or more possible execution paths based on the solution results.
7. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 6, characterized in that: The constraints of generating path reachability and vulnerability pattern satisfaction are achieved through the following steps: obtaining relevant code involved in the path according to the nodes in the possible execution path, compiling the relevant code into an abstract syntax tree, performing symbolic execution on the abstract syntax tree, and collecting path constraints along the data flow.
8. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 1, characterized in that: The context sensitivity of the vulnerability alert is obtained by the following steps: using a context-sensitive static analysis tool to analyze the function call chain of the path corresponding to the vulnerability alert.
9. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 1, characterized in that: The effect of the preliminary screening based on the path input symbol evaluation includes: comparing multiple vulnerability types before and after the preliminary screening, and the false alarm rate of the ELAID method; the ELAID method includes: identifying potential vulnerabilities in the program through indirect call analysis and taint analysis, generating and solving constraints of potential vulnerabilities through symbolic execution, thereby filtering false alarms.
10. The vulnerability alert initial ranking method based on path input symbolic execution according to claim 1, characterized in that: The calculation formula for the path to be true is as follows: Among them, chainLength is the call chain length, nodeLength is the number of nodes, bugSatisfiability is the satisfaction of the vulnerability pattern, chainLength≥1, nodeLength≥2, bugSatisfiability is 0 or 1, 0 <P≤1。
