WO2022247199A1 - 一种开源组件的漏洞检测方法及装置 - Google Patents

一种开源组件的漏洞检测方法及装置 Download PDF

Info

Publication number
WO2022247199A1
WO2022247199A1 PCT/CN2021/134643 CN2021134643W WO2022247199A1 WO 2022247199 A1 WO2022247199 A1 WO 2022247199A1 CN 2021134643 W CN2021134643 W CN 2021134643W WO 2022247199 A1 WO2022247199 A1 WO 2022247199A1
Authority
WO
WIPO (PCT)
Prior art keywords
open source
vulnerability
source component
component
information
Prior art date
Application number
PCT/CN2021/134643
Other languages
English (en)
French (fr)
Inventor
余炯斌
Original Assignee
深圳前海微众银行股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2022247199A1 publication Critical patent/WO2022247199A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Definitions

  • Embodiments of the present invention relate to the field of financial technology (Fintech), and in particular to a method and device for detecting vulnerabilities of open source components.
  • Open source components are a class of third-party components that can be applied to the development of software applications, which are characterized by openness, diversity and convenience. Developers who develop software applications based on open source components can reduce development time, improve development efficiency, and develop software applications more quickly. Based on the characteristics of open source components, open source components began to be applied to the field of financial technology in order to provide more convenient services for developers of financial enterprises.
  • the existing scheme detects the vulnerability of the open source components used in the Java project, firstly, the names and version numbers of the open source components actually used in the project are obtained by scanning the built code directory or directly analyzing the files that the open source components depend on in the Java project. . Then compare the name and corresponding version number of each open source component with the component vulnerability information obtained from the outside world to determine whether the Java project uses a vulnerable open source component, and if so, upgrade the vulnerable open source component.
  • the upgrade of open source components takes a long time, or the Java project is suspended due to the upgrade of open source components, which affects the quality of financial services.
  • the embodiment of the present invention provides a method and device for detecting vulnerabilities of open source components, which are used to improve the research and development efficiency of Java projects and ensure the stability of the system where the Java projects are located.
  • the embodiment of the present invention provides a vulnerability detection method of an open source component, including:
  • each open source component when determining that the open source component information of the open source component is located in the component vulnerability version library, determine whether the class or function called by the Java project when using the open source component exists in the component vulnerability information library ; Vulnerability information of classes or functions corresponding to each open source component is stored in the component vulnerability information library;
  • the open source component is repaired based on the vulnerability repair priority of the open source component.
  • the technical solution in the present invention introduces scanning at the program code level, that is, when it is determined that the open source component information of a certain open source component is located in the component vulnerability version library, the program code of the Java project uses the class called when the open source component or function is compared with various types or functions in the component vulnerability information base, it can be timely and effectively determined whether the Java project is actually affected by the vulnerability.
  • each open source component is repaired based on the vulnerability repair priority of each open source component.
  • each open source component can be promptly and accurately promoted according to the actual impact of each open source It can make the repair and upgrade of each open source component more targeted, thereby improving the research and development efficiency of the Java project, and ensuring the stability of the system where the Java project is located, so as to improve the quality of financial services and solve the existing problems.
  • the open source component information includes parent component information of the open source component; the parent component information is used to indicate that the open source component is a directly imported component or an indirectly imported component of the Java project;
  • the Java project Before determining whether the class or function called by the Java project when using the open source component exists in the component vulnerability information base, it also includes:
  • the open source component is a directly imported component of the Java project.
  • the open source component information also includes the name and version number of the open source component
  • the open source component information for determining the open source component is located in the component vulnerability version library, including:
  • the name and version number of the open source component can be compared with the name and version number of each open source component in the component vulnerability version library, It is possible to timely and accurately determine whether there are vulnerabilities in the open source components of this version number, so that it can be determined in a timely manner whether the open source components of this version number may be affected by vulnerabilities, so as to determine whether the Java project using the open source components of this version number is actually vulnerable influence support.
  • the open source component information also includes an organization identifier of the open source component
  • the method also includes:
  • the organization identification corresponding to the parent component of the open source component is an internal identification, send the vulnerability information of the open source component and the parent component to the internal person in charge;
  • the organization identifier corresponding to the parent component of the open source component is an external identifier, send the vulnerability information of the open source component and the parent component to an external person in charge.
  • the open source component is determined to be an indirectly imported component
  • the indirect imported component external open source component
  • Pushing to update open source components may cause the problem that new versions of open source components are not compatible with Java projects.
  • there are two ways to upgrade the parent component that is, whether the parent component is developed internally or externally. Based on these two different upgrade methods, the upgrade of the parent component can be targeted and help To improve R&D efficiency and ensure system stability.
  • the component vulnerability information base is determined in the following manner:
  • Described determining whether the class or function called by the Java project when using the open source component exists in the component vulnerability information base including:
  • For the second type or the second function in the component vulnerability information base determine the matching degree between the first type and the second type, or the matching degree between the first function and the second function;
  • the matching degree Based on the relationship between the matching degree and the matching threshold, it is determined whether the first type or the first function called when using the open source component exists in the component vulnerability information base.
  • the first category is compared with the second category, or the first function is compared with the second function, and based on the matching degree and matching
  • the size relationship of the threshold value can promptly and accurately determine whether the first type or the first function exists in the component vulnerability information base, so as to provide support for timely determining whether the Java project is actually affected by the vulnerability.
  • the vulnerability repair priority of the open source component is determined in the following manner:
  • the vulnerability repair priority of the open source component is determined.
  • the vulnerability is evaluated by adding multiple dimensions, that is, through the first vulnerability impact value, the second vulnerability impact value, the third vulnerability impact value, and the fourth vulnerability impact value To determine the priority of vulnerability repair of open source components, it is helpful to promote the upgrade of open source components with vulnerabilities according to the actual impact of Java projects.
  • the levels corresponding to the vulnerability repair priority include the first level, the second level and the third level;
  • the level corresponding to the vulnerability priority of the open source component is the third level, keep observing the open source component.
  • the upgrade repair level corresponding to each open source component is determined, and the corresponding upgrade repair is performed on each open source component based on the upgrade repair level corresponding to each open source component, so that each The upgrade and repair of open source components is more targeted, and can help improve the efficiency of research and development and ensure system stability, which can solve the problems in the existing technology that when the version number of the open source component in the Java project is affected, the update will be promoted, which will cause The workload of a large number of unnecessary open source components when upgrading reduces the efficiency of research and development.
  • the embodiment of the present invention also provides a vulnerability detection device for open source components, including:
  • the obtaining unit is used to obtain the open source component information of each open source component in the Java project;
  • a processing unit for each open source component, when determining that the open source component information of the open source component is located in the component vulnerability version library, determine whether the class or function called by the Java project when using the open source component exists in In the component vulnerability information base; the component vulnerability information base stores the vulnerability information of the class or function corresponding to each open source component; if so, repair the open source component based on the vulnerability repair priority of the open source component.
  • the open source component information includes parent component information of the open source component; the parent component information is used to indicate that the open source component is a directly imported component or an indirectly imported component of the Java project;
  • the processing unit is also used for:
  • the open source component is a directly imported component of the Java project.
  • the open source component information also includes the name and version number of the open source component
  • the processing unit is specifically used for:
  • the open source component information also includes an organization identifier of the open source component
  • the processing unit is also used for:
  • the organization identification corresponding to the parent component of the open source component is an internal identification, send the vulnerability information of the open source component and the parent component to the internal person in charge;
  • the organization identifier corresponding to the parent component of the open source component is an external identifier, send the vulnerability information of the open source component and the parent component to an external person in charge.
  • processing unit is specifically configured to:
  • the processing unit is specifically used for:
  • For the second type or the second function in the component vulnerability information base determine the matching degree between the first type and the second type, or the matching degree between the first function and the second function;
  • the matching degree Based on the relationship between the matching degree and the matching threshold, it is determined whether the first type or the first function called when using the open source component exists in the component vulnerability information base.
  • processing unit is specifically configured to:
  • the vulnerability repair priority of the open source component is determined.
  • the levels corresponding to the vulnerability repair priority include the first level, the second level and the third level;
  • the processing unit is specifically used for:
  • the level corresponding to the vulnerability priority of the open source component is the third level, keep observing the open source component.
  • an embodiment of the present invention provides a computing device, including at least one processor and at least one memory, wherein the memory stores a computer program, and when the program is executed by the processor, the processing The device executes the vulnerability detection method of any open source component described in the first aspect above.
  • an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program executable by a computing device, and when the program runs on the computing device, the computing device executes the above-mentioned first The vulnerability detection method of any open source component described in the aspect.
  • FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the present invention
  • FIG. 2 is a schematic flow diagram of a vulnerability detection method of an open source component provided by an embodiment of the present invention
  • FIG. 3 is a schematic flow diagram of another open source component vulnerability detection method provided by an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of an open source component vulnerability detection device provided by an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a computing device provided by an embodiment of the present invention.
  • Maven an open source software project management and automatic construction tool. It is a project management tool software that can manage the construction, reporting and documentation of projects through a short description of information.
  • a JVM-based build tool which is a general and flexible open source project automation build tool, supports maven, Ivy warehouses, and supports transitive dependency management without the need for remote warehouses or pom.xml and ivy.xml
  • the configuration file is based on Groovy, and the build script is written in Groovy.
  • Maven warehouse used to store generated builds and various dependencies for use in the build process.
  • DOS attack (Denial of Service attack, denial of service): It refers to a malicious attack on the flaws in the implementation of the network protocol or the brutal depletion of the resources of the attacked object directly through brutal means, with the purpose of making the target computer or network unable to provide normal
  • the service or resource access of the target system causes the target system service system to stop responding or even crash, and this attack does not include intrusion into the target server or target network equipment.
  • DDOS attack distributed Denial of Service attack, distributed denial of service attack: refers to the use of client/server technology to combine multiple computers as an attack platform to launch a DDOS attack on one or more targets, thereby becoming Double the power of denial of service attacks.
  • the attacker uses a stolen account to install the DDOS main control program on a computer.
  • the main control program will communicate with a large number of agent programs.
  • the agent programs have been installed on many computers on the network. The agent launches an attack when instructed to do so.
  • the master control program can activate hundreds of thousands of agent program runs in seconds. For example, use a large number of reasonable service requests to occupy too many service resources, so that legitimate users cannot get service responses.
  • FIG. 1 is a system architecture provided by an embodiment of the present invention.
  • the system architecture may be a server 100 including a processor 110 , a communication interface 120 and a memory 130 .
  • the communication interface 120 is used to communicate with the terminal equipment, send and receive information transmitted by the terminal equipment, and realize communication.
  • the processor 110 is the control center of the server 100, using various interfaces and lines to connect various parts of the entire server 100, by running or executing software programs/or modules stored in the memory 130, and calling data stored in the memory 130, Various functions of the server 100 are executed and data is processed.
  • the processor 110 may include one or more processing units.
  • the memory 130 can be used to store software programs and modules, and the processor 110 executes various functional applications and data processing by running the software programs and modules stored in the memory 130 .
  • the memory 130 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required by a function, etc.; the data storage area may store data created according to business processing, etc.
  • the memory 130 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices.
  • FIG. 1 is only an example, which is not limited in this embodiment of the present invention.
  • FIG. 2 exemplarily shows the flow of a method for detecting vulnerabilities of open source components provided by an embodiment of the present invention, and the flow can be executed by a device for detecting vulnerabilities of open source components.
  • the process specifically includes:
  • Step 201 obtain the open source component information of each open source component in the Java project.
  • Step 202 for each open source component, when it is determined that the open source component information of the open source component is located in the component vulnerability version library, determine whether the class or function called by the Java project when using the open source component exists in the component vulnerability in the information base.
  • Step 203 if it is determined that the class or function called by the Java project when using the open source component exists in the component vulnerability information base, repair the open source component based on the vulnerability repair priority of the open source component.
  • the open source component information may include the open source component name, version number, organization identifier, project identifier, parent component information, and the like.
  • the open source component may include FastJSON, jackson-databind, Xstream, etc.; the parent component information is used to indicate that the open source component is a directly imported component or an indirectly imported component of the Java project.
  • the parent component information of the open source component for example, there are open source component 1 and open source component 2 in the Java project, but the open source component 1 needs to call the external open source component 3, and the open source component 2 does not need to call the external open source component , so open source component 1 is the parent component of open source component 3, then open source component 1 and open source component 2 are directly imported components of the Java project, and open source component 3 is an indirect imported component of the Java project.
  • each open source component obtained by scanning the project directory and the name, groupId, artifactId, version number, and parent component information of each open source component extracted based on the dependency tree are integrated and processed to obtain
  • the integrated open source component information of each open source component is stored in the database, so as to provide data support for subsequent determination of whether the Java project is affected by the actual vulnerability.
  • step 202 for each open source component in the Java project, when it is determined that the open source component information of the open source component is located in the component vulnerability version library, it is determined whether the class or function called by the Java project when using the open source component exists in the component vulnerability information library.
  • the vulnerability information of the class or function corresponding to each open source component is stored in the component vulnerability information database.
  • the vulnerability information of the class or function corresponding to each open source component is obtained from the component vulnerability disclosure platform, and the corresponding class or function of each open source The function vulnerability information is stored in the component vulnerability information base.
  • the name and version number of the open source component are compared with the name and version number of each open source component in the component vulnerability version library. Yes, if they are consistent, it is determined that the name and version number of the open source component are located in the component vulnerability version library. In this way, it is possible to timely and accurately determine whether the open source component of this version number has a vulnerability, so that it can be determined in a timely manner whether the open source component of this version number may be affected by the vulnerability, so as to determine whether the Java project using the open source component of this version number is practical. Support is provided for those affected by the vulnerability.
  • an open source component directly used by a Java project needs to call an external open source component to complete the call execution process for the open source component directly used by the Java project, that is, the open source component needs to rely on an external open source component to jointly Complete the invocation of the open source components directly used by the Java project. Therefore, after determining that the open source components are located in the component vulnerability version library, it is necessary to determine whether the open source components are directly imported components of the Java project, so as to avoid direct and separate upgrades of indirect imported components (external Open source components) are prone to incompatibility with Java projects. Then, after determining that the open source component is an indirectly imported component of the Java project, the first type or the first function called when using the open source component is extracted from the source code of the Java project.
  • the matching degree between the first type and the second type, or the matching degree between the first function and the second function determines the matching degree between the first type and the second type, or the matching degree between the first function and the second function, and based on the relationship between the matching degree and the matching threshold, that is It can be timely and accurately determined whether the first type or the first function called when using the open source component exists in the component vulnerability information base, so as to provide support for timely determining whether the Java project is actually affected by the vulnerability.
  • the matching threshold can be set according to the experience of those skilled in the art or according to the actual application scenario, which is not limited in this embodiment of the present invention.
  • an open source component is determined to be an indirectly imported component of a Java project
  • the indirect imported component can be upgraded and repaired in the following manner: If the organization ID corresponding to the parent component of the open source component (indirectly imported component) is an internal ID , send the vulnerability information of the open source component and the parent component to the internal person in charge, so that the internal person in charge can upgrade and repair the parent component. If the organization ID corresponding to the parent component of the open source component is an external ID, send the vulnerability information of the open source component and the parent component to the external responsible person, so that the external responsible person can upgrade and repair the parent component.
  • the open source component is determined to be an indirectly imported component
  • the indirect imported component external open source component
  • there are two ways to upgrade the parent component that is, whether the parent component is developed internally or externally. Based on these two different upgrade methods, the upgrade of the parent component can be targeted and help To improve R&D efficiency and ensure system stability.
  • the open source component is repaired based on the vulnerability repair priority of the open source component.
  • the vulnerability repair priority of each open source component can be determined in the following manner: determine the first vulnerability impact value according to whether the Java project is affected by the vulnerability; determine the second vulnerability impact value according to whether the Java project is an external project ;According to whether there is a vulnerability verification program or an exploit program for the vulnerability corresponding to the class or function called when using the open source component, and when it is determined that there is a vulnerability verification program or exploit program, determine whether the vulnerability corresponding to the class or function can be remotely exploited attack, determine the impact value of the third vulnerability; determine the impact value of the fourth vulnerability according to the degree of harm of the vulnerability corresponding to the class or function; determine the impact value of the fourth vulnerability according to the impact value of the first vulnerability, the Vulnerability impact value determines the priority of vulnerability repair of open source components.
  • the open source component is determined by adding multiple dimensions of evaluation to the vulnerability, that is, through the first vulnerability impact value, the second vulnerability impact value, the third vulnerability impact value, and the fourth vulnerability impact value.
  • Vulnerability repair priority which helps to promote the upgrade of open source components with vulnerabilities according to the actual impact of Java projects.
  • each open source component After determining the vulnerability repair priority of each open source component, set the corresponding upgrade repair level for each open source component. Specifically, if it is determined that the level corresponding to the vulnerability priority of the open source component is the first level, the open source component is repaired first; if it is determined that the level corresponding to the vulnerability priority of the open source component is the second level, then the open source component is repaired Schedule repairs; if it is determined that the level corresponding to the vulnerability priority of the open source component is the third level, then keep observation on the open source component.
  • the vulnerability repair priority of an open source component is 7.5 points, the open source component needs to be repaired first; if the vulnerability repair priority of the open source component is 6.5 points, the open source component needs to be repaired according to schedule ; If the vulnerability repair priority of the open source component is 3.5 points, you can keep the open source component under observation first.
  • the upgrade repair level corresponding to each open source component is determined, and the corresponding upgrade repair is performed on each open source component based on the upgrade repair level corresponding to each open source component, so that the open source component’s Upgrades and repairs are more targeted, and can help improve research and development efficiency and ensure system stability, which can then solve the problems in the existing technology that when the version number of an open source component in a Java project is affected, the update will be promoted, which will generate a large number of unnecessary The workload of upgrading open source components reduces the efficiency of research and development.
  • FIG. 3 is a schematic flowchart of another open source component vulnerability detection method provided by an embodiment of the present invention.
  • Step1 Collect the open source component information of each open source component in the Java project.
  • a project directory with open source components based on the code repository. That is, by putting the open source component information on which the source code of the Java project depends on into the project directory, a project directory with open source components can be constructed. Among them, the source code is stored in the project directory itself. It should be noted that, in order to save storage space, the project directory does not store open source component information in advance. Then collect the name and version number of each open source component used by the Java project by scanning the built project directory.
  • the dependency tree of the Java project is generated by the project construction tool, and the name, organization identifier (groupId), project identifier (artifactId), version number, and parent component information of each open source component are extracted based on the dependency tree.
  • groupId organization identifier
  • artifactId project identifier
  • version number version number
  • parent component information of each open source component are extracted based on the dependency tree.
  • the open source component if the open source component has a parent component, it means that the open source component is an indirect import component of the Java project; if the open source component has no parent component, it means that the open source component is a direct import component of the Java project .
  • the dependency tree can be further traversed based on the open source component, so as to trace the open source components directly introduced by the Java project.
  • the parent component information of the open source component for example, there are open source component A and open source component B in the Java project, but the open source component A needs to call the external open source component C, and the open source component B does not need to call the external open source component, Therefore, open source component A is the parent component of open source component C, then open source component A and open source component B are directly imported components of the Java project, and open source component C is an indirect imported component of the Java project.
  • the name, organization ID, project ID, and version of each open source component extracted from the name and version number of each open source component obtained by scanning the built project directory and the dependency tree of the Java project generated by the project construction tool ID and parent component information are integrated to obtain integrated open source component information, and the integrated open source component information is stored in the database.
  • developers, operation and maintenance personnel or other database management personnel can maintain it in daily work. In this way, if there is new open source component vulnerability information, it can be directly queried in the database to determine whether there are open source components with vulnerabilities among the open source components used by the Java project, thereby effectively improving the open source component vulnerability response and investigation efficiency.
  • the embodiment of the present invention can use continuous integration tools to connect to code warehouses such as GitLab to realize automatic construction of project directories with open source components, and collect open source components used by Java projects by scanning the built project directories name and version number. Then use Maven, Gradle and other tools to generate the dependency tree of each project, and extract the name, groupId, artifactId, version number, and parent component information of each open source component based on the dependency tree. Then, the name and version number of each open source component obtained by scanning the project directory and the name, groupId, artifactId, version number, and parent component information of each open source component extracted based on the dependency tree are integrated and processed to obtain The integrated open source component information of each open source component is stored in the database.
  • the source code inspection is generally aimed at the open source components directly imported by the Java project, it is not necessary to build a project directory with open source components and generate a dependency tree of a Java project through a project construction tool, directly through scanning and Analyze the configuration files such as pom.xml and build.gradle in the code directory (that is, the project directory that does not store open source components) to obtain the open source component information of each open source component used by the Java project, that is, collect the name of each open source component , groupId, artifactId, version number and other information, and store the collected open source component information of each open source component in the database.
  • Step2 Scan the source code of the Java project to check whether the Java project actually uses a vulnerable class or function.
  • the disclosed open source component vulnerability information After obtaining the disclosed open source component vulnerability information, compare the name and version number of each open source component stored in the database in Step 1 with the name and version number of each open source component in the disclosed open source component vulnerability information. That is, for each open source component in the open source components stored in the database, the name and version number of the open source component are matched with the name and version number of each open source component in the open source component vulnerability information to determine multiple matching degrees. If the maximum matching degree among the multiple matching degrees is greater than or equal to the first matching threshold, it is determined that the open source component of the version number is affected by the vulnerability, otherwise it is determined that the open source component of the version number is not affected by the vulnerability.
  • the open source component with the version number is affected by the vulnerability
  • obtain the published vulnerability data from domestic and foreign vulnerability disclosure platforms that is, obtain the vulnerability information of the class or function corresponding to the version number of each open source component, and store the obtained open source component
  • the vulnerability information of the class or function corresponding to the version number is stored in the component vulnerability information base.
  • scan the source code of the Java project to obtain the class or function called when the Java project uses the open source component of the version number, and store the class and component vulnerability information library called when the Java project uses the open source component of the version number Match the class corresponding to the version number of each open source component in , and determine multiple matching degrees.
  • the maximum matching degree among the multiple matching degrees is greater than or equal to the second matching threshold, it means that the open source component of this version number calls a vulnerability class, it can show that the Java project actually uses the class with the vulnerability, which can show that the Java project is actually affected by the vulnerability. Or, match the function called when the Java project uses the open source component of this version number with the function corresponding to the version number of each open source component in the component vulnerability information base to determine multiple matching degrees, if the multiple matching degrees If the maximum matching degree is greater than or equal to the second matching threshold, it means that the open source component of this version number calls the function with the vulnerability, which means that the Java project actually uses the function with the vulnerability, thus indicating that the Java project is actually affected by the vulnerability.
  • the first matching threshold and the second matching threshold may be set according to experience of a person skilled in the art or according to an actual application scenario, which is not limited in this embodiment of the present invention.
  • Step a After the disclosure of the vulnerability information of the open source component, the disclosed vulnerability information of the open source component is obtained, and the disclosed vulnerability information of the open source component is stored in the component vulnerability version library. Then, for any open source component stored in the database in Step1, compare the name and version number of the open source component with the name and version number of each open source component in the component vulnerability version library to determine whether the open source component with the version number is affected by the vulnerability. If it is determined that the open source component with the version number is affected by the vulnerability, step b can be performed.
  • Step b After determining that the open source component of a certain version number is affected by the vulnerability, determine whether the open source component of the version number is a directly imported component based on the parent component information of the open source component of the version number. If the open source component of this version number is a directly imported component, then step c can be performed; if the open source component of this version number is not a directly imported component, that is, the open source component of this version number is an indirectly imported component, then step Step 4 can be performed.
  • Step c After determining that the open source component of the version number is a directly imported component, collect the vulnerability information of the class or function corresponding to the version number of each open source component, and store the vulnerability information of the class or function corresponding to the version number of each open source component to the component vulnerability repository. That is, the published vulnerability data can be obtained from domestic and foreign vulnerability disclosure platforms, that is, vulnerability data such as the name of the open source component of the vulnerability, the version number of the open source component of the vulnerability, information about the class or function of the vulnerability, and the detailed content of the vulnerability.
  • CVE Common Vulnerabilities and Exposures, public vulnerabilities and exposures
  • CNNVD China National Vulnerability Database of Information Security, China National Vulnerability Database of Information Security
  • CNVD China National Vulnerability Database, China National Information Security Vulnerability Sharing Platform
  • Step d scanning and checking the source code of the Java project to determine whether the source code of the Java project uses a class or function that has a vulnerability.
  • the class is matched with various types used in the source code of the Java project, and multiple matching degrees are determined. , if the maximum matching degree among the multiple matching degrees is greater than or equal to the first matching threshold, it is determined that the source code of the Java project uses a class with a vulnerability, which means that the Java project is actually affected by the vulnerability. Or, match the function with each function used in the source code of the Java project to determine multiple matching degrees, and if the maximum matching degree in the multiple matching degrees is greater than or equal to the second matching threshold, then determine the Java project. The fact that the source code uses the vulnerable function indicates that the Java project is actually affected by the vulnerability.
  • the process of determining whether the source code of the Java project uses a class or function with a vulnerability is automatically carried out, and the corresponding class name is passed in during the process of scanning the source code of the Java project Or the function name can be used as a keyword match.
  • Step3 Determine the vulnerability repair priority of open source components with vulnerabilities.
  • the Java project after introducing code fragment scanning and checking, it can be judged whether the Java project is actually affected by the vulnerability. In this way, after checking and confirming that the Java project uses a class or function with a vulnerability in the open source component through the code layer, it can be determined that the Java project is actually affected by the vulnerability. Moreover, after judging that the Java project is actually affected by the vulnerability, by adding multiple practical dimensions to the evaluation of the vulnerability, it is possible to promote the upgrade of open source components with vulnerabilities according to the actual impact of the Java project.
  • the vulnerability repair priority of each open source component can be determined in the following manner: determine the first vulnerability impact value according to whether the Java project is affected by the vulnerability; determine the second vulnerability impact value according to whether the Java project is an external project ;According to whether there is a vulnerability verification program or an exploit program for the vulnerability corresponding to the class or function called when using the open source component, and when it is determined that there is a vulnerability verification program or exploit program, determine whether the vulnerability corresponding to the class or function can be remotely exploited attack, determine the impact value of the third vulnerability; determine the impact value of the fourth vulnerability according to the degree of harm of the vulnerability corresponding to the class or function; determine the impact value of the fourth vulnerability according to the impact value of the first vulnerability, the Vulnerability impact value determines the priority of vulnerability repair of open source components.
  • the dimensions for evaluating the impact of vulnerabilities can be divided into:
  • the local server can be directly attacked locally by using the vulnerability, or the local server can be logged in locally by using the account password of the local server where the Java project is located, and the local server can be directly attacked locally by using the vulnerability.
  • the impact of the vulnerability can be classified and evaluated, accounting for 15%.
  • the impact caused by the vulnerability can be divided into:
  • record 1 point that is, the computer or network cannot provide normal services, such as DOS attack vulnerabilities and DDOS attack vulnerabilities.
  • Step4 Promote the upgrade of open source components with vulnerabilities.
  • the first implementation method If the open source component is a directly imported component, and after the code fragment scanning check confirms that the Java project is actually affected by the vulnerability, you can start to promote the R&D side to upgrade the vulnerable open source component.
  • the open source component may be upgraded and repaired according to the vulnerability repair priority of the open source component. If the priority of bug fixes of open source components is high, the deadline for upgrade and fix of open source components should be increased; if the priority of bug fixes of open source components is relatively low, security upgrade fixes can be combined with version scheduling. For example, if the vulnerability repair priority of an open source component is 8 points, the open source component needs to be urgently upgraded and repaired; if the vulnerability repair priority of the open source component is 6 points, the open source component needs to be ranked. Periodic repair; if the vulnerability repair priority of an open source component is 5 points, you can pay attention to the open source component first and wait for more details to be disclosed.
  • the second implementation manner if the open source component is an indirectly imported component, determine whether the organization identifier groupId of the parent component of the open source component is an internal identifier. Specifically, if the organization identification of the parent component of the open source component is an internal identification, the relevant internal team or person in charge can be notified to upgrade and repair, that is, the vulnerability information of the open source component and the parent component are sent to the relevant internal team or The relevant person in charge, for example, can submit an issue to the corresponding code warehouse or automatically notify the upgrade of the internal process tool. Just update the SDK version after the SDK is repaired.
  • the organization ID of the parent component of the open source component is an external ID
  • the vulnerability information of the open source component and the parent component will be sent to the relevant external person in charge or the relevant external team. For example, you can go to the open source community to ask questions or submit a code review request PR (Pull Request, a request to merge the code issued after making a contribution to modify the code in an open source project) to promote the upgrade.
  • PR Code Review request
  • the open source component is an indirectly imported component
  • the indirect imported component is directly upgraded in an internal project, it is easy to have compatibility problems, so it is necessary to promote the upgrade of the indirectly imported component by upgrading the parent component of the indirectly imported component.
  • the parent component of the indirectly imported component is a component directly imported by the Java project.
  • the above two implementation methods can make the actual promotion of open source component vulnerability upgrade and repair more targeted, and can help improve research and development efficiency and ensure system stability.
  • the technical solution in the present invention introduces scanning at the program code level, that is, when it is determined that the open source component information of a certain open source component is located in the component vulnerability version library, the program code of the Java project uses the class called when the open source component or function is compared with various types or functions in the component vulnerability information base, it can be timely and effectively determined whether the Java project is actually affected by the vulnerability.
  • each open source component is repaired based on the vulnerability repair priority of each open source component.
  • each open source component can be promptly and accurately promoted according to the actual impact of each open source It can make the repair and upgrade of each open source component more targeted, thereby improving the research and development efficiency of the Java project, and ensuring the stability of the system where the Java project is located, so as to improve the quality of financial services and solve the existing problems.
  • FIG. 4 exemplarily shows a device for detecting vulnerabilities of open source components provided by an embodiment of the present invention, and the device can execute the flow of the method for detecting vulnerabilities of open source components.
  • the device includes:
  • An acquisition unit 401 configured to acquire the open source component information of each open source component in the Java project
  • the processing unit 402 is configured to, for each open source component, determine whether the class or function called by the Java project when using the open source component exists when it is determined that the open source component information of the open source component is located in the component vulnerability version library In the component vulnerability information base; the component vulnerability information base stores the vulnerability information of the class or function corresponding to each open source component; if so, repair the open source component based on the vulnerability repair priority of the open source component.
  • the open source component information includes parent component information of the open source component; the parent component information is used to indicate that the open source component is a directly imported component or an indirectly imported component of the Java project;
  • the processing unit 402 is also used for:
  • the open source component is a directly imported component of the Java project.
  • the open source component information also includes the name and version number of the open source component
  • the processing unit 402 is specifically used for:
  • the open source component information also includes an organization identifier of the open source component
  • the processing unit 402 is also used for:
  • the organization identification corresponding to the parent component of the open source component is an internal identification, send the vulnerability information of the open source component and the parent component to the internal person in charge;
  • the organization identifier corresponding to the parent component of the open source component is an external identifier, send the vulnerability information of the open source component and the parent component to an external person in charge.
  • processing unit 402 is specifically configured to:
  • the processing unit 402 is specifically used for:
  • For the second type or the second function in the component vulnerability information base determine the matching degree between the first type and the second type, or the matching degree between the first function and the second function;
  • the matching degree Based on the relationship between the matching degree and the matching threshold, it is determined whether the first type or the first function called when using the open source component exists in the component vulnerability information base.
  • processing unit 402 is specifically configured to:
  • the vulnerability repair priority of the open source component is determined.
  • the levels corresponding to the vulnerability repair priority include the first level, the second level and the third level;
  • the processing unit 402 is specifically used for:
  • the level corresponding to the vulnerability priority of the open source component is the third level, keep observing the open source component.
  • an embodiment of the present invention also provides a computing device, as shown in FIG. 5 , including at least one processor 501 and a memory 502 connected to the at least one processor.
  • the specific connection medium between the processor 501 and the memory 502, the connection between the processor 501 and the memory 502 in FIG. 5 is taken as an example.
  • the bus can be divided into address bus, data bus, control bus and so on.
  • the memory 502 stores instructions that can be executed by at least one processor 501, and at least one processor 501 can execute the steps included in the aforementioned open source component vulnerability detection method by executing the instructions stored in the memory 502 .
  • the processor 501 is the control center of the computing device, which can use various interfaces and lines to connect various parts of the computing device, by running or executing instructions stored in the memory 502 and calling data stored in the memory 502, thereby realizing data deal with.
  • the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor.
  • the call processor mainly handles issuing instructions. It can be understood that the foregoing modem processor may not be integrated into the processor 501 .
  • the processor 501 and the memory 502 can be implemented on the same chip, and in some embodiments, they can also be implemented on independent chips.
  • the processor 501 can be a general processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array or other programmable logic devices, discrete gates or transistors Logic devices and discrete hardware components can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present invention.
  • a general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the methods disclosed in the embodiments of the vulnerability detection method combined with open source components can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
  • the memory 502 as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs and modules.
  • Memory 502 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Magnetic Memory, Disk , CD, etc.
  • Memory 502 is, but is not limited to, any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
  • the memory 502 in the embodiment of the present invention may also be a circuit or any other device capable of implementing a storage function, and is used for storing program instructions and/or data.
  • an embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program executable by a computing device, and when the program is run on the computing device, the computing device The steps of the vulnerability detection method of the above-mentioned open source components are executed.
  • the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

本发明实施例提供了一种开源组件的漏洞检测方法及装置,该方法包括获取Java项目中各开源组件的开源组件信息,针对每个开源组件,在确定开源组件的开源组件信息位于组件漏洞版本库中时,确定Java项目在使用开源组件时所调用的类或函数是否存在于组件漏洞信息库中,若是,则基于开源组件的漏洞修复优先度,对开源组件进行修复。如此,将Java项目使用开源组件时所调用的类或函数与组件漏洞信息库中各类或各函数进行比对,可以及时有效地确定Java项目是否实际受漏洞影响,并基于开源组件的漏洞修复优先度进行修复,可以使得开源组件的修复更具有针对性,从而可以提高Java项目的研发效率以及确保Java项目所在系统的稳定性。

Description

一种开源组件的漏洞检测方法及装置
相关申请的交叉引用
本申请要求在2021年05月24日提交中国专利局、申请号为202110562607.9、申请名称为“一种开源组件的漏洞检测方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明实施例涉及金融科技(Fintech)领域,尤其涉及一种开源组件的漏洞检测方法及装置。
背景技术
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技转变,但由于金融行业的安全性、实时性要求,也对技术提出的更高的要求。
开源组件是一类可应用于软件应用程序开发的第三方组件,它具有开放性、多元性和便捷性的特点。开发人员基于开源组件来开发软件应用程序可减少开发时间,提高开发效率,能够更快速地开发出软件应用程序。基于开源组件的特点,开始将开源组件应用于金融科技领域,以便为金融企业的开发人员提供更为便利的服务。
随着开源组件的不断应用,尤其在金融科技领域,为了确保金融服务质量,如何在金融应用程序开发中及时有效地检测所使用的开源组件是否存在漏洞成为急需解决的问题。现有方案在对Java项目中使用的开源组件进行漏洞检测时,首先通过扫描构建好的代码目录或直接分析Java项目中配置开源组件依赖的文件来获取项目中实际使用的开源组件名称和版本号。再将每个开源组件名称以及对应的版本号与从外界获取的组件漏洞信息进行比对,确定该Java项目是否使用了存在漏洞的开源组件,若是,则将存在漏洞的开源组件进行升级。但是,开源组件升级占用时间较长,或由于开源组件的升级导致了对Java项目的停用,影响了金融服务质量。
综上,目前亟需一种开源组件的漏洞检测方法,用以提高Java项目的研发效率,并可以确保Java项目所在系统的稳定性。
发明内容
本发明实施例提供了一种开源组件的漏洞检测方法及装置,用以提高Java项目的研发效率,并可以确保Java项目所在系统的稳定性。
第一方面,本发明实施例提供了一种开源组件的漏洞检测方法,包括:
获取Java项目中各开源组件的开源组件信息;
针对每个开源组件,在确定所述开源组件的开源组件信息位于组件漏洞版本库中时,确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中;所述组件漏洞信息库中存储有各开源组件对应的类或函数的漏洞信息;
若是,则基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复。
上述技术方案中,由于漏洞一般只发生于开源组件的某个功能中,倘若程序代码层面没有调用该开源组件对应的类或函数,则该Java项目实际不受影响。因此本发明中的技术方案通过引入程序代码层面的扫描,即,在确定某个开源组件的开源组件信息位于组件漏洞版本库中时,将Java项目的程序代码使用该开源组件时所调用的类或函数与组件漏洞信息库中的各类或各函数进行比对,可以及时有效地确定该Java项目是否实际受漏洞影响。此外,在确定该Java项目实际受漏洞影响后,基于各开源组件的漏洞修复优先度,对各开源组件进行修复,如此,可以及时准确地按照各开源组件的实际受影响程度来推动各开源组件的修复升级,并可以使得各开源组件的修复升级更具有针对性,从而可以提高Java项目的研发效率,并可以确保Java项目所在系统的稳定性,以便提升金融服务的质量,进而可以解决现有技术中存在无法准确地判断Java项目是否实际受漏洞影响的问题。
可选地,所述开源组件信息包括开源组件的父组件信息;所述父组件信息用于指示开源组件为所述Java项目的直接引入组件或间接引入组件;
在确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中之前,还包括:
确定所述开源组件为所述Java项目的直接引入组件。
上述技术方案中,由于Java项目所直接使用的某一个开源组件在运行时需要调用外部的开源组件来完成针对该Java项目所直接使用的开源组件的调用执行过程,即,该开源组件需要依赖外部的开源组件来共同完成该Java项目所直接使用的开源组件的调用,因此在确定Java项目在使用开源组件时所调用的类或函数是否存在于组件漏洞信息库中之前,需要判断开源组件是否为Java项目的直接引入组件,以便避免直接单独升级间接引入组件(外部的开源组件)容易出现与Java项目不兼容的问题。
可选地,所述开源组件信息还包括开源组件的名称以及版本号;
所述确定所述开源组件的开源组件信息位于组件漏洞版本库中,包括:
将所述开源组件的名称、版本号与所述组件漏洞版本库中每个开源组件的名称、版本号进行比对,若一致,则确定所述开源组件的名称、版本号位于所述组件漏洞版本库中。
上述技术方案中,在开源组件的漏洞信息披露后,针对每个开源组件,即可将该开源组件的名称、版本号与组件漏洞版本库中每个开源组件的名称、版本号进行比对,可以及时准确地确定该版本号的开源组件是否存在漏洞,从而可以及时地确定该版本号的开源组件是否可能受漏洞影响,以便为后续确定使用该版本号的开源组件的Java项目是否实际受漏洞影响提供支持。
可选地,所述开源组件信息还包括开源组件的组织标识;
所述方法还包括:
确定所述开源组件为所述Java项目的间接引入组件;
若所述开源组件的父组件对应的组织标识为内部标识,则将所述开源组件的漏洞信息以及所述父组件发送给内部负责人;
若所述开源组件的父组件对应的组织标识为外部标识,则将所述开源组件的漏洞信息以及所述父组件发送给外部负责人。
上述技术方案中,在确定开源组件为间接引入组件时,若直接单独升级间接引入组件(外部的开源组件)容易出现与Java项目不兼容的问题,而且并不清楚父组件是如何调用间接引入组件的,因此需要通过升级间接引入组件的父组件来推动间接引入组件的升级, 从而可以避免出现升级后的间接引入组件与Java项目不兼容的情况,进而可以解决现有技术中存在简单根据版本号推动更新开源组件,可能会产生新版本的开源组件与Java项目不兼容的问题。此外,针对父组件的升级也存在两种方式,即针对该父组件是属于内部开发的还是外部开发的,如此基于两种不同的升级方式可以使得父组件的升级具有针对性,并可以有助于提高研发效率和保证系统稳定性。
可选地,通过下述方式确定所述组件漏洞信息库:
从组件漏洞公开平台获取各开源组件对应的类或函数的漏洞信息;
将各开源组件对应的类或函数漏洞信息存储至所述组件漏洞信息库中;
所述确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中,包括:
从所述Java项目的源代码中提取出使用所述开源组件时所调用的第一类或第一函数;
针对所述组件漏洞信息库中的第二类或第二函数,确定所述第一类与所述第二类的匹配度,或所述第一函数与所述第二函数的匹配度;
基于所述匹配度与匹配阈值的大小关系,确定使用所述开源组件时所调用的第一类或第一函数是否存在于所述组件漏洞信息库中。
上述技术方案中,针对组件漏洞信息库中第二类或第二函数,将第一类与第二类进行比对,或者将第一函数与第二函数进行比对,并基于匹配度与匹配阈值的大小关系,即可及时准确地确定第一类或第一函数是否存在于组件漏洞信息库中,以便为及时地确定Java项目是否实际受漏洞影响提供支持。
可选地,通过下述方式确定所述开源组件的漏洞修复优先度:
根据所述Java项目是否受漏洞影响,确定出第一漏洞影响值;
根据所述Java项目是否属于对外项目,确定出第二漏洞影响值;
根据使用所述开源组件时所调用的类或函数对应的漏洞是否有漏洞验证程序或漏洞利用程序,以及在确定有漏洞验证程序或漏洞利用程序时,确定是否可远程利用所述类或所述函数对应的漏洞进行攻击,确定出第三漏洞影响值;
根据所述类或所述函数对应的漏洞的危害程度,确定出第四漏洞影响值;
根据所述第一漏洞影响值、所述第二漏洞影响值、所述第三漏洞影响值以及所述第四漏洞影响值,确定出所述开源组件的漏洞修复优先度。
上述技术方案中,在判断Java项目实际受漏洞影响后,通过对漏洞添加多个维度的评价,即通过第一漏洞影响值、第二漏洞影响值、第三漏洞影响值以及第四漏洞影响值来确定开源组件的漏洞修复优先度,有助于实现按照Java项目的实际受影响程度来推动存在漏洞的开源组件的升级工作。
可选地,所述漏洞修复优先度对应的等级包括第一等级、第二等级以及第三等级;
所述基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复,包括:
若确定所述开源组件的漏洞优先级度对应的等级为所述第一等级,则对所述开源组件进行优先修复;
若确定所述开源组件的漏洞优先级度对应的等级为所述第二等级,则对所述开源组件进行排期修复;
若确定所述开源组件的漏洞优先级度对应的等级为所述第三等级,则对所述开源组件保持观察。
上述技术方案中,通过基于各开源组件的漏洞修复优先度,确定出各开源组件对应的升级修复等级,并基于各开源组件对应的升级修复等级对各开源组件进行对应的升级修复,从而使得各开源组件的升级修复更具有针对性,并可以有助于提高研发效率和保证系统稳定性,进而可以解决现有技术中存在当Java项目中的开源组件版本号受影响时即推动更新,会产生大量不必要的开源组件在升级时的工作量,降低研发效率的问题。
第二方面,本发明实施例还提供了一种开源组件的漏洞检测装置,包括:
获取单元,用于获取Java项目中各开源组件的开源组件信息;
处理单元,用于针对每个开源组件,在确定所述开源组件的开源组件信息位于组件漏洞版本库中时,确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中;所述组件漏洞信息库中存储有各开源组件对应的类或函数的漏洞信息;若是,则基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复。
可选地,所述开源组件信息包括开源组件的父组件信息;所述父组件信息用于指示开源组件为所述Java项目的直接引入组件或间接引入组件;
所述处理单元还用于:
在确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中之前,确定所述开源组件为所述Java项目的直接引入组件。
可选地,所述开源组件信息还包括开源组件的名称以及版本号;
所述处理单元具体用于:
将所述开源组件的名称、版本号与所述组件漏洞版本库中每个开源组件的名称、版本号进行比对,若一致,则确定所述开源组件的名称、版本号位于所述组件漏洞版本库中。
可选地,所述开源组件信息还包括开源组件的组织标识;
所述处理单元还用于:
确定所述开源组件为所述Java项目的间接引入组件;
若所述开源组件的父组件对应的组织标识为内部标识,则将所述开源组件的漏洞信息以及所述父组件发送给内部负责人;
若所述开源组件的父组件对应的组织标识为外部标识,则将所述开源组件的漏洞信息以及所述父组件发送给外部负责人。
可选地,所述处理单元具体用于:
从组件漏洞公开平台获取各开源组件对应的类或函数的漏洞信息;
将各开源组件对应的类或函数漏洞信息存储至所述组件漏洞信息库中;
所述处理单元具体用于:
从所述Java项目的源代码中提取出使用所述开源组件时所调用的第一类或第一函数;
针对所述组件漏洞信息库中的第二类或第二函数,确定所述第一类与所述第二类的匹配度,或所述第一函数与所述第二函数的匹配度;
基于所述匹配度与匹配阈值的大小关系,确定使用所述开源组件时所调用的第一类或第一函数是否存在于所述组件漏洞信息库中。
可选地,所述处理单元具体用于:
根据所述Java项目是否受漏洞影响,确定出第一漏洞影响值;
根据所述Java项目是否属于对外项目,确定出第二漏洞影响值;
根据使用所述开源组件时所调用的类或函数对应的漏洞是否有漏洞验证程序或漏洞 利用程序,以及在确定有漏洞验证程序或漏洞利用程序时,确定是否可远程利用所述类或所述函数对应的漏洞进行攻击,确定出第三漏洞影响值;
根据所述类或所述函数对应的漏洞的危害程度,确定出第四漏洞影响值;
根据所述第一漏洞影响值、所述第二漏洞影响值、所述第三漏洞影响值以及所述第四漏洞影响值,确定出所述开源组件的漏洞修复优先度。
可选地,所述漏洞修复优先度对应的等级包括第一等级、第二等级以及第三等级;
所述处理单元具体用于:
若确定所述开源组件的漏洞优先级度对应的等级为所述第一等级,则对所述开源组件进行优先修复;
若确定所述开源组件的漏洞优先级度对应的等级为所述第二等级,则对所述开源组件进行排期修复;
若确定所述开源组件的漏洞优先级度对应的等级为所述第三等级,则对所述开源组件保持观察。
第三方面,本发明实施例提供一种计算设备,包括至少一个处理器以及至少一个存储器,其中,所述存储器存储有计算机程序,当所述程序被所述处理器执行时,使得所述处理器执行上述第一方面任意所述的开源组件的漏洞检测方法。
第四方面,本发明实施例提供一种计算机可读存储介质,其存储有可由计算设备执行的计算机程序,当所述程序在所述计算设备上运行时,使得所述计算设备执行上述第一方面任意所述的开源组件的漏洞检测方法。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种系统架构的示意图;
图2为本发明实施例提供的一种开源组件的漏洞检测方法的流程示意图;
图3为本发明实施例提供的另一种开源组件的漏洞检测方法的流程示意图;
图4为本发明实施例提供的一种开源组件的漏洞检测装置的结构示意图;
图5为本发明实施例提供的一种计算设备的结构示意图。
具体实施方式
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明的一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
下面首先对本发明实施例中涉及的部分用语进行解释说明,以便于本领域技术人员进行理解。
(1)Maven:一个开源软件项目管理及自动构建工具。是可通过一小段描述信息来管 理项目的构建,报告和文档的项目管理工具软件。
(2)Gradle:一个基于JVM的构建工具,是一款通用灵活的开源项目自动化构建工具,支持maven、Ivy仓库,支持传递性依赖管理,而不需要远程仓库或者是pom.xml和ivy.xml配置文件,基于Groovy,build脚本使用Groovy编写。
(3)Maven仓库:用来存放生成的构建和各种依赖,供构建过程中使用。
(4)DOS攻击(Denial of Service attack,拒绝服务):是指恶意的攻击网络协议实现的缺陷或直接通过野蛮手段残忍地耗尽被攻击对象的资源,目的是让目标计算机或网络无法提供正常的服务或资源访问,使目标系统服务系统停止响应甚至崩溃,而在此攻击中并不包括侵入目标服务器或目标网络设备。
(5)DDOS攻击(Distributed Denial of Service attack,分布式拒绝服务攻击):是指借助于客户/服务器技术,将多个计算机联合起来作为攻击平台,对一个或多个目标发动DDOS攻击,从而成倍地提高拒绝服务攻击的威力。通常,攻击者使用一个偷窃帐号将DDOS主控程序安装在一个计算机上,在一个设定的时间主控程序将与大量代理程序通讯,代理程序已经被安装在网络上的许多计算机上。代理程序收到指令时就发动攻击。利用客户/服务器技术,主控程序能在几秒钟内激活成百上千次代理程序的运行。比如,利用大量合理的服务请求来占用过多的服务资源,从而使合法用户无法得到服务的响应。
如上介绍了本发明实施例中涉及的部分用语,下面对本发明实施例涉及的技术特征进行介绍。
图1为本发明实施例提供的一种系统架构。如图1所示,该系统架构可以为服务器100,包括处理器110、通信接口120和存储器130。
其中,通信接口120用于与终端设备进行通信,收发该终端设备传输的信息,实现通信。
处理器110是服务器100的控制中心,利用各种接口和线路连接整个服务器100的各个部分,通过运行或执行存储在存储器130内的软件程序/或模块,以及调用存储在存储器130内的数据,执行服务器100的各种功能和处理数据。可选地,处理器110可以包括一个或多个处理单元。
存储器130可用于存储软件程序以及模块,处理器110通过运行存储在存储器130的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器130可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据业务处理所创建的数据等。此外,存储器130可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
需要说明的是,上述图1所示的结构仅是一种示例,本发明实施例对此不做限定。
基于上述描述,图2示例性的示出了本发明实施例提供的一种开源组件的漏洞检测方法的流程,该流程可以由开源组件的漏洞检测装置执行。
如图2所示,该流程具体包括:
步骤201,获取Java项目中各开源组件的开源组件信息。
步骤202,针对每个开源组件,在确定所述开源组件的开源组件信息位于组件漏洞版本库中时,确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中。
步骤203,若确定所述Java项目在使用所述开源组件时所调用的类或函数存在于组件漏洞信息库中,则基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复。
上述步骤201中,开源组件信息可以包括开源组件的名称、版本号、组织标识、项目标识以及父组件信息等。其中,开源组件可以包括FastJSON、jackson-databind、Xstream等;父组件信息用于指示开源组件为Java项目的直接引入组件或间接引入组件。示例性地,针对开源组件的父组件信息,比如Java项目存在有开源组件1和开源组件2,但该开源组件1需要调用外部的开源组件3,而该开源组件2不需要调用外部的开源组件,因此开源组件1为开源组件3的父组件,则开源组件1和开源组件2为Java项目的直接引入组件,开源组件3为Java项目的间接引入组件。
具体地,可以通过使用持续化集成工具(比如Jenkins、Buddy、TeamCity、CruiseControl等)对接GitLab等代码仓库来实现针对带有开源组件的项目目录的自动化构建,并通过扫描构建好的项目目录收集Java项目所使用的开源组件的名称和版本号。再通过项目构建工具生成每个项目的依赖树,并基于依赖树提取出每个开源组件的名称、groupId、artifactId、版本号、父组件信息。然后,将通过扫描项目目录所获取的各开源组件的名称和版本号以及基于依赖树所提取出的每个开源组件的名称、groupId、artifactId、版本号、父组件信息进行整合处理,即可得到整合后的各开源组件的开源组件信息,并将整合后的各开源组件的开源组件信息存储到数据库中,以便为后续确定Java项目是否受实际漏洞影响提供数据支持。
上述步骤202中,针对Java项目中每个开源组件,在确定开源组件的开源组件信息位于组件漏洞版本库中时,确定Java项目在使用开源组件时所调用的类或函数是否存在于组件漏洞信息库中。其中,组件漏洞信息库中存储有各开源组件对应的类或函数的漏洞信息,具体地,从组件漏洞公开平台获取各开源组件对应的类或函数的漏洞信息,将各开源组件对应的类或函数漏洞信息存储至组件漏洞信息库中。
具体地,在开源组件的漏洞信息披露后,针对Java项目中各开源组件中每个开源组件,将开源组件的名称、版本号与组件漏洞版本库中每个开源组件的名称、版本号进行比对,若一致,则确定开源组件的名称、版本号位于组件漏洞版本库中。如此,可以及时准确地确定该版本号的开源组件是否存在漏洞,从而可以及时地确定该版本号的开源组件是否可能受漏洞影响,以便为后续确定使用该版本号的开源组件的Java项目是否实际受漏洞影响提供支持。
由于Java项目所直接使用的某一个开源组件在运行时需要调用外部的开源组件来完成针对该Java项目所直接使用的开源组件的调用执行过程,即,该开源组件需要依赖外部的开源组件来共同完成该Java项目所直接使用的开源组件的调用,因此在确定开源组件位于组件漏洞版本库中后,需要判断开源组件是否为Java项目的直接引入组件,以便避免直接单独升级间接引入组件(外部的开源组件)容易出现与Java项目不兼容的问题。然后,在确定该开源组件为Java项目的间接引入组件后,从Java项目的源代码中提取出使用开源组件时所调用的第一类或第一函数。针对组件漏洞信息库中第二类或第二函数,确定第一类与第二类的匹配度,或第一函数与第二函数的匹配度,并基于匹配度与匹配阈值的大小关系,即可及时准确地确定使用开源组件时所调用的第一类或第一函数是否存在于组件漏洞信息库中,以便为及时地确定Java项目是否实际受漏洞影响提供支持。其中,匹配阈值可以根据本领域技术人员的经验或者可以根据实际应用场景进行设置,本发明实施例对此 并不作限定。
需要说明的是,在确定开源组件为Java项目的间接引入组件时,可以采用下述方式对该间接引入组件进行升级修复:若开源组件(间接引入组件)的父组件对应的组织标识为内部标识,则将开源组件的漏洞信息以及父组件发送给内部负责人,以使内部负责人对父组件进行升级修复。若开源组件的父组件对应的组织标识为外部标识,则将开源组件的漏洞信息以及父组件发送给外部负责人,以使外部负责人对父组件进行升级修复。如此,在确定开源组件为间接引入组件时,若直接单独升级间接引入组件(外部的开源组件)容易出现与Java项目不兼容的问题,而且并不清楚父组件是如何调用间接引入组件的,因此需要通过升级间接引入组件的父组件来推动间接引入组件的升级,从而可以避免出现升级后的间接引入组件与Java项目不兼容的情况,进而可以解决现有技术中存在简单根据版本号推动更新开源组件,可能会产生新版本的开源组件与Java项目不兼容的问题。此外,针对父组件的升级也存在两种方式,即针对该父组件是属于内部开发的还是外部开发的,如此基于两种不同的升级方式可以使得父组件的升级具有针对性,并可以有助于提高研发效率和保证系统稳定性。
上述步骤203中,在确定Java项目在使用开源组件时所调用的类或函数存在于组件漏洞信息库中时,基于开源组件的漏洞修复优先度,对开源组件进行修复。
具体地,可以通过下述方式确定每个开源组件的漏洞修复优先度:根据Java项目是否受漏洞影响,确定出第一漏洞影响值;根据Java项目是否属于对外项目,确定出第二漏洞影响值;根据使用开源组件时所调用的类或函数对应的漏洞是否有漏洞验证程序或漏洞利用程序,以及在确定有漏洞验证程序或漏洞利用程序时,确定是否可远程利用类或函数对应的漏洞进行攻击,确定出第三漏洞影响值;根据类或函数对应的漏洞的危害程度,确定出第四漏洞影响值;根据第一漏洞影响值、第二漏洞影响值、第三漏洞影响值以及第四漏洞影响值,确定出开源组件的漏洞修复优先度。如此,判断Java项目实际受漏洞影响后,通过对漏洞添加多个维度的评价,即通过第一漏洞影响值、第二漏洞影响值、第三漏洞影响值以及第四漏洞影响值来确定开源组件的漏洞修复优先度,有助于实现按照Java项目的实际受影响程度来推动存在漏洞的开源组件的升级工作。
在确定出各开源组件的漏洞修复优先度后,为各开源组件设置对应的升级修复等级。具体地,若确定开源组件的漏洞优先级度对应的等级为第一等级,则对开源组件进行优先修复;若确定开源组件的漏洞优先级度对应的等级为第二等级,则对开源组件进行排期修复;若确定开源组件的漏洞优先级度对应的等级为第三等级,则对开源组件保持观察。示例性地,比如某个开源组件的漏洞修复优先度为7.5分,则需要对该开源组件进行优先修复;如果开源组件的漏洞修复优先度为6.5分,则需要对该开源组件进行排期修复;如果开源组件的漏洞修复优先度为3.5分,则可先对该开源组件保持观察。如此,通过基于各开源组件的漏洞修复优先度,确定出各开源组件对应的升级修复等级,并基于各开源组件对应的升级修复等级对各开源组件进行对应的升级修复,从而使得各开源组件的升级修复更具有针对性,并可以有助于提高研发效率和保证系统稳定性,进而可以解决现有技术中存在当Java项目中的开源组件版本号受影响时即推动更新,会产生大量不必要的开源组件在升级时的工作量,降低研发效率的问题。
基于此,下面结合图3,对本发明实施例中开源组件的漏洞检测方法的实施过程进行具体描述。其中,图3为本发明实施例提供的另一种开源组件的漏洞检测方法的流程示意 图。
Step1:收集Java项目中各开源组件的开源组件信息。
具体地,首先通过基于代码仓库构建出带有开源组件的项目目录。即,将Java项目的源代码所依赖的开源组件信息放入到项目目录里,即可构建出带有开源组件的项目目录。其中,该项目目录里本身就存储有源代码。需要说明的是,为了节省存储空间,项目目录预先不存储开源组件信息。再通过扫描构建好的项目目录收集Java项目所使用的各开源组件的名称和版本号。
然后,通过项目构建工具生成Java项目的依赖树,并基于该依赖树提取出每个开源组件的名称、组织标识(groupId)、项目标识(artifactId)、版本号、父组件信息。针对Java项目的任一开源组件,如果该开源组件有父组件,则说明该开源组件是Java项目的间接引入组件;如果该开源组件没有父组件,则说明该开源组件是Java项目的直接引入组件。需要说明的是,针对确定某个开源组件有父组件,则可以通过基于该开源组件进一步遍历依赖树,以便追溯出Java项目所直接引入的开源组件。示例性地,针对开源组件的父组件信息,比如Java项目存在有开源组件A和开源组件B,但该开源组件A需要调用外部的开源组件C,而开源组件B不需要调用外部的开源组件,因此开源组件A为开源组件C的父组件,则开源组件A和开源组件B为Java项目的直接引入组件,开源组件C为Java项目的间接引入组件。
最后,将通过扫描构建好的项目目录所获取的各开源组件的名称和版本号以及通过项目构建工具生成Java项目的依赖树所提取出的每个开源组件的名称、组织标识、项目标识、版本号、父组件信息进行整合处理,即可得到整合后的开源组件信息,并将该整合后的开源组件信息存储到数据库中。其中,针对该数据库,开发人员、运维人员或其它数据库管理人员等可在日常工作中进行维护。如此,若有新的开源组件漏洞信息出现,则可直接在该数据库中进行查询,以便确定Java项目所使用的各开源组件中是否有存在漏洞的开源组件,从而可以有效地提高开源组件漏洞响应和排查的效率。
示例性地,本发明实施例可以使用持续化集成工具对接GitLab等代码仓库即可实现针对带有开源组件的项目目录的自动化构建,并通过扫描构建好的项目目录收集Java项目所使用的开源组件的名称和版本号。再通过Maven、Gradle等工具生成每个项目的依赖树,并基于依赖树提取出每个开源组件的名称、groupId、artifactId、版本号、父组件信息。然后,将通过扫描项目目录所获取的各开源组件的名称和版本号以及基于依赖树所提取出的每个开源组件的名称、groupId、artifactId、版本号、父组件信息进行整合处理,即可得到整合后的各开源组件的开源组件信息,并将整合后的各开源组件的开源组件信息存储到数据库中。
需要说明的是,由于源代码检查一般针对的是Java项目直接引入的开源组件,所以可以不通过构建带有开源组件的项目目录以及不通过项目构建工具生成Java项目的依赖树,直接通过扫描和解析代码目录(即不存储有开源组件的项目目录)中的pom.xml、build.gradle等配置文件,来获取Java项目所使用的各开源组件的开源组件信息,即,收集各开源组件的名称、groupId、artifactId、版本号等信息,并将收集的各开源组件的开源组件信息存储到数据库中。
Step2:扫描Java项目的源代码,检查该Java项目是否实际使用了存在漏洞的类或函数。
具体地,在获取到披露的开源组件漏洞信息后,将Step1中数据库存储的各开源组件的名称以及版本号与该披露的开源组件漏洞信息中各开源组件的名称以及版本号进行比对。即,针对数据库存储的各开源组件中每个开源组件,将该开源组件的名称以及版本号与开源组件漏洞信息中各开源组件的名称以及版本号进行匹配,确定出多个匹配度,若该多个匹配度中的最大匹配度大于等于第一匹配阈值,则确定该版本号的开源组件受漏洞影响,否则确定该版本号的开源组件不受漏洞影响。在确定该版本号的开源组件受漏洞影响后,从国内外漏洞披露平台获取公布的漏洞数据,即获取各开源组件的版本号对应的类或函数的漏洞信息,并将该获取的各开源组件的版本号对应的类或函数的漏洞信息存储到组件漏洞信息库中。然后,扫描Java项目的源代码,可获取到Java项目使用该版本号的开源组件时所调用的类或函数,并将Java项目使用该版本号的开源组件时所调用的类与组件漏洞信息库中各开源组件的版本号对应的类进行匹配,确定出多个匹配度,若该多个匹配度中的最大匹配度大于等于第二匹配阈值,则说明该版本号的开源组件调用了存在漏洞的类,即可说明Java项目实际使用了存在漏洞的类,从而可以说明Java项目实际受漏洞影响。或者,将Java项目使用该版本号的开源组件时所调用的函数与组件漏洞信息库中各开源组件的版本号对应的函数进行匹配,确定出多个匹配度,若该多个匹配度中的最大匹配度大于等于第二匹配阈值,则说明该版本号的开源组件调用了存在漏洞的函数,即可说明Java项目实际使用了存在漏洞的函数,从而可以说明Java项目实际受漏洞影响。其中,第一匹配阈值和第二匹配阈值可以根据本领域技术人员的经验或者可以根据实际应用场景进行设置,本发明实施例对此并不作限定。
下面对检查该Java项目是否实际使用了存在漏洞的类或函数的具体实施过程进行描述。
步骤a、在针对开源组件的漏洞信息披露后,获取该披露的开源组件漏洞信息,并将该披露的开源组件漏洞信息存储到组件漏洞版本库中。然后,针对Step1中数据库存储的任一开源组件,将该开源组件的名称以及版本号与组件漏洞版本库中各开源组件的名称以及版本号进行比对,即可确定该版本号的开源组件是否受漏洞影响。若确定该版本号的开源组件受漏洞影响,则可执行步骤b。
步骤b、在确定某一版本号的开源组件受漏洞影响后,基于该版本号的开源组件的父组件信息,确定该版本号的开源组件是否为直接引入组件。若该版本号的开源组件为直接引入组件,则可执行步骤c;若该版本号的开源组件不为直接引入组件,即,该版本号的开源组件为间接引入组件,则可执行步骤Step4。
步骤c、在确定该版本号的开源组件为直接引入组件后,收集各开源组件的版本号对应的类或函数的漏洞信息,并将各开源组件的版本号对应的类或函数的漏洞信息存储至组件漏洞信息库中。即,可从国内外漏洞披露平台获取公布的漏洞数据,即获取漏洞开源组件名称、漏洞开源组件版本号、漏洞类或函数信息、漏洞详细内容等漏洞数据。比如从CVE(Common Vulnerabilities and Exposures,公共漏洞和暴露)、CNNVD(China National Vulnerability Database of Information Security,中国国家信息安全漏洞库)、CNVD(China National Vulnerability Database,中国国家信息安全漏洞共享平台)等漏洞披露平台获取公布的漏洞数据。
步骤d、扫描并检查Java项目的源代码,确定Java项目的源代码是否使用了存在漏洞的类或函数。
具体地,在扫描Java项目的源代码的过程中,针对组件漏洞信息库中每个类或函数,将该类与Java项目的源代码中所使用的各类进行匹配,确定出多个匹配度,若该多个匹配度中的最大匹配度大于等于第一匹配阈值,则确定Java项目的源代码使用了存在漏洞的类,即可说明Java项目实际受漏洞影响。或者,将该函数与Java项目的源代码中所使用的各函数进行匹配,确定出多个匹配度,若该多个匹配度中的最大匹配度大于等于第二匹配阈值,则确定Java项目的源代码使用了存在漏洞的函数,即可说明Java项目实际受漏洞影响。
需要说明的是,在具体实施过程中,确定Java项目的源代码是否使用了存在漏洞的类或函数的处理过程是自动化进行的,在扫描Java项目的源代码的过程中传入对应的类名或函数名作为关键字匹配即可实现。
Step3:确定存在漏洞的开源组件的漏洞修复优先度。
本发明实施例在引入代码片段扫描检查后,即可判断Java项目是否实际受漏洞影响。如此,通过代码层检查并确认Java项目使用了开源组件中存在漏洞的类或函数后,即可判断Java项目实际受漏洞影响。而且,在判断Java项目实际受漏洞影响后,可通过对漏洞添加多个实用维度的评价,即可实现按照Java项目的实际受影响程度来推动存在漏洞的开源组件的升级工作。
具体地,可以通过下述方式确定每个开源组件的漏洞修复优先度:根据Java项目是否受漏洞影响,确定出第一漏洞影响值;根据Java项目是否属于对外项目,确定出第二漏洞影响值;根据使用开源组件时所调用的类或函数对应的漏洞是否有漏洞验证程序或漏洞利用程序,以及在确定有漏洞验证程序或漏洞利用程序时,确定是否可远程利用类或函数对应的漏洞进行攻击,确定出第三漏洞影响值;根据类或函数对应的漏洞的危害程度,确定出第四漏洞影响值;根据第一漏洞影响值、第二漏洞影响值、第三漏洞影响值以及第四漏洞影响值,确定出开源组件的漏洞修复优先度。
示例性地,假设漏洞总评分为10分,则评价漏洞的影响程度的维度可以分为:
(1)、判断Java项目是否实际受漏洞影响,占比55%。如果Java项目实际受漏洞影响,则记录5.5分,否则记录0分。
(2)、判断Java项目是否属于对外项目,占比15%。如果Java项目属于对外项目,则记录1.5分,否则记录0分。
(3)、判断Java项目使用的开源组件所存在的漏洞是否有公开的POC(Proof of Concept,漏洞验证程序)或EXP(Exploit,漏洞利用程序),占比15%。具体地,判断Java项目使用的某一版本号的开源组件所存在的漏洞是否有公开的POC或EXP,可以到开源的代码托管平台(比如github.com)或专业的公开EXP收录网站(比如www.exploit-db.com)进行搜索。如果开源组件所存在的漏洞有公开的POC或EXP,且确定攻击者可远程利用漏洞攻击Java项目所在服务器,则记录1.5分。如果开源组件所存在的漏洞有公开的POC或EXP,且确定攻击者不能远程利用漏洞攻击Java项目所在服务器,则记录1分,比如,可以通过利用Java项目所在本地服务器的账号密码进行远程登录该本地服务器,并利用漏洞直接在本地进行攻击该本地服务器,或者,可以通过利用Java项目所在本地服务器的账号密码进行本地登录该本地服务器,并利用漏洞直接在本地进行攻击该本地服务器。
(4)、根据漏洞自身的危害程度,即可对漏洞所造成的影响进行分类和评估,占比15%。其中,漏洞所造成的影响可分为:
a)、如果漏洞造成部署该Java项目的服务器中的命令执行、权限提升(比如修改管理使用权限,将低权限修改为高权限等)或者用户敏感数据泄露,则记录1.5分。
b)、如果漏洞造成服务不可用,则记录1分,即,使得计算机或网络无法提供正常的服务,比如DOS攻击漏洞和DDOS攻击漏洞。
c)、其它对系统可用性无严重影响的漏洞,则记录0.5分。
综合上述各维度,将存在漏洞的开源组件在各维度的分数进行相加,并将相加后的结果记为x,如此即可确定出存在漏洞的开源组件的修复优先度:
A、若x≥7,则需要优先对该存在漏洞的开源组件进行紧急升级修复。
B、若5.5<x<7,则需要对该存在漏洞的开源组件进行排期修复。
C、若0≤x≤5.5,则可先对该存在漏洞的开源组件保持关注并等待更多细节披露。
Step4:推动存在漏洞的开源组件进行升级。
下面通过两种实现方式对推动存在漏洞的开源组件进行升级的实施过程进行具体描述。
第一种实现方式:若开源组件为直接引入组件,且通过代码片段扫描检查确认Java项目实际受漏洞影响后,即可开始着手推动研发侧对存在漏洞的开源组件进行升级。具体地,可以根据开源组件的漏洞修复优先度,对开源组件进行升级修复。如果开源组件的漏洞修复优先度较高,则开源组件升级修复的期限等要求应提高;如果开源组件的漏洞修复优先度相对较低,则可结合版本排期安全升级修复。示例性地,比如某个开源组件的漏洞修复优先度为8分,则需要优先对该开源组件进行紧急升级修复;如果开源组件的漏洞修复优先度为6分,则需要对该开源组件进行排期修复;如果开源组件的漏洞修复优先度为5分,则可先对该开源组件保持关注并等待更多细节披露。
第二种实现方式:若开源组件为间接引入组件,则确定该开源组件的父组件的组织标识groupId是否为内部标识。具体地,如果该开源组件的父组件的组织标识为内部标识,则可通知内部的相关团队或相关负责人进行升级修复,即,将开源组件的漏洞信息以及父组件发送给内部的相关团队或相关负责人,比如可通过给对应的代码仓库提交问题或者内部流程工具自动化通知升级。在等SDK修复后更新SDK的版本即可。如果该开源组件的父组件的组织标识为外部标识,一般情况下需等待引入的父组件升级,或者可以向父组件所对应的外部的相关负责人或外部的相关团队发送升级修复通知消息,同时会将开源组件的漏洞信息以及父组件发送给外部的相关负责人或外部的相关团队。比如可以到开源社区提出问题或者提交代码审查的请求PR(Pull Request,开源项目中作出贡献修改代码后,发出的合并代码的请求)来推动升级。需要说明的是,针对开源组件为间接引入组件的情况,若是在内部项目中直接单独升级间接引入组件容易出现兼容性问题,所以需要通过升级间接引入组件的父组件来推动间接引入组件的升级,以避免出现升级后的间接引入组件与Java项目不兼容的情况。其中,该间接引入组件的父组件是Java项目直接引入的组件。
基于此,通过上述两种实现方式可以使得实际推动开源组件漏洞升级修复时更具有针对性,并可以有助于提高研发效率和保证系统稳定性。
上述实施例表明,由于漏洞一般只发生于开源组件的某个功能中,倘若程序代码层面没有调用该开源组件对应的类或函数,则该Java项目实际不受影响。因此本发明中的技术方案通过引入程序代码层面的扫描,即,在确定某个开源组件的开源组件信息位于组件漏洞版本库中时,将Java项目的程序代码使用该开源组件时所调用的类或函数与组件漏洞信 息库中的各类或各函数进行比对,可以及时有效地确定该Java项目是否实际受漏洞影响。此外,在确定该Java项目实际受漏洞影响后,基于各开源组件的漏洞修复优先度,对各开源组件进行修复,如此,可以及时准确地按照各开源组件的实际受影响程度来推动各开源组件的修复升级,并可以使得各开源组件的修复升级更具有针对性,从而可以提高Java项目的研发效率,并可以确保Java项目所在系统的稳定性,以便提升金融服务的质量,进而可以解决现有技术中存在无法准确地判断Java项目是否实际受漏洞影响的问题。
基于相同的技术构思,图4示例性的示出了本发明实施例提供的一种开源组件的漏洞检测装置,该装置可以执行开源组件的漏洞检测方法的流程。
如图4所示,该装置包括:
获取单元401,用于获取Java项目中各开源组件的开源组件信息;
处理单元402,用于针对每个开源组件,在确定所述开源组件的开源组件信息位于组件漏洞版本库中时,确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中;所述组件漏洞信息库中存储有各开源组件对应的类或函数的漏洞信息;若是,则基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复。
可选地,所述开源组件信息包括开源组件的父组件信息;所述父组件信息用于指示开源组件为所述Java项目的直接引入组件或间接引入组件;
所述处理单元402还用于:
在确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中之前,确定所述开源组件为所述Java项目的直接引入组件。
可选地,所述开源组件信息还包括开源组件的名称以及版本号;
所述处理单元402具体用于:
将所述开源组件的名称、版本号与所述组件漏洞版本库中每个开源组件的名称、版本号进行比对,若一致,则确定所述开源组件的名称、版本号位于所述组件漏洞版本库中。
可选地,所述开源组件信息还包括开源组件的组织标识;
所述处理单元402还用于:
确定所述开源组件为所述Java项目的间接引入组件;
若所述开源组件的父组件对应的组织标识为内部标识,则将所述开源组件的漏洞信息以及所述父组件发送给内部负责人;
若所述开源组件的父组件对应的组织标识为外部标识,则将所述开源组件的漏洞信息以及所述父组件发送给外部负责人。
可选地,所述处理单元402具体用于:
从组件漏洞公开平台获取各开源组件对应的类或函数的漏洞信息;
将各开源组件对应的类或函数漏洞信息存储至所述组件漏洞信息库中;
所述处理单元402具体用于:
从所述Java项目的源代码中提取出使用所述开源组件时所调用的第一类或第一函数;
针对所述组件漏洞信息库中的第二类或第二函数,确定所述第一类与所述第二类的匹配度,或所述第一函数与所述第二函数的匹配度;
基于所述匹配度与匹配阈值的大小关系,确定使用所述开源组件时所调用的第一类或第一函数是否存在于所述组件漏洞信息库中。
可选地,所述处理单元402具体用于:
根据所述Java项目是否受漏洞影响,确定出第一漏洞影响值;
根据所述Java项目是否属于对外项目,确定出第二漏洞影响值;
根据使用所述开源组件时所调用的类或函数对应的漏洞是否有漏洞验证程序或漏洞利用程序,以及在确定有漏洞验证程序或漏洞利用程序时,确定是否可远程利用所述类或所述函数对应的漏洞进行攻击,确定出第三漏洞影响值;
根据所述类或所述函数对应的漏洞的危害程度,确定出第四漏洞影响值;
根据所述第一漏洞影响值、所述第二漏洞影响值、所述第三漏洞影响值以及所述第四漏洞影响值,确定出所述开源组件的漏洞修复优先度。
可选地,所述漏洞修复优先度对应的等级包括第一等级、第二等级以及第三等级;
所述处理单元402具体用于:
若确定所述开源组件的漏洞优先级度对应的等级为所述第一等级,则对所述开源组件进行优先修复;
若确定所述开源组件的漏洞优先级度对应的等级为所述第二等级,则对所述开源组件进行排期修复;
若确定所述开源组件的漏洞优先级度对应的等级为所述第三等级,则对所述开源组件保持观察。
基于相同的技术构思,本发明实施例还提供了一种计算设备,如图5所示,包括至少一个处理器501,以及与至少一个处理器连接的存储器502,本发明实施例中不限定处理器501与存储器502之间的具体连接介质,图5中处理器501和存储器502之间通过总线连接为例。总线可以分为地址总线、数据总线、控制总线等。
在本发明实施例中,存储器502存储有可被至少一个处理器501执行的指令,至少一个处理器501通过执行存储器502存储的指令,可以执行前述的开源组件的漏洞检测方法中所包括的步骤。
其中,处理器501是计算设备的控制中心,可以利用各种接口和线路连接计算设备的各个部分,通过运行或执行存储在存储器502内的指令以及调用存储在存储器502内的数据,从而实现数据处理。可选的,处理器501可包括一个或多个处理单元,处理器501可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理下发指令。可以理解的是,上述调制解调处理器也可以不集成到处理器501中。在一些实施例中,处理器501和存储器502可以在同一芯片上实现,在一些实施例中,它们也可以在独立的芯片上分别实现。
处理器501可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本发明实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合开源组件的漏洞检测方法实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
存储器502作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器502可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储 器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器502是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本发明实施例中的存储器502还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。
基于相同的技术构思,本发明实施例还提供了一种计算机可读存储介质,其存储有可由计算设备执行的计算机程序,当所述程序在所述计算设备上运行时,使得所述计算设备执行上述开源组件的漏洞检测方法的步骤。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (10)

  1. 一种开源组件的漏洞检测方法,其特征在于,包括:
    获取Java项目中各开源组件的开源组件信息;
    针对每个开源组件,在确定所述开源组件的开源组件信息位于组件漏洞版本库中时,确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中;所述组件漏洞信息库中存储有各开源组件对应的类或函数的漏洞信息;
    若是,则基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复。
  2. 如权利要求1所述的方法,其特征在于,所述开源组件信息包括开源组件的父组件信息;所述父组件信息用于指示开源组件为所述Java项目的直接引入组件或间接引入组件;
    在确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中之前,还包括:
    确定所述开源组件为所述Java项目的直接引入组件。
  3. 如权利要求1所述的方法,其特征在于,所述开源组件信息还包括开源组件的名称以及版本号;
    所述确定所述开源组件的开源组件信息位于组件漏洞版本库中,包括:
    将所述开源组件的名称、版本号与所述组件漏洞版本库中每个开源组件的名称、版本号进行比对,若一致,则确定所述开源组件的名称、版本号位于所述组件漏洞版本库中。
  4. 如权利要求1所述的方法,其特征在于,所述开源组件信息还包括开源组件的组织标识;
    所述方法还包括:
    确定所述开源组件为所述Java项目的间接引入组件;
    若所述开源组件的父组件对应的组织标识为内部标识,则将所述开源组件的漏洞信息以及所述父组件发送给内部负责人;
    若所述开源组件的父组件对应的组织标识为外部标识,则将所述开源组件的漏洞信息以及所述父组件发送给外部负责人。
  5. 如权利要求1所述的方法,其特征在于,通过下述方式确定所述组件漏洞信息库:
    从组件漏洞公开平台获取各开源组件对应的类或函数的漏洞信息;
    将各开源组件对应的类或函数漏洞信息存储至所述组件漏洞信息库中;
    所述确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中,包括:
    从所述Java项目的源代码中提取出使用所述开源组件时所调用的第一类或第一函数;
    针对所述组件漏洞信息库中的第二类或第二函数,确定所述第一类与所述第二类的匹配度,或所述第一函数与所述第二函数的匹配度;
    基于所述匹配度与匹配阈值的大小关系,确定使用所述开源组件时所调用的第一类或第一函数是否存在于所述组件漏洞信息库中。
  6. 如权利要求1至5任一项所述的方法,其特征在于,通过下述方式确定所述开源组件的漏洞修复优先度:
    根据所述Java项目是否受漏洞影响,确定出第一漏洞影响值;
    根据所述Java项目是否属于对外项目,确定出第二漏洞影响值;
    根据使用所述开源组件时所调用的类或函数对应的漏洞是否有漏洞验证程序或漏洞利用程序,以及在确定有漏洞验证程序或漏洞利用程序时,确定是否可远程利用所述类或所述函数对应的漏洞进行攻击,确定出第三漏洞影响值;
    根据所述类或所述函数对应的漏洞的危害程度,确定出第四漏洞影响值;
    根据所述第一漏洞影响值、所述第二漏洞影响值、所述第三漏洞影响值以及所述第四漏洞影响值,确定出所述开源组件的漏洞修复优先度。
  7. 如权利要求6所述的方法,其特征在于,所述漏洞修复优先度对应的等级包括第一等级、第二等级以及第三等级;
    所述基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复,包括:
    若确定所述开源组件的漏洞优先级度对应的等级为所述第一等级,则对所述开源组件进行优先修复;
    若确定所述开源组件的漏洞优先级度对应的等级为所述第二等级,则对所述开源组件进行排期修复;
    若确定所述开源组件的漏洞优先级度对应的等级为所述第三等级,则对所述开源组件保持观察。
  8. 一种开源组件的漏洞检测装置,其特征在于,包括:
    获取单元,用于获取Java项目中各开源组件的开源组件信息;
    处理单元,用于针对每个开源组件,在确定所述开源组件的开源组件信息位于组件漏洞版本库中时,确定所述Java项目在使用所述开源组件时所调用的类或函数是否存在于组件漏洞信息库中;所述组件漏洞信息库中存储有各开源组件对应的类或函数的漏洞信息;若是,则基于所述开源组件的漏洞修复优先度,对所述开源组件进行修复。
  9. 一种计算设备,其特征在于,包括至少一个处理器以及至少一个存储器,其中,所述存储器存储有计算机程序,当所述程序被所述处理器执行时,使得所述处理器执行权利要求1至7任一权利要求所述的方法。
  10. 一种计算机可读存储介质,其特征在于,其存储有可由计算设备执行的计算机程序,当所述程序在所述计算设备上运行时,使得所述计算设备执行权利要求1至7任一权利要求所述的方法。
PCT/CN2021/134643 2021-05-24 2021-11-30 一种开源组件的漏洞检测方法及装置 WO2022247199A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110562607.9A CN113177001A (zh) 2021-05-24 2021-05-24 一种开源组件的漏洞检测方法及装置
CN202110562607.9 2021-05-24

Publications (1)

Publication Number Publication Date
WO2022247199A1 true WO2022247199A1 (zh) 2022-12-01

Family

ID=76929951

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/134643 WO2022247199A1 (zh) 2021-05-24 2021-11-30 一种开源组件的漏洞检测方法及装置

Country Status (2)

Country Link
CN (1) CN113177001A (zh)
WO (1) WO2022247199A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177001A (zh) * 2021-05-24 2021-07-27 深圳前海微众银行股份有限公司 一种开源组件的漏洞检测方法及装置
CN113761539B (zh) * 2021-08-06 2023-10-17 中国科学院软件研究所 一种鸿蒙安全漏洞防御方法和系统
CN114020634B (zh) * 2021-11-11 2024-05-24 中国电子科技集团公司第十五研究所 一种软件产品自主可控度的测评方法及系统
CN115906104A (zh) * 2023-02-23 2023-04-04 国网山东省电力公司泰安供电公司 一种二次封装后开源组件的安全检测方法及装置
CN116974619B (zh) * 2023-09-22 2024-01-12 国网电商科技有限公司 一种软件物料清单库的构建方法、装置、设备及可读介质
CN117406967B (zh) * 2023-12-15 2024-03-22 卓望数码技术(深圳)有限公司 组件识别方法、装置、电子设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106446691A (zh) * 2016-11-24 2017-02-22 工业和信息化部电信研究院 检测软件中集成或定制的开源项目漏洞的方法和装置
CN108763928A (zh) * 2018-05-03 2018-11-06 北京邮电大学 一种开源软件漏洞分析方法、装置和存储介质
US20190347422A1 (en) * 2018-05-08 2019-11-14 WhiteSource Ltd. System and method for identifying vulnerabilities in code due to open source usage
CN110543767A (zh) * 2019-08-10 2019-12-06 苏州浪潮智能科技有限公司 一种针对开源组件漏洞自动化监控方法及系统
CN111625839A (zh) * 2020-05-29 2020-09-04 深圳前海微众银行股份有限公司 第三方组件漏洞检测方法、装置、设备及计算机存储介质
CN112560048A (zh) * 2020-12-22 2021-03-26 南方电网深圳数字电网研究院有限公司 一种代码安全扫描方法、代码安全扫描系统及存储介质
CN113177001A (zh) * 2021-05-24 2021-07-27 深圳前海微众银行股份有限公司 一种开源组件的漏洞检测方法及装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106446691A (zh) * 2016-11-24 2017-02-22 工业和信息化部电信研究院 检测软件中集成或定制的开源项目漏洞的方法和装置
CN108763928A (zh) * 2018-05-03 2018-11-06 北京邮电大学 一种开源软件漏洞分析方法、装置和存储介质
US20190347422A1 (en) * 2018-05-08 2019-11-14 WhiteSource Ltd. System and method for identifying vulnerabilities in code due to open source usage
CN110543767A (zh) * 2019-08-10 2019-12-06 苏州浪潮智能科技有限公司 一种针对开源组件漏洞自动化监控方法及系统
CN111625839A (zh) * 2020-05-29 2020-09-04 深圳前海微众银行股份有限公司 第三方组件漏洞检测方法、装置、设备及计算机存储介质
CN112560048A (zh) * 2020-12-22 2021-03-26 南方电网深圳数字电网研究院有限公司 一种代码安全扫描方法、代码安全扫描系统及存储介质
CN113177001A (zh) * 2021-05-24 2021-07-27 深圳前海微众银行股份有限公司 一种开源组件的漏洞检测方法及装置

Also Published As

Publication number Publication date
CN113177001A (zh) 2021-07-27

Similar Documents

Publication Publication Date Title
WO2022247199A1 (zh) 一种开源组件的漏洞检测方法及装置
EP3693874B1 (en) Continuous vulnerability management for modern applications
US11086983B2 (en) System and method for authenticating safe software
He et al. Understanding and detecting evolution-induced compatibility issues in Android apps
US10235520B2 (en) System and method for analyzing patch file
JP4807970B2 (ja) 自動開始拡張ポイントを介したスパイウェアおよび不要ソフトウェアの管理
US20190394221A1 (en) Detecting repackaged applications based on file format fingerprints
US20210334384A1 (en) Detecting a potential security leak by a microservice
US11176247B2 (en) System and method for container assessment using sandboxing
CN103329093A (zh) 更新软件
CN111835756B (zh) App隐私合规检测方法、装置、计算机设备及存储介质
CN103390130A (zh) 基于云安全的恶意程序查杀的方法、装置和服务器
US8904359B2 (en) On-demand monitoring of memory usage
CN110674506A (zh) 快速验证应用程序漏洞状态的方法及系统
Liu et al. Automatically detecting API-induced compatibility issues in Android apps: a comparative analysis (replicability study)
Kong et al. Mining android crash fixes in the absence of issue-and change-tracking systems
CN116361807A (zh) 风险管控方法、装置、存储介质及电子设备
CN115361203A (zh) 一种基于分布式扫描引擎的脆弱性分析方法
Sun et al. Blockchain-based automated container cloud security enhancement system
JP4363214B2 (ja) アクセスポリシ生成システム、アクセスポリシ生成方法およびアクセスポリシ生成用プログラム
Bhatt et al. Categorization of vulnerabilities in a software
CN112257058A (zh) 一种操作系统可信计算校验方法及系统
US11620129B1 (en) Agent-based detection of fuzzing activity associated with a target program
CN113486335B (zh) 一种基于rasp零规则的jni恶意攻击检测方法及装置
CN112214769B (zh) 基于SGX架构的Windows系统的主动度量系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21942762

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 26.03.2024)