Fine-grained vulnerability prioritization method based on text mining and multi-metric measurement
By using text mining and multi-indicator measurement methods to extract deep-level information and perform weighted scoring, the problems of high reliance on manual intervention and insufficient fine-grainedness in existing technologies are solved, and efficient and accurate vulnerability priority ranking and management are achieved.
Patent Information
- Application Number
- CN202411172593.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-08-26
AI Technical Summary
Existing vulnerability prioritization methods rely heavily on human experience, have low automation levels, and lack fine-grained assessment, making them ineffective in managing a large number of code vulnerabilities in software projects.
We employ a text mining and multi-metric approach, using node2vec to extract in-depth information. We then combine vulnerability remediation necessity, function-level metrics, and impact scope to prioritize function-level vulnerabilities using a weighted scoring system.
It achieves efficient and accurate vulnerability prioritization, improves the automation level and granularity of software vulnerability management and optimizes the order and efficiency of vulnerability remediation.
Smart Images

Figure CN118673506B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of code vulnerability priority sorting in software engineering, and in particular to a method for fine-grained vulnerability priority sorting based on text mining and multi-index measurement. Background Art
[0002] In the software development process, due to low-quality coding or code cloning by developers, as well as insufficient security testing, a large number of code vulnerabilities exist in software programs. There are a large number of vulnerabilities hidden in these tens of thousands of software programs. Once these vulnerabilities are exploited by malicious attackers, they may trigger global network attacks and cause immeasurable consequences. In order to mitigate the impact of vulnerabilities in software systems, researchers try to quickly assess the priority of vulnerabilities after they are disclosed, and then take active repair actions, and have carried out a lot of related work accordingly.
[0003] In the existing vulnerability priority management process, the current mainstream solution is to use the CVSS scoring system. The general process is as follows: first use a static scanner to discover possible vulnerabilities in the code, then analyze and judge the software security experts in the corresponding organization, and input the relevant attributes of the code vulnerability into the CVSS scoring system. The system scores the vulnerabilities according to some pre-set calculation formulas, and finally the software organization reviews and repairs the vulnerabilities based on the priority of the scores.
[0004] However, with the explosive growth in the number of vulnerabilities, some of the original evaluation methods cannot adapt to the current situation of a large increase in the number of vulnerabilities. From the existing vulnerability priority management process, it is not difficult to see that the entire evaluation process requires a lot of manual participation and is highly dependent on manual experience. In addition, the existing vulnerability priority sorting method still remains at the software project level, but has not gone deep into the software function level, lacking a fine-grained sorting method. Due to the advancement of software development technology and network attack technology, the existing sorting method indicators are relatively single and lack a comprehensive consideration of related vulnerabilities. Summary of the invention
[0005] In order to solve the problems of low automation and over-reliance on manual experience, insufficient indicators, and excessive granularity of vulnerability scoring in vulnerability assessment related research, this paper designs a vulnerability prioritization method based on text mining and multi-indicator measurement, and proposes 14 metrics from three dimensions: necessity, function-level indicators, and impact range, and prioritizes vulnerabilities at the function level. Vulnerabilities can be sorted more efficiently and accurately, which effectively improves the quality of software vulnerability sorting, greatly improves the practicality of vulnerability sorting work, and provides a new solution for optimizing software vulnerability lifecycle management.
[0006] In order to solve the above technical problems, the technical solution of the present invention is:
[0007] A method for fine-grained vulnerability prioritization based on text mining and multi-metric measurement, comprising the following steps:
[0008] S1. Collect vulnerability code data to be sorted, and perform data screening and cleaning. The vulnerability code data includes function source code, vulnerability description information, and vulnerability submission information.
[0009] S2. Use node2vec to extract deep information from the cleaned vulnerability code data;
[0010] S3. Based on the extracted deep information, the vulnerability code data is evaluated through a multi-index evaluation system to obtain scores in multiple dimensions, where the evaluation dimensions include the necessity of vulnerability repair, function-level indicators, and the scope of impact that may be caused by a successful attack on the vulnerability;
[0011] S4. After obtaining the indicators of the three dimensions, the total score is calculated through the weighted method of the scoring system, and finally the priority is sorted.
[0012] Preferably, the method for extracting deep information includes:
[0013] S2-1. For the function source code, first identify its writing language through regular matching and change the corresponding name; then, use The tool generates for these source code files Program dependency graph representation;
[0014] S2-2, traversal generated ,Will Extract the key information of nodes and edges implied in The mapping relationship between node content and connected edges;
[0015] S2-3, the obtained mapping relationship is obtained through The model is trained with text features and edge features, a feature matrix of node content From multiple texts The corresponding eigenvector Composition, i represents the content of the node Number, t represents The maximum length of a vector; a characteristic matrix of node-dependency edges By multiple edges The corresponding eigenvector Composition, n represents the number of nodes dependent on the edge, m represents The length of the vector;
[0016] S2-4. For the two text attributes of vulnerability description information and vulnerability submission information, we use the pre-trained public Model Get the feature vector , .
[0017] Preferably, in step S3, the necessity of vulnerability repair, function-level indicators, and the evaluation of the possible impact range after the vulnerability is successfully attacked are all evaluated through secondary indicators;
[0018] The assessment of the necessity of remediating the vulnerability includes type exploitation, attack difficulty and severity;
[0019] The evaluation of the function-level indicators includes repair cost and function importance;
[0020] The assessment of the scope of impact that may be caused by a successful attack of the vulnerability includes availability, confidentiality, and integrity impact.
[0021] Preferably, in step S4, the method for calculating the total score through the scoring system and obtaining the vulnerability priority is:
[0022] S4-1. First, measure the indicator values of the three dimensions respectively, and limit the score of each dimension to 10 points. The formula is:
[0023]
[0024]
[0025]
[0026] S4-2. In order to limit the total score to 10 points, each dimension needs to be assigned a corresponding weight. Considering the development of the vulnerability life cycle and the rationality of the ranking results, similar indicators can be assigned to the three dimensions or slightly adjusted up or down accordingly, and calculated using a weighted method to obtain the total vulnerability score formula:
[0027] in are coefficients of different dimensions.
[0028] The present invention has the following characteristics and beneficial effects:
[0029] Using the above technical solution, the present invention sorts the priority of software vulnerabilities at a function granularity based on text mining and multi-index measurement. The method starts from the perspective of the vulnerability life cycle, comprehensively considers three types of factors before, during and after vulnerability repair, covers every part of the entire vulnerability management process, and automatically generates the values of 8 indicators in the scoring system by combining deep learning and statistical analysis. In addition, in order to offset the errors that may exist in the automation process, this method retains the method of manually evaluating the 6 indicators in the basic vulnerability scoring. The advantage of this method is that it can automatically generate ACVSS scores to evaluate the severity of the vulnerability, and comprehensively and accurately evaluate the priority of the vulnerability by comprehensively evaluating multiple factors of the vulnerability, and refine the sorting granularity to the function level to optimize the order of vulnerability repair. The proposed scoring system is relatively reasonable and complete, which reduces the influence of manual experience in the software vulnerability assessment process and improves efficiency and effectiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0031] Figure 1 is a flow chart of the method of the present invention;
[0032] Figure 2 Flowchart for training the BERT-BGRU scoring model of the present invention;
[0033] Figure 3 A flow chart of the present invention using the VulGraB algorithm to evaluate the importance of a function;
[0034] Figure 4 The following is an outline of the vulnerability priority scoring system disclosed in the present invention. DETAILED DESCRIPTION
[0035] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0036] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0037] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances.
[0038] The present invention provides a method for fine-grained vulnerability prioritization based on text mining and multi-indicator measurement. The application case of this embodiment on the MSR_20_Code_vulnerability_CSV_Dataset vulnerability dataset is described in detail. Figure 1 As shown, the following steps are included:
[0039] S1. Vulnerability code data collection and cleaning.
[0040] Specifically, it includes the following sub-steps:
[0041] S11. In this embodiment, code snippets related to software vulnerabilities in the open source Github project repository are downloaded by crawling;
[0042] S12. Eliminate code snippets that have insufficient valid code lines and are mixed with code other than C / C++.
[0043] S2. Perform deep information extraction on the cleaned code data, which mainly includes further processing of function source code, vulnerability description information, and vulnerability submission information.
[0044] The specific steps include:
[0045] S21. Regarding the function source code, first identify its writing language through regular matching and modify the suffix name; then, use The tool generates for these source code files And save it as a dot file.
[0046] S22, traverse the generated , extract the key information of nodes and edges hidden in the code graph structure, and The mapping relationship between node content and connected edges is saved as a dictionary file.
[0047] S23, the obtained mapping relationship is modified The model is trained on text features and edge features, where the text token of the node content is regarded as the smallest unit. Finally, the feature matrix of a node content From multiple texts The corresponding eigenvector Composition, i represents the content of the node Number, t represents The maximum length of a vector; a characteristic matrix of node-dependency edges By multiple edges The corresponding eigenvector Composition, n represents the number of nodes dependent on the edge, m represents The length of the vector.
[0048] S24, for the two text attributes of vulnerability description information and vulnerability submission information, use the pre-trained Model Get the feature vector , .
[0049] S3, evaluate the vulnerability code based on the multi-index evaluation system to obtain scores in different dimensions, including the necessity of vulnerability repair, such as Figure 2 As shown, it specifically includes the following sub-steps:
[0050] S31. Count the number of all types of vulnerabilities reported in the past period of time and the number of vulnerabilities that have actually been exploited to launch attacks, so as to calculate the exploitation rate of each vulnerability , and then normalize the utilization to get the type utilization score, the formula is as follows:
[0051]
[0052] S32. In this embodiment, the attack difficulty is evaluated by evaluating the attack complexity required for the vulnerability. , the maximum distance that can be attacked , Pre-authentication when being used .
[0053] Specifically, in this embodiment, each indicator is divided into three levels, and each indicator is scored as described in the following table.
[0054]
[0055]
[0056]
[0057] Finally, the average score is calculated as the score of this secondary indicator:
[0058]
[0059] S33. Utilization The combined model performs text mining on vulnerability description information and vulnerability submission information, and converts the What you get , Text feature vectors are concatenated and input The model, through the cyclic learning mechanism, converts the output of the last hidden layer After the pooling and fully connected layers, The layer is classified from 0 to 10, and the obtained probability is used as the severity of the vulnerability The score is as follows:
[0060] ,
[0061]
[0062] S4. After completing the assessment of the repair necessity dimension, continue to analyze the function-level indicators of the vulnerability, which mainly includes the measurement of repair cost and function importance, such as Figure 3 As shown, it specifically includes the following sub-steps:
[0063] S41. Count the information related to the structural characteristics of the vulnerability function, including the number of function code lines and the number of function parameters , the formula for calculating the structure score is as follows:
[0064]
[0065] S42. Measure the difficulty of function repair and count the total number of function calls , count the number of functions outside the file called by a function And the number of functions in the calling file ,The difficulty of function repair is reflected by the function call complexity, and the formula is as follows:
[0066]
[0067] S43, evaluate the importance of the function, and use the node features obtained in S2 to construct the program dependency graph of a single function. and edge feature matrix Converted into a single vector representation , , then enter Automatically evaluate the importance of functions in the network, and finally assign a final importance score based on the ranking of a function in its project:
[0068]
[0069]
[0070] S5. After completing the evaluation of the first two dimensions, determine the possible impact of a successful attack on the vulnerability, such as Figure 4 As shown, the specific steps are as follows:
[0071] S51. Evaluate the impact of vulnerabilities on software availability , Software Confidentiality Impact on software integrity The scores of the three secondary indicators are divided into three levels.
[0072] It can be understood that in this embodiment, the scores of the three secondary indicators are divided into three levels: high, medium, and low, and are assigned 3, 2, and 1.
[0073] Specifically, in this embodiment, the score of the secondary indicator can be directly obtained according to the impact of the vulnerability on the operation of the software.
[0074]
[0075]
[0076]
[0077] Finally, the average value is calculated to get the score of the vulnerability impact range. :
[0078]
[0079] S6. After obtaining the indicators of the three dimensions, the total score is calculated through the scoring system. The specific sub-steps include:
[0080] S61. First, measure the indicator values of the three dimensions respectively, and limit the score of each dimension to 10 points. The formula is:
[0081]
[0082]
[0083]
[0084] S62. In order to limit the total score to within 10 points and to reasonably consider the weight of each dimension, a weighted method is used to calculate and obtain the total score formula of the vulnerability (it should be noted that in this embodiment, considering the development of the vulnerability life cycle and the rationality of the ranking results, similar indicators can be assigned to the three dimensions or adjusted accordingly. In this embodiment, a weight of 0.5 is assigned to the necessity of repair, a weight of 0.3 is assigned to the function-level indicator, and a weight of 0.2 is assigned to the impact scope):
[0085]
[0086] S63. Sort the final vulnerability scores in the projects to which they belong to obtain reference priorities.
[0087] It can be understood that in this embodiment, necessity refers to the severity of the vulnerability itself, which measures the potential harm that may be caused to the system, data, or users once the vulnerability is exploited; the function-level indicator refers to the functional role of the code part affected by the vulnerability in the system. This dimension evaluates the importance of the specific module, function or service affected by the vulnerability in the overall function of the system; the scope of impact refers to the scope of the system, data or users that the vulnerability may affect and the impact on external entities after being exploited.
[0088] Therefore, in this embodiment, by comprehensively considering necessity, function-level analysis, and impact scope, not only can the priority of vulnerabilities be sorted more effectively to ensure that the most dangerous and most widely affected vulnerabilities are repaired first, but the efficiency and effectiveness of the repair work can also be improved.
[0089] Furthermore, in order to specifically illustrate the advantages of the method, this embodiment selects a vulnerability reported by a PHP project belonging to CWE-787 for elaboration. It contains two problematic codes, one of which cannot correctly verify the gamma value, and the other cannot correctly verify the number of colors, which allows remote attackers to cause denial of service (out-of-bounds write) or possibly other unspecified impacts by providing different symbols for input parameters. The two functions have the same vulnerability type and can be considered to have the same severity. At this time, function-level indicators come into play, and the two are evaluated from the code infrastructure to further generate differentiation. This method's multi-faceted consideration of vulnerability priorities can refine the results of vulnerability sorting and thus improve usability.
[0090] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments including components are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.
Claims
1. A fine-grained vulnerability prioritization method based on text mining and multi-metric measurement, characterized in that: The steps include: S1. Collect vulnerability code data to be sorted, and perform data screening and cleaning. The vulnerability code data includes function source code, vulnerability description information, and vulnerability submission information. S2. Use node2vec to extract deep information from the cleaned vulnerability code data; S2-1. For the function source code, first identify its writing language through regular matching and change the corresponding name; then use the Joern tool to generate a PDG program dependency graph representation for these source code files; S2-2, traverse the generated PDG, extract the key information of nodes and edges hidden in the PDG, and save the mapping relationship between node ID and node content and connected edges; S2-3, the obtained mapping relationship is trained with text features and edge features through the node2vec model, and a feature matrix V of the node content is obtained. it The feature vector T corresponding to multiple text tokens t Composition, i represents the number of Tokens in the node content, t represents the longest length of the Token vector; the feature matrix W of a node dependency edge nm The eigenvector E corresponding to multiple edges Edge m Composition, n represents the number of node dependent edges, and m represents the length of the Edge vector; S2-4. For the two text attributes of vulnerability description information and vulnerability submission information, use the pre-trained public BERT model to perform embedding to obtain the feature vectors desc and commit; S3. Based on the extracted deep information, the vulnerability code data is evaluated through a multi-index evaluation system to obtain scores in multiple dimensions, where the evaluation dimensions include the necessity of vulnerability repair, function-level indicators, and the scope of impact that may be caused by a successful attack on the vulnerability; The necessity of vulnerability repair, function-level indicators, and the possible impact range after the vulnerability is successfully attacked are all evaluated through secondary indicators; The assessment of the necessity of remediating the vulnerability includes type exploitation, attack difficulty and severity; The method for evaluating the necessity of fixing the vulnerability is: For type utilization rate: count the number of all types of vulnerabilities reported in the past period of time and the number of vulnerabilities that are actually exploited to launch attacks, so as to calculate the utilization rate ExRate of each vulnerability, and then normalize the utilization rate. The formula is as follows: For attack difficulty: Based on the attack conditions Complexity required by the vulnerability, the maximum distance that can be attacked AttackOrigin, and the pre-authentication authentication Authentication Required when being exploited, each indicator is divided into three levels, and the average score is finally calculated as the score of this secondary indicator: DiffScore=(Complexity+Attack Origin+Authentication Required) / 3 For severity: Use the BERT-BGRU combined model to perform text mining on vulnerability description information and vulnerability submission information. Concatenate the desc and commit text feature vectors obtained by BERT in S2 and input them into the BGRU model training. After cyclic learning and loss gradient back propagation mechanism, the output h of the last hidden layer is converted into t After the pooling and fully connected layers, the softmax layer is used for classification, and the obtained probability is used as the score of the vulnerability severity ACVSS. The formula is as follows: temp=pooling(W h h t +bias), ACVSS = softmax(temp); The evaluation of the function-level indicators includes repair cost and function importance; The method for evaluating the vulnerability at the function level is as follows: Count the information related to the function structure characteristics, including the number of lines of code LoC and the number of parameters PC. The score calculation formula is as follows: To measure the cost of function repair, count the total number of function calls, calculate the number of Fan-Out calls to functions outside the file and the number of Fan-In calls to functions within the file, and use the function call complexity calculation formula to reflect the difficulty of function repair: CallValue=Call*(Fan_Out-Fan_In) Evaluate the importance of the function and use the node feature V obtained in S2 to convert any function PDG into it and edge feature matrix W nm Converted into separate vectors to represent textVec and edgeVec, and then input into the BiGGNN network for automatic evaluation of function importance. Finally, the function is given a final importance score based on its ranking in the project: FucImp=BiGGNN(convat(textVec,edgeVec) An assessment of the scope of impact that may be caused by a successful attack of the vulnerability, including availability, confidentiality, and integrity impacts; The method to assess the impact scope of the vulnerability is: S5-1. Evaluate the impact of the vulnerability on software availability, software confidentiality, and software integrity. The average score of the three indicators is finally calculated to get the score of the vulnerability impact range InfScore: S4. After obtaining the indicators of the three dimensions, the total score is calculated through the weighted method of the scoring system, and finally the priority is sorted.
2. According to claim 1, a method for fine-grained vulnerability prioritization based on text mining and multi-index measurement is characterized in that: In step S1, the data cleaning method is: using the regular matching tool in the re module to standardize the code and replace the characters that do not meet the requirements.
3. According to claim 1, a method for fine-grained vulnerability prioritization based on text mining and multi-index measurement is characterized in that: In step S2-3, when the node2vec model performs text feature and edge feature training, the text token of the node content is regarded as the smallest unit.
4. According to claim 1, a method for fine-grained vulnerability prioritization based on text mining and multi-index measurement is characterized in that: In step S4, the method for calculating the total score through the scoring system and obtaining the vulnerability priority is: S4-1. First, measure the indicator values of the three dimensions respectively, and limit the score of each dimension to 10 points. The formula is: NecScore=(ExScore+DiffScore+ACVSS) / 2 FuncScore=5×ImpScore+(StructScore+CallScore) InfScore=InfScore×10 / 3 S4-2. In order to limit the total score to less than 10 points, it is necessary to assign corresponding weights to each dimension and use weighted calculation to obtain the total vulnerability score formula: where α i are coefficients of different dimensions.
