Method, device, equipment and medium for generating automatic repair solutions for component vulnerabilities
By comparing the component version information and the CVE database, the vulnerability gain value and threat level are calculated, and a vulnerability repair plan is automatically generated, which solves the problems of manual vulnerability repair and version changes in the existing technology, and improves the efficiency and security of vulnerability management.
Patent Information
- Application Number
- CN202410825741.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-25
AI Technical Summary
Existing vulnerability fixing solutions cannot be automated, causing development teams to spend a lot of time manually analyzing and fixing component vulnerabilities. Moreover, fixing recommendations cannot cover component version changes, and there is a risk of improper resource allocation and fixing errors.
By obtaining the version information of the component to be detected and comparing it with the CVE database, the gain value of the vulnerability and the degree of network threat are calculated, the repair priority is automatically determined, the repair code is extracted from the source code and the CVE database, and an automated repair plan is generated.
It improves the efficiency and accuracy of vulnerability management, reduces security risks, optimizes resource allocation, and ensures timely repair of critical vulnerabilities.
Smart Images

Figure CN118378270B
Abstract
Description
[0002] The technical field, in particular, relates to methods, devices, equipment and media for generating automatic repair solutions for component vulnerabilities. Background Art
[0003] In the current software development environment, open source components on the Internet are usually used to improve development efficiency. However, some open source components have some vulnerability risks. The risk may be a coding error or deliberate poisoning. If the vulnerability is maliciously exploited, it may cause serious business accidents. We call this component with a vulnerability a risk component. The existing vulnerability repair plan is a repair suggestion made by security personnel based on the vulnerability outbreak. For components, it is usually solved by upgrading the component version. As time goes by, the vulnerability repair suggestion cannot cover the change of component version, so manual intervention is still required when repairing the vulnerability. This causes the development team to spend a lot of time analyzing each affected component and making potentially wrong decisions. Summary of the invention
[0004] The purpose of the present invention is to provide a method, device, equipment and medium for generating an automatic component vulnerability repair solution to improve the above problems. In order to achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0005] In a first aspect, the present application provides a method for generating an automatic component vulnerability repair solution, comprising:
[0006] Obtain the component to be detected and its version information, compare the version information of the component to be detected with the CVE database, and determine all vulnerabilities of the component to be detected;
[0007] Obtaining attribute information of each vulnerability in turn, calculating a gain value of each vulnerability according to the attribute information, and determining whether the vulnerability is a vulnerability to be repaired according to the gain value of the vulnerability;
[0008] Obtaining basic indicators for each vulnerability to be repaired, calculating the network threat level of each vulnerability to be repaired based on the basic indicators, and determining the priority of the vulnerability to be repaired based on the network threat level;
[0009] Determine the current vulnerability to be fixed according to the repair priority, extract the source code of the current vulnerability to be fixed from the source code of the component to be detected, and extract the repair code of the current vulnerability to be fixed from the CVE database;
[0010] The repair code is compared with the source code to determine the modified variables of the current vulnerability to be repaired, and the modified variables of all the vulnerabilities to be repaired constitute the repair plan of the component to be detected.
[0011] In a second aspect, the present application also provides a device for generating an automatic component vulnerability repair solution, including:
[0012] Version comparison module: obtains the component to be detected and its version information, compares the version information of the component to be detected with the CVE database, and determines all vulnerabilities of the component to be detected;
[0013] Gain value calculation module: obtains the attribute information of each vulnerability in turn, calculates the gain value of each vulnerability according to the attribute information, and determines whether it is a vulnerability to be repaired according to the gain value of the vulnerability;
[0014] Threat level calculation module: obtains basic indicators of each vulnerability to be repaired, calculates the network threat level of each vulnerability to be repaired based on the basic indicators, and determines the priority of the vulnerability to be repaired according to the network threat level;
[0015] Determination module: Determine the current vulnerability to be fixed according to the repair priority, extract the source code of the current vulnerability to be fixed from the source code of the component to be detected, and extract the repair code of the current vulnerability to be fixed from the CVE database;
[0016] Repair plan generation module: compares the repair code with the source code to determine the modified variables of the current vulnerability to be repaired, and the repair plan of the component to be detected is composed of the modified variables of all the vulnerabilities to be repaired.
[0017] In a third aspect, the present application also provides a device for generating an automatic component vulnerability repair solution, including:
[0018] Memory for storing computer programs;
[0019] A processor is used to implement the steps of the method for generating an automatic component vulnerability repair solution when executing the computer program.
[0020] In a fourth aspect, the present application further provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned method for generating an automated component vulnerability repair solution are implemented.
[0021] The beneficial effects of the present invention are:
[0022] The present invention determines the existing vulnerability information by comparing the version information of the component to be detected with the CVE database. The solution calculates the gain value by quantifying the vulnerability attribute information, comprehensively evaluates the repair value of each vulnerability, and provides a quantitative basis for vulnerability priority sorting in combination with the network threat level of the vulnerability, jointly determines the priority of vulnerability repair, and optimizes resource allocation. Finally, by intelligently comparing the source code and the repair code, the variables that need to be modified are accurately identified, which speeds up the repair speed. The present invention improves the efficiency and accuracy of vulnerability management and reduces security risks through automated and quantitative management methods.
[0023] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 A schematic diagram of a flow chart of a method for generating an automatic component vulnerability repair solution according to an embodiment of the present invention;
[0026] Figure 2 A schematic diagram of determining whether a vulnerability needs to be repaired according to an embodiment of the present invention;
[0027] Figure 3 A schematic diagram of the structure of a device for generating an automatic component vulnerability repair solution according to an embodiment of the present invention;
[0028] Figure 4 A schematic diagram of a device structure is generated for the automatic component vulnerability repair solution described in an embodiment of the present invention.
[0029] Markings in the figure:
[0030] 800. Device for generating automatic component vulnerability repair solutions; 801. processor; 802. memory; 803. multimedia component; 804. I / O interface; 805. communication component. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0032] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0033] Embodiment 1:
[0034] This embodiment provides a method for generating an automatic repair solution for a component vulnerability.
[0035] See also Figure 1 , the figure shows that the method includes:
[0036] S1. Obtain the component to be detected and its version information, compare the version information of the component to be detected with the CVE database, and determine all the vulnerabilities of the component to be detected;
[0037] Specifically, the step S1 includes:
[0038] S11. Obtain the vulnerabilities involved in the component to be detected and the version range affected by each vulnerability in the CVE database, where the version range affected by the vulnerability refers to a group of related vulnerabilities that affect multiple versions of the component. Each vulnerability in this set has a unique vulnerability number. In the field of software security, "vulnerability range" is usually used to describe the affected version interval. For example, if a vulnerability affects versions 1.0 to 2.5 of a component, it can be expressed as [1.0, 2.5];
[0039] S11. Determine in turn whether the version information of the component to be detected is within the version range affected by each vulnerability:
[0040] Specifically, the version information is separated by dots, dashes, and underscores to separate the major version number, minor version number, and release version number;
[0041] Convert the version information of the component to be detected into a numerical vector ,in, Indicates the major version number, Indicates the minor version number, Indicates the release version number;
[0042] Convert the version range affected by the vulnerability into a numerical vector ,in, Indicates the starting version. Indicates the end version;
[0043] Will and For comparison:
[0044] ;
[0045] in, represents the judgment function, express exist Within the version range, express Not Available Within the version range, express and The difference, express and The difference.
[0046] If so, there is a corresponding vulnerability in the component to be detected.
[0047] In this embodiment, if exist Afterwards and Previously published, Returns true, indicating that the version of the component to be detected has a vulnerability.
[0048] if Not Available Within the range, Returns false, indicating that the version of the detected component does not have the current vulnerability.
[0049] Based on the above embodiments, the method further includes:
[0050] S2. Obtain the attribute information of each vulnerability in turn, calculate the gain value of each vulnerability according to the attribute information, and determine whether it is a vulnerability to be repaired according to the gain value of the vulnerability;
[0051] Specifically, step S2 includes:
[0052] S21. Obtain all attributes of each vulnerability in turn, and filter out common attributes of all vulnerabilities from all attributes, wherein the common attributes include patch availability, attack vector, heat, and trend popularity;
[0053] Specifically, the attribute value of Patch Availability includes 0 and 1, where 0 means no patch and the processing method is to repair; 1 means there is a patch and it can be ignored;
[0054] The attribute values of Attack Vector include 0, 1, and 2, where 0 indicates a local attack and can be ignored, 1 indicates a remote attack and can be ignored, and 2 indicates a network attack and needs to be repaired;
[0055] Heat indicates the degree of discussion in the security community. The attribute value includes 0 and 1. 0 indicates low heat and can be ignored; 1 indicates high heat and needs to be repaired.
[0056] Trending and Popularity indicates the degree of attention received by attackers. The attribute values include 0, 1, and 2. 0 indicates that it is not popular and can be ignored; 1 indicates that the popularity is low and needs to be fixed; 2 indicates that the popularity is high and needs to be fixed.
[0057] S21. Calculate the gain values of patch availability, attack vector, heat, and trend popularity respectively, and sort them in descending order according to the gain values to obtain a sorted table [patch availability, heat, attack vector, trend popularity];
[0058] Specifically, taking patch availability as an example, the gain value of patch availability is calculated:
[0059] S211. Obtain n vulnerability samples including the availability of the patch from the CVE database;
[0060] S212. Determine different attribute values of the patch availability, and calculate the number of vulnerability samples corresponding to each attribute value in a plurality of vulnerability samples:
[0061] ;
[0062] In the formula, The attribute value indicating the availability of the patch, Indicates that there is a patch. Indicates no patch. Indicates the number of vulnerability samples with patches, Indicates the number of vulnerability samples without patches;
[0063] S213. Calculate the gain value of patch availability based on the number of vulnerability samples corresponding to each attribute value:
[0064] ;
[0065] In the formula, The gain value indicating the patch availability, Indicates the total number of vulnerability samples;
[0066] According to the above formula, the gain values of heat, attack vector, and trend popularity can be calculated in turn. The larger the gain value, the more important the attribute is.
[0067] S23. Obtain the attribute values of the common attributes of the vulnerabilities in sequence according to the sorting table, and determine whether the vulnerability is a vulnerability to be repaired according to the attribute values of the common attributes, such as Figure 2 As shown:
[0068] Get the patch availability attribute value of the current vulnerability, and determine whether the current vulnerability needs to be repaired based on the patch availability attribute value. For example, if the patch availability is 0, the vulnerability needs to be repaired:
[0069] If yes, the current vulnerability is a vulnerability to be fixed;
[0070] Otherwise, obtain the heat attribute value of the current vulnerability;
[0071] Determine whether the current vulnerability needs to be repaired based on the attack vector attribute value:
[0072] If yes, the current vulnerability is a vulnerability to be fixed;
[0073] Otherwise, obtain the attack vector attribute value of the current vulnerability;
[0074] Determine whether the current vulnerability needs to be repaired based on the heat attribute value:
[0075] If yes, the current vulnerability is a vulnerability to be fixed;
[0076] Otherwise, obtain the trend popularity attribute value of the current vulnerability;
[0077] Determine whether the current vulnerability needs to be fixed based on the trend popularity attribute value:
[0078] If yes, the current vulnerability is a vulnerability to be fixed;
[0079] Otherwise, the current vulnerability does not need to be fixed.
[0080] It should be noted that the fact that a vulnerability does not need to be fixed can represent multiple possibilities, for example, there is a patched version or the vulnerability is not dangerous and can be ignored.
[0081] Based on the above embodiments, the method further includes:
[0082] S3. Obtain the basic indicators of each vulnerability to be repaired, calculate the network threat level of each vulnerability to be repaired according to the basic indicators, and determine the priority of the vulnerability to be repaired according to the network threat level;
[0083] Specifically, step S3 includes:
[0084] S31. Obtain basic indicators of the vulnerability to be repaired, the basic indicators including: attack vector AV, attack complexity AC, required authority PR, user interaction UI, confidentiality C, integrity I and availability A;
[0085] Impact sub-scores are calculated based on the impact on confidentiality, integrity, and availability :
[0086] ;
[0087] In the formula, , as well as Represents the total value of confidentiality, integrity and availability impact, usually 10, , as well as Represent the weight factors of confidentiality, integrity and availability respectively.
[0088] S32. Calculate the exploitable sub-score based on the attack vector AV, attack complexity AC, required permissions PR, and user interaction UI :
[0089] ;
[0090] S33. By impact sub-score and available sub-scores Calculate the network threat level of the vulnerability to be repaired :
[0091] ;
[0092] In this embodiment, The vulnerabilities are high threat and require immediate attention and repair; Vulnerabilities between The vulnerability between is of low threat; according to the network threat level The priority order of repairs can be determined. The higher the value, the greater the threat and the more priority needs to be given to repair.
[0093] Based on the above embodiments, the method further includes:
[0094] S4. Determine the current vulnerability to be fixed according to the repair priority, extract the source code of the current vulnerability to be fixed from the source code of the component to be detected, and extract the repair code of the current vulnerability to be fixed from the CVE database;
[0095] Based on the above embodiments, the method further includes:
[0096] S5. Compare the repair code with the source code to determine the modified variables of the current vulnerability to be repaired, and the modified variables of all the vulnerabilities to be repaired constitute the repair solution of the component to be detected;
[0097] Specifically, step S5 includes:
[0098] S51. Perform word segmentation on the source code to obtain a number of words, specifically, the words may be keywords, variable names, function names, etc., determine the identifier of each word according to a preset mapping table, and obtain a first identifier vector, wherein the mapping table contains a correspondence between words and identifiers;
[0099] S52. Compare the repair code with the source code to obtain code change information, including the code location where the change occurs and the content of the change;
[0100] S53. Segmenting the content of the change to obtain a number of words, determining the identifier of each word according to a preset mapping table, and obtaining a second identifier vector;
[0101] S54. Compare the first identification vector with the second identification vector to obtain a modified variable;
[0102] Specifically, the step S54 includes:
[0103] Comparing the identifiers at the same position in the first identifier vector and the second identifier vector;
[0104] If the two identifiers are different, it means that the element in the original code has been modified, and the updated identifier reflects this change, then the identifier in the first identifier vector is modified to the second identifier vector;
[0105] If the identifier does not exist in the second identifier vector, it indicates that the element in the original code may have been deleted, and the identifier in the first identifier vector is deleted.
[0106] In this embodiment, by comparing with the CVE database, all known vulnerabilities in the components to be detected can be accurately identified, providing a clear goal for subsequent repair work. The gain value is calculated using the attribute information of the vulnerability, and the network threat level is calculated using the basic indicators of the vulnerability, thereby obtaining the priority of the vulnerability to be repaired, providing a quantitative basis for determining the order of vulnerability repairs, and ensuring that critical and urgent security issues are resolved first. Embodiment 2:
[0107] like Figure 3 As shown, this embodiment provides a device for generating an automatic component vulnerability repair solution, the device comprising:
[0108] Version comparison module: obtains the component to be detected and its version information, compares the version information of the component to be detected with the CVE database, and determines all vulnerabilities of the component to be detected;
[0109] Gain value calculation module: obtains the attribute information of each vulnerability in turn, calculates the gain value of each vulnerability according to the attribute information, and determines whether it is a vulnerability to be repaired according to the gain value of the vulnerability;
[0110] Threat level calculation module: obtains basic indicators of each vulnerability to be repaired, calculates the network threat level of each vulnerability to be repaired based on the basic indicators, and determines the priority of the vulnerability to be repaired according to the network threat level;
[0111] Determination module: Determine the current vulnerability to be fixed according to the repair priority, extract the source code of the current vulnerability to be fixed from the source code of the component to be detected, and extract the repair code of the current vulnerability to be fixed from the CVE database;
[0112] Repair plan generation module: compares the repair code with the source code to determine the modified variables of the current vulnerability to be repaired, and the repair plan of the component to be detected is composed of the modified variables of all the vulnerabilities to be repaired.
[0113] Based on the above embodiment, the version comparison module includes:
[0114] The first acquisition unit: acquires the vulnerabilities involved in the component to be detected and the version range affected by each vulnerability in the CVE database;
[0115] The first comparison unit: determines in turn whether the version information of the component to be detected is within the version range affected by each vulnerability:
[0116] If so, there is a corresponding vulnerability in the component to be detected.
[0117] Based on the above embodiment, the first comparison unit includes:
[0118] Split unit: Use dots, dashes, and underscores to split the version information into major version number, minor version number, and release version number;
[0119] The first conversion unit: converts the version information of the component to be detected into a numerical vector ,in, Indicates the major version number, Indicates the minor version number, Indicates the release version number;
[0120] Second conversion unit: convert the version range affected by the vulnerability into a numerical vector ,in, Indicates the starting version. Indicates the end version;
[0121] Comparison unit: and For comparison:
[0122] ;
[0123] in, represents the judgment function, express exist Within the version range, express Not Available Within the version range, express and The difference, express and The difference.
[0124] Based on the above embodiment, the gain value calculation module includes:
[0125] Screening unit: obtains all attributes of each vulnerability in turn, and screens out common attributes of all vulnerabilities from all attributes, wherein the common attributes include patch availability, attack vector, heat, and trend popularity;
[0126] Descending sorting unit: calculates the gain values of patch availability, attack vector, heat, and trend popularity respectively, and sorts them in descending order according to the gain values to obtain a sorting table;
[0127] Judgment unit: obtain the attribute values of the common attributes of the vulnerabilities in sequence according to the sorting table, and judge whether the vulnerability is a vulnerability to be repaired according to the attribute values of the common attributes:
[0128] Get the patch availability attribute value of the current vulnerability, and determine whether the current vulnerability needs to be repaired based on the patch availability attribute value:
[0129] If yes, the current vulnerability is a vulnerability to be fixed;
[0130] Otherwise, obtain the heat attribute value of the current vulnerability;
[0131] Determine whether the current vulnerability needs to be repaired based on the heat attribute value:
[0132] If yes, the current vulnerability is a vulnerability to be fixed;
[0133] Otherwise, obtain the attack vector attribute value of the current vulnerability;
[0134] Determine whether the current vulnerability needs to be repaired based on the attack vector attribute value:
[0135] If yes, the current vulnerability is a vulnerability to be fixed;
[0136] Otherwise, obtain the trend popularity attribute value of the current vulnerability;
[0137] Determine whether the current vulnerability needs to be fixed based on the trend popularity attribute value:
[0138] If yes, the current vulnerability is a vulnerability to be fixed;
[0139] Otherwise, the current vulnerability does not need to be fixed.
[0140] Based on the above embodiment, the descending sorting unit includes:
[0141] A second acquisition unit: acquiring a plurality of vulnerability samples including the availability of the patch from a CVE database;
[0142] The first calculation unit: determines different attribute values of the patch availability, and respectively calculates the number of vulnerability samples corresponding to each attribute value in a plurality of vulnerability samples:
[0143] ;
[0144] In the formula, The attribute value indicating the availability of the patch, Indicates that there is a patch. Indicates no patch. Indicates the number of vulnerability samples with patches, Indicates the number of vulnerability samples without patches;
[0145] Second calculation unit: calculate the gain value of patch availability according to the number of vulnerability samples corresponding to each attribute value:
[0146] ;
[0147] In the formula, The gain value indicating the patch availability, Indicates the total number of vulnerability samples.
[0148] Based on the above embodiment, the repair solution generation module includes:
[0149] The first word segmentation unit: performs word segmentation processing on the source code to obtain a plurality of words, determines the identifier of each word according to a preset mapping table, and obtains a first identifier vector;
[0150] The second comparison unit compares the repair code with the source code to obtain code change information, wherein the change information includes the code position where the change occurs and the content of the change;
[0151] Second word segmentation unit: performs word segmentation processing on the changed content to obtain a plurality of words, determines the identifier of each word according to a preset mapping table, and obtains a second identifier vector;
[0152] The third comparison unit compares the first identification vector with the second identification vector to obtain a modified variable.
[0153] Based on the above embodiment, the third comparison unit includes:
[0154] Comparing the identifiers at the same position in the first identifier vector and the second identifier vector;
[0155] If the two identifications are different, the identification in the first identification vector is modified to the second identification vector;
[0156] If the identifier does not exist in the second identifier vector, the identifier in the first identifier vector is deleted.
[0157] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here. Embodiment 3:
[0158] Corresponding to the above method embodiment, this embodiment also provides a component vulnerability automatic repair solution generation device. The component vulnerability automatic repair solution generation device described below and the component vulnerability automatic repair solution generation method described above can refer to each other.
[0159] Figure 4 FIG. 8 is a block diagram of a device 800 for generating an automatic component vulnerability repair solution according to an exemplary embodiment. Figure 4 As shown, the component vulnerability automatic repair solution generation device 800 may include: a processor 801 and a memory 802. The component vulnerability automatic repair solution generation device 800 may also include one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.
[0160] The processor 801 is used to control the overall operation of the component vulnerability automatic repair solution generation device 800 to complete all or part of the steps in the above-mentioned component vulnerability automatic repair solution generation method. The memory 802 is used to store various types of data to support the operation of the component vulnerability automatic repair solution generation device 800. These data may include, for example, instructions for any application or method operating on the component vulnerability automatic repair solution generation device 800, as well as application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 802 or sent via the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules can be keyboards, mice, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the component vulnerability automatic repair solution generation device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 805 can include: Wi-Fi module, Bluetooth module, NFC module.
[0161] In an exemplary embodiment, the component vulnerability automatic repair solution generation device 800 can be implemented by one or more application specific integrated circuits (Application Specific Integrated Circuit, referred to as ASIC), digital signal processors (Digital Signal Processing Device, referred to as DSP), digital signal processing devices (Digital Signal Processing Device, referred to as DSPD), programmable logic devices (Programmable Logic Device, referred to as PLD), field programmable gate arrays (Field Programmable Gate Array, referred to as FPGA), controllers, microcontrollers, microprocessors or other electronic components, and are used to execute the above-mentioned component vulnerability automatic repair solution generation method.
[0162] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned component vulnerability automatic repair solution generation method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the component vulnerability automatic repair solution generation device 800 to complete the above-mentioned component vulnerability automatic repair solution generation method.
[0163] Embodiment 4:
[0164] Corresponding to the above method embodiment, a readable storage medium is also provided in this embodiment. The readable storage medium described below and the method for generating an automatic component vulnerability repair solution described above can refer to each other.
[0165] A readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for generating an automatic component vulnerability repair solution in the above method embodiment.
[0166] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0167] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0168] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for generating an automatic repair solution for a component vulnerability, characterized in that: include: Obtain the component to be detected and its version information, compare the version information of the component to be detected with the CVE database, and determine all vulnerabilities of the component to be detected; Obtaining attribute information of each vulnerability in turn, calculating a gain value of each vulnerability according to the attribute information, and determining whether the vulnerability is a vulnerability to be repaired according to the gain value of the vulnerability, including: Obtain all attributes of each vulnerability in turn, and filter out common attributes of all vulnerabilities from all attributes, wherein the common attributes include patch availability, attack vector, heat, and trend popularity; The gain values of patch availability, attack vector, heat, and trend popularity are calculated respectively, and sorted in descending order according to the gain values to obtain a sorting table. The calculation method of the gain value of patch availability is: Obtaining several vulnerability samples including the availability of the patch from the CVE database; Determine different attribute values of the patch availability, and calculate the number of vulnerability samples corresponding to each attribute value in a number of vulnerability samples: Where A represents the attribute value of patch availability, A=1 represents the availability of a patch, A=0 represents the absence of a patch, x1 represents the number of vulnerability samples with a patch, and x2 represents the number of vulnerability samples without a patch; The gain value of patch availability is calculated based on the number of vulnerability samples corresponding to each attribute value: In the formula, E1 represents the gain value of patch availability, and n represents the total number of vulnerability samples; Obtaining basic indicators for each vulnerability to be fixed, calculating the network threat level of each vulnerability to be fixed based on the basic indicators, and determining the priority of the vulnerability to be fixed based on the network threat level, including: Obtain basic indicators of the vulnerability to be repaired, including: attack vector AV, attack complexity AC, required permission PR, user interaction UI, confidentiality C, integrity I and availability A; The impact sub-score γ1 is calculated based on the impact of confidentiality, integrity, and availability: The exploitable sub-score γ2 is calculated based on the attack vector AV, attack complexity AC, required permissions PR, and user interaction UI: γ2=f(AC,AV,PR,U); The network threat level δ of the vulnerability to be fixed is calculated by the impact sub-score γ1 and the exploitable sub-score γ2: Determine the current vulnerability to be fixed according to the repair priority, extract the source code of the current vulnerability to be fixed from the source code of the component to be detected, and extract the repair code of the current vulnerability to be fixed from the CVE database; The repair code is compared with the source code to determine the modified variables of the current vulnerability to be repaired, and the modified variables of all the vulnerabilities to be repaired constitute the repair plan of the component to be detected.
2. The method for generating an automatic component vulnerability repair solution according to claim 1, characterized in that ,Compare the version information of the component to be detected with the CVE database to determine all the vulnerabilities of the component to be detected, including: Obtain the vulnerabilities involved in the components to be detected and the version range affected by each vulnerability in the CVE database; Determine in turn whether the version information of the component to be detected is within the version range affected by each vulnerability: If so, there is a corresponding vulnerability in the component to be detected.
3. The method for generating an automatic component vulnerability repair solution according to claim 2, characterized in that ,Determine whether the version information is within the version range affected by the vulnerability, including: Use dots, dashes, and underscores to separate the version information into major version number, minor version number, and release version number. Convert the version information of the component to be detected into a numerical vector V = [x, y, z], where x represents the major version number, y represents the minor version number, and z represents the release version number; Convert the version range affected by the vulnerability into a numerical vector L = [L s ,L e ], where L s Indicates the starting version, L e Indicates the end version; Compare V = [x, y, z] with L = [L s , L e : Among them, IsVulnerable(V,L) represents the judgment function, true means that L is within the version range of V, false means that L is not within the version range of V, CompareVersions(V,L s ) represents V and L s The difference between CompareVersions(V,L e ) represents V and L e The difference.
4. The method for generating an automatic component vulnerability repair solution according to claim 1, characterized in that ,Determine whether it is a vulnerability to be fixed according to the gain value of the vulnerability, including: According to the sorting table, the attribute values of the common attributes of the vulnerabilities are obtained in turn, and the attribute values of the common attributes are used to determine whether the vulnerability is a vulnerability to be repaired: Get the patch availability attribute value of the current vulnerability, and determine whether the current vulnerability needs to be repaired based on the patch availability attribute value: If yes, the current vulnerability is a vulnerability to be fixed; Otherwise, obtain the heat attribute value of the current vulnerability; Determine whether the current vulnerability needs to be repaired based on the heat attribute value: If yes, the current vulnerability is a vulnerability to be fixed; Otherwise, obtain the attack vector attribute value of the current vulnerability; Determine whether the current vulnerability needs to be repaired based on the attack vector attribute value: If yes, the current vulnerability is a vulnerability to be fixed; Otherwise, obtain the trend popularity attribute value of the current vulnerability; Determine whether the current vulnerability needs to be fixed based on the trend popularity attribute value: If yes, the current vulnerability is a vulnerability to be fixed; Otherwise, the current vulnerability does not need to be fixed.
5. The method for generating an automatic component vulnerability repair solution according to claim 1, characterized in that ,Compare the repair code with the source code to determine the modified variables of the current vulnerability to be repaired, including: Perform word segmentation on the source code to obtain a plurality of words, determine the identifier of each word according to a preset mapping table, and obtain a first identifier vector; Compare the repair code with the source code to obtain code change information, wherein the change information includes the code location where the change occurs and the content of the change; Perform word segmentation on the changed content to obtain a plurality of words, determine the identifier of each word according to a preset mapping table, and obtain a second identifier vector; The first identification vector is compared with the second identification vector to obtain a modified variable.
6. The method for generating an automatic component vulnerability repair solution according to claim 5, characterized in that , compare the first identification vector with the second identification vector to obtain the modified variables, including: Comparing the identifiers at the same position in the first identifier vector and the second identifier vector; If the two identifications are different, the identification in the first identification vector is modified to the second identification vector; If the identifier does not exist in the second identifier vector, the identifier in the first identifier vector is deleted.
7. A device for generating an automatic component vulnerability repair solution, used to implement any one of the component vulnerability automatic repair solution generation methods in claims 1-6, characterized in that: include: Version comparison module: obtains the component to be detected and its version information, compares the version information of the component to be detected with the CVE database, and determines all vulnerabilities of the component to be detected; Gain value calculation module: obtains the attribute information of each vulnerability in turn, calculates the gain value of each vulnerability according to the attribute information, and determines whether it is a vulnerability to be repaired according to the gain value of the vulnerability; Threat level calculation module: obtains basic indicators of each vulnerability to be repaired, calculates the network threat level of each vulnerability to be repaired based on the basic indicators, and determines the priority of the vulnerability to be repaired according to the network threat level; Determination module: Determine the current vulnerability to be fixed according to the repair priority, extract the source code of the current vulnerability to be fixed from the source code of the component to be detected, and extract the repair code of the current vulnerability to be fixed from the CVE database; Repair plan generation module: compares the repair code with the source code to determine the modified variables of the current vulnerability to be repaired, and the repair plan of the component to be detected is composed of the modified variables of all the vulnerabilities to be repaired.
8. A device for generating automatic component vulnerability repair solutions, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for generating an automatic component vulnerability repair solution as claimed in any one of claims 1 to 6 when executing the computer program.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for generating an automatic component vulnerability repair solution as claimed in any one of claims 1 to 6.
