A security detection system for software dependency packages

Through the combination of fuzzy testing and symbolic execution algorithms, the security vulnerabilities in the software dependency package are identified and verified, and the problem that detection systems in the existing technology cannot cover all execution paths and discover new security vulnerabilities is solved, achieving higher test coverage and security vulnerability discovery capabilities.

CN118094548BActive Publication Date: 2024-11-05HENAN ELECTRONIC PLANNING RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410366768.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-28
Publication Date
2024-11-05
Estimated Expiration
2044-03-28

AI Technical Summary

Technical Problem

The existing detection system detects software dependency packages through black box testing methods, which cannot cover all possible program execution paths and cannot effectively discover new security vulnerabilities, which reduces the testing coverage rate and security vulnerability discovery capabilities of the detection system.

Method used

Using the combination of fuzz testing and symbol execution algorithms, random or semi-random test code is generated through modules such as static analysis, fuzzy code generation, fuzzy testing, path establishment, symbol code generation and symbol execution, and random or semi-random test code is explored to explore the program execution space that depends on packages. Identify and verify potential security vulnerabilities and generate an evaluation report.

Benefits of technology

It effectively improves the test coverage, can discover more potential security vulnerabilities, and improves the global detection capability of software-dependent packages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118094548B_ABST
    Figure CN118094548B_ABST
Patent Text Reader

Abstract

The invention discloses a security detection system for software dependency packages, and relates to the technical field of dependency package security detection. A fuzzy code generation module uses a fuzzy test algorithm to generate a number of random or semi-random fuzzy test codes. The fuzzy test module inputs the generated fuzzy test codes into the dependency package to determine whether the dependency package has a security vulnerability. A path establishment module performs symbolic execution on the dependency package and then establishes a program symbolic execution path of the dependency package. The symbolic execution path is analyzed to find a security vulnerability triggering condition that causes program crash or abnormal behavior. According to the discovered security vulnerability triggering condition, a symbolic test code with an input value is generated, and the generated symbolic test code is input into the dependency package to verify whether the discovered security vulnerability exists. The detection system combines fuzzy testing with symbolic execution algorithms to perform global detection on software dependency packages, which not only effectively improves the test coverage, but also can discover more potential security vulnerabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of dependency package security detection, and in particular to a software dependency package security detection system. Background Art

[0002] Software dependency packages refer to external modules, libraries or other software components that a software project depends on during the software development process. These dependency packages usually include code libraries or tools used to implement specific functions, provide necessary functional support or solve specific problems. With the popularity and use of open source software, the number of dependency packages used in software projects continues to increase. These dependency packages are usually maintained by the community and may have security vulnerabilities or other security vulnerabilities. Therefore, it is necessary to conduct security reviews and inspections on these dependency packages to reduce the security risks of software projects.

[0003] The prior art has the following deficiencies:

[0004] Existing detection systems use black-box testing methods to detect software dependency packages, but traditional black-box testing methods cannot cover all possible program execution paths, and black-box testing methods may not be able to discover new security vulnerabilities using static and dynamic analysis techniques, which not only reduces the test coverage of the detection system, but also fails to effectively discover more potential security vulnerabilities. Summary of the invention

[0005] The purpose of the present invention is to provide a software dependency package security detection system to solve the deficiencies mentioned in the background technology.

[0006] In order to achieve the above-mentioned object, the present invention provides the following technical solutions: a security detection system for software dependency packages, comprising a collection module, a static analysis module, a fuzzy code generation module, a fuzzy testing module, a path establishment module, a symbolic code generation module, a symbolic execution module, and an evaluation report module;

[0007] Collection module: used to collect software dependency packages and dependency package related information;

[0008] Static analysis module: obtains binary files of dependent packages through search engines, analyzes the binary files of dependent packages, and statically identifies whether there are security vulnerabilities in dependent packages;

[0009] Fuzzy code generation module: When static identification shows that there are no security vulnerabilities in the dependent package, a fuzzy testing algorithm is used to generate several random or semi-random fuzzy testing codes;

[0010] Fuzz testing module: inputs the generated fuzz testing code into the dependent package, observes the program behavior of the dependent package and records abnormal situations, analyzes the results of the fuzz testing, identifies the abnormal behavior of the program, and determines whether the dependent package has security vulnerabilities;

[0011] Path building module: If it is determined that there is no security vulnerability in the dependent package, the symbolic execution path of the program of the dependent package is established after symbolic execution of the dependent package, and the program execution space of the dependent package is explored;

[0012] Symbolic code generation module: Analyzes the symbolic execution path, finds the security vulnerability trigger conditions that cause program crashes or abnormal behaviors, and generates symbolic test code with input values ​​based on the discovered security vulnerability trigger conditions;

[0013] Symbolic execution module: inputs the generated symbolic test code into the dependent package to verify whether the discovered security vulnerability exists, analyzes the results of the verification test, and further determines whether there is a security vulnerability;

[0014] Assessment report module: When a security vulnerability is confirmed in a dependent package, the severity of the security vulnerability is assessed, and the discovered security vulnerabilities are compiled into a report and submitted to the developer.

[0015] In a preferred embodiment, the path establishment module sets up a symbolic execution environment, including selecting a symbolic execution engine, configuring environment variables, setting symbolic execution parameters, using the symbolic execution engine to perform symbolic execution on dependent packages according to the symbolic execution target, exploring the execution space of the program and establishing the symbolic execution path of the program;

[0016] The symbolic execution engine explores all execution paths, adds symbolic input variables to the execution paths, and generates path constraints on the execution paths based on the results of symbolic execution.

[0017] The symbolic execution engine automatically continues symbolic execution based on path constraints, expands and explores more execution paths, optimizes the generated execution paths, finds the optimal execution path for use, and visualizes the generated optimal execution path as a path graph through visualization tools.

[0018] In a preferred embodiment, the symbolic execution engine explores all execution paths, adds symbolic input variables to the execution paths, and generates path constraints on the execution paths according to the results of the symbolic execution, including the following steps:

[0019] The symbolic execution engine performs static analysis on the program to obtain the control flow graph and function call graph of the program. Before starting symbolic execution, the symbolic execution engine adds symbolic tags to the input variables in the program.

[0020] The symbolic execution engine starts from the entry point of the program and explores all execution paths according to the control flow graph. At each branch point, the symbolic execution engine considers two branches at the same time and records the constraints of each branch.

[0021] When the symbolic execution engine explores along the execution path, it collects constraints at each branch point. The constraints describe the conditions under which a branch is selected or not selected.

[0022] The symbolic execution engine performs symbolic calculations and generates symbolic execution results at each branch point based on the symbolic input variables and constraints on the current path. When encountering loops or recursive calls in the execution path, the symbolic execution engine merges similar paths and simplifies the paths based on the constraints.

[0023] In a preferred embodiment, when a loop or recursive call is encountered in the execution path, the symbolic execution engine merges similar paths, including the following steps:

[0024] The similarity between paths is determined by comparing the similarity of path constraints. The function expression is:

[0025]

[0026] ; In the formula, express Path and The similarity of the paths, for The path constraints, for The path constraints, express Path and The size of the intersection of the path constraints, that is, the number of constraints that the two paths satisfy in common, express Path and The size of the union of the path constraints, that is, the total number of constraints satisfied by the two paths.

[0027] In a preferred embodiment, the symbolic execution engine optimizes the generated execution path, and finding the optimal execution path for use includes the following steps:

[0028] The symbolic execution engine obtains the coverage, constraint complexity, and path length of the execution path, standardizes the coverage, constraint complexity, and path length of the execution path, and outputs the execution index of the execution path through the path analysis model;

[0029] Sort all execution paths from large to small according to the execution index, generate an execution path list, and select the execution path that is ranked first in the execution path list as the optimal execution path.

[0030] In a preferred embodiment, the symbolic execution module imports the generated symbolic test code into the test environment of the dependent package by modifying the source code, inserting the test code or injecting the dynamic link library, runs the dependent package with the imported symbolic test code, and observes the execution of the program;

[0031] Monitor the running status of the program, including whether it crashes, generates abnormal output, or exhibits abnormal behavior, and collect test data generated during verification testing, including input data, program output, and log information;

[0032] Analyze the abnormal conditions and program behaviors observed during the verification test, including checking the program's crash logs, abnormal output, memory errors, identifying whether there are security vulnerabilities, and further determine whether there are security vulnerabilities based on the analysis and test results.

[0033] In a preferred embodiment, the fuzzy code generation module generates a number of random or semi-random fuzzy test codes through a random input generation algorithm according to the fuzzy test target and dependent package characteristics. The fuzzy test code includes dependent package function calls, data structure initialization, and parameter passing.

[0034] In a preferred embodiment, the fuzz testing module inserts the generated fuzz testing code into the software project to cover the fuzz testing target by modifying the source code, inserting a hook function or injecting a dynamic link library;

[0035] Run the software project with the inserted fuzz testing code and observe the execution of the program, including whether a crash occurs, whether abnormal output is generated, and whether abnormal behavior occurs; collect the test data generated during the fuzz testing, including input data, program output, and log information, check the program's crash log, abnormal output, and memory errors, and identify whether there are security vulnerabilities in the dependent packages.

[0036] In a preferred embodiment, the assessment report module assesses the severity of each discovered security vulnerability using the CVSS basic score, and compiles the assessed security vulnerabilities into a report, the report including vulnerability description, vulnerability impact, vulnerability exploitation scenario, and vulnerability repair suggestions. The compiled security vulnerability report is submitted to the developer, the security vulnerability report is updated, the vulnerability repair situation and results are recorded, and the repaired report is archived.

[0037] A method for detecting a software dependency package security, the method comprising the following steps:

[0038] Collect software dependency packages and related information of the dependency packages, obtain binary files of the dependency packages through search engines, analyze the binary files of the dependency packages, and identify whether the dependency packages have security vulnerabilities;

[0039] Use the fuzz testing algorithm to generate several random or semi-random fuzz testing codes, input the generated fuzz testing codes into the dependent package, observe the program behavior of the dependent package and record the abnormal situation, analyze the results of the fuzz testing, identify the abnormal behavior of the program, and determine whether the dependent package has security vulnerabilities;

[0040] After symbolic execution of dependent packages, the symbolic execution path of the dependent packages is established, and the program execution space of the dependent packages is explored. The symbolic execution path is analyzed to find the trigger conditions of security vulnerabilities that cause program crashes or abnormal behaviors. Based on the discovered security vulnerability trigger conditions, symbolic test code with input values ​​is generated.

[0041] Input the generated symbolic test code into the dependent package to verify whether the discovered security vulnerability exists. Analyze the results of the verification test to further determine whether there is a security vulnerability. When it is confirmed that there is a security vulnerability in the dependent package, evaluate the severity of the security vulnerability.

[0042] The detection system compiles the discovered security vulnerabilities into a report and submits it to the developers.

[0043] In the above technical solution, the technical effects and advantages provided by the present invention are:

[0044] The present invention generates a number of random or semi-random fuzzy test codes by using a fuzzy test algorithm through a fuzzy code generation module, the fuzzy test module inputs the generated fuzzy test code into a dependent package, observes the program behavior of the dependent package and records abnormal situations, analyzes the results of the fuzzy test, identifies the abnormal behavior of the program, and determines whether the dependent package has a security vulnerability. If it is determined that the dependent package does not have a security vulnerability, the path establishment module performs symbolic execution on the dependent package and then establishes a program symbolic execution path of the dependent package. The symbolic code generation module analyzes the symbolic execution path, finds the security vulnerability triggering conditions that cause program crashes or abnormal behaviors, generates symbolic test codes with input values ​​according to the discovered security vulnerability triggering conditions, and the symbolic execution module inputs the generated symbolic test code into the dependent package, verifies whether the discovered security vulnerability exists, analyzes the results of the verification test, and further determines whether there is a security vulnerability. The detection system combines fuzzy testing with symbolic execution algorithms to perform global detection on software dependent packages, which not only effectively improves the test coverage, but also can discover more potential security vulnerabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0046] Figure 1 It is a system module diagram of the present invention. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] Example: See Figure 1 As shown, a software dependency package security detection system described in this embodiment includes a collection module, a static analysis module, a fuzzy code generation module, a fuzzy testing module, a path establishment module, a symbolic code generation module, a symbolic execution module, and an evaluation report module;

[0049] Collection module: collects software dependency packages and dependency package related information, and sends dependency package related information to the static analysis module, fuzzy code generation module, path establishment module and evaluation report module;

[0050] Static analysis module: obtains binary files of dependent packages through search engines, analyzes binary files of dependent packages, statically identifies whether there are security vulnerabilities in dependent packages, and sends the identification results to the fuzzy code generation module;

[0051] Fuzzy code generation module: When static identification shows that there is no security vulnerability in the dependent package, a fuzzy test algorithm is used to generate a number of random or semi-random fuzzy test codes, which are sent to the fuzzy test module;

[0052] Fuzz testing module: inputs the generated fuzz testing code into the dependent package, observes the program behavior of the dependent package and records abnormal situations, analyzes the results of the fuzz testing, identifies the abnormal behavior of the program, determines whether the dependent package has security vulnerabilities, and sends the judgment results to the path establishment module;

[0053] Path establishment module: If it is determined that there is no security vulnerability in the dependent package, the program symbolic execution path of the dependent package is established after symbolic execution of the dependent package, and the program execution space of the dependent package is explored. The program symbolic execution path is sent to the symbolic code generation module;

[0054] Symbolic code generation module: Analyzes the symbolic execution path, finds the security vulnerability trigger conditions that cause program crashes or abnormal behaviors, generates symbolic test code with input values ​​based on the discovered security vulnerability trigger conditions, and sends the symbolic test code to the symbolic execution module;

[0055] Symbolic execution module: inputs the generated symbolic test code into the dependent package, verifies whether the discovered security vulnerability exists, analyzes the results of the verification test, further determines whether there is a security vulnerability, and sends the judgment result to the evaluation report module;

[0056] Assessment report module: When a security vulnerability is confirmed in a dependent package, the severity of the security vulnerability is assessed, and the discovered security vulnerabilities are compiled into a report and submitted to the developer.

[0057] The specific workflow is:

[0058] Collect software dependency packages and related information, including dependency package names, version numbers, binary files, etc. Obtain the binary files of the dependency packages through version control systems, software repositories, or official websites, perform static code analysis on the dependency packages, identify possible security vulnerabilities such as buffer overflows and code injections by analyzing the binary files of the dependency packages, generate fuzz test codes, and use fuzz test algorithms to generate several random or semi-random fuzz test codes, such as random strings and random files. Perform fuzz testing, input the generated fuzz test codes into the dependency packages, observe the program behavior of the dependency packages, and record abnormal situations, such as crashes and abnormal exits. Analyze the test results, analyze the results of the fuzz test, identify abnormal behavior of the program, infer possible security vulnerabilities, establish symbolic execution paths for the dependency packages, perform symbolic execution on the dependency packages, establish symbolic execution paths for the dependency packages, and explore the program execution space of the dependency packages. Find security vulnerability triggering conditions, analyze the symbolic execution paths, and find security vulnerability triggering conditions that cause program crashes or abnormal behavior, such as memory access errors and null pointer dereferences. Generate test code. Based on the trigger conditions of the discovered security vulnerability, generate symbolic test code with specific input values ​​to verify whether the security vulnerability exists. Perform verification testing and input the generated symbolic test code into the dependent package to verify whether the discovered security vulnerability exists. Verification result analysis. Analyze the results of the verification test to determine whether there is a security vulnerability. When it is confirmed that there is a security vulnerability in the dependent package, evaluate the severity of the security vulnerability and generate a security vulnerability report. Organize the discovered security vulnerabilities into a report, including security vulnerability descriptions, impact levels, repair suggestions and other information. Submit security vulnerability reports. Submit security vulnerability reports to relevant developers to assist them in repairing security vulnerabilities. Security repair. Developers perform security repairs on dependent packages, update versions or release patches based on the repair suggestions in the security vulnerability report.

[0059] The present application generates several random or semi-random fuzzy test codes by using a fuzzy test algorithm through a fuzzy code generation module. The fuzzy test module inputs the generated fuzzy test code into the dependent package, observes the program behavior of the dependent package and records the abnormal situation, analyzes the results of the fuzz test, identifies the abnormal behavior of the program, and determines whether the dependent package has a security vulnerability. If it is determined that the dependent package does not have a security vulnerability, the path establishment module performs symbolic execution on the dependent package and then establishes the program symbolic execution path of the dependent package. The symbolic code generation module analyzes the symbolic execution path, finds the security vulnerability triggering conditions that cause the program to crash or behave abnormally, and generates symbolic test code with input values ​​according to the discovered security vulnerability triggering conditions. The symbolic execution module inputs the generated symbolic test code into the dependent package, verifies whether the discovered security vulnerability exists, analyzes the results of the verification test, and further determines whether there is a security vulnerability. The detection system combines fuzz testing with symbolic execution algorithms to perform global detection on software dependency packages, which not only effectively improves the test coverage, but also can discover more potential security vulnerabilities.

[0060] Collection module: collects software dependency packages and dependency package related information, and sends dependency package related information to the static analysis module, fuzzy code generation module, path establishment module and evaluation report module;

[0061] Analyze the code, configuration files, or other related documents of the software project to identify all the dependent packages used in the project. These dependent packages can be third-party libraries, frameworks, tools, or other software components.

[0062] Get detailed information for each dependent package, including name, version number, author, license, official website, source code repository, etc. This information can usually be found in the official website, developer documentation, or software repository of the dependent package.

[0063] Analyze the dependencies between dependent packages and determine the dependency chains between them, thereby helping to understand the interactions between dependent packages and their impact on software projects.

[0064] Obtain information about the security of dependent packages, including known vulnerability fixes, security recommendations, etc. Obtain information by consulting security bulletins, vulnerability databases, security mailing lists, and other channels.

[0065] Record the collected dependency package information in the software project's documents, configuration files, databases, or dedicated dependency package management systems. Ensure the accuracy and completeness of the information and update it regularly.

[0066] Create a manifest or inventory file that lists all the dependencies used in the software project and their related information. It helps with security review and management.

[0067] Static analysis module: obtains binary files of dependent packages through search engines, analyzes binary files of dependent packages, statically identifies whether there are security vulnerabilities in dependent packages, and sends the identification results to the fuzzy code generation module;

[0068] Use a search engine to find and obtain the binary files of the dependency packages. Binaries are usually found on official websites, in software repositories, or other sources.

[0069] Set up the analysis environment, including installing necessary static analysis tools, configuring environment variables, setting analysis parameters, etc. Ensure the stability and reliability of the analysis environment.

[0070] Use a disassembly tool to disassemble the acquired binary file and convert the binary code into assembly code to help understand the structure and function of the binary file.

[0071] Use static analysis tools to perform static analysis on the disassembled assembly code to identify possible security vulnerabilities, such as buffer overflow, format string vulnerability, code injection, etc. This includes finding common vulnerability patterns, analyzing code logic, and checking data processing flow.

[0072] Organize the analysis results into a report to record the security vulnerabilities and issues found, including vulnerability description, impact level, possible attack scenarios, etc. Ensure the accuracy and clarity of the report.

[0073] Fuzzy code generation module: When static identification shows that there is no security vulnerability in the dependent package, a fuzzy test algorithm is used to generate a number of random or semi-random fuzzy test codes, which are sent to the fuzzy test module;

[0074] According to the characteristics of the fuzz test target and dependent packages, a number of random or semi-random fuzz test codes are generated through a random input generation algorithm. The codes can be function calls, data structure initialization, parameter passing, etc. for dependent packages.

[0075] To better illustrate the above solution, we give the following example:

[0076] Randomly select a function in the dependent package and generate the corresponding function call expression. For example: function_name(argument1,argument2,...), according to the data structure defined in the dependent package, generate the corresponding initialization expression. For example, for a list structure, you can generate [*]; for a dictionary structure, you can generate {*}, function_name: represents the name of the function, that is, the identifier of the function to be called in the dependent package. This identifier is usually the name given when the function is defined, which is used to uniquely identify a function, argument1, argument2,...: represents the parameters of the function, that is, the input values ​​passed to the function. These parameters can be any legal data type, such as integers, floating-point numbers, strings, Boolean values, etc. When the function is executed, it will perform corresponding processing according to the value of the parameter. Therefore, the expression function_name(argument1,argument2,...) means calling the function named function_name and passing it the parameters argument1, argument2,.... The function will perform corresponding operations based on the values ​​of these parameters and return a result.

[0077] Fuzz testing module: inputs the generated fuzz testing code into the dependent package, observes the program behavior of the dependent package and records abnormal situations, analyzes the results of the fuzz testing, identifies the abnormal behavior of the program, determines whether the dependent package has security vulnerabilities, and sends the judgment results to the path establishment module;

[0078] The fuzz testing module inserts the generated fuzz testing code into the software project to cover the fuzz testing target by modifying the source code, inserting hook functions or injecting dynamic link libraries, etc., runs the software project with the inserted fuzz testing code, and observes the execution of the program. It records the behavior of the program, including whether it crashes, whether it generates abnormal output, whether it generates abnormal behavior, etc. It collects the test data generated during the fuzz testing, including input data, program output, and log information, checks the crash log, abnormal output, and memory errors of the program, identifies possible security vulnerabilities or problems, and organizes the analysis results into a report, recording the security vulnerabilities and problems found, including vulnerability descriptions, impact levels, possible attack scenarios, and other information.

[0079] For example: We want to perform fuzz testing on a network service software to find security vulnerabilities. The software contains a function process_input(input_data) that processes user input. We hope to use fuzz testing to detect whether the function is vulnerable to malicious input attacks;

[0080] Directly modify the source code and insert the fuzz test code in the process_input function. For example, we can insert a piece of code at the beginning of the function to process the fuzz test input:

[0081] Def_process_input(input_data):

[0082] fuzzed_data=generate_fuzzed_data(input_data);

[0083] #Original data processing logic;

[0084] In this way, each time the process_input function is called, the fuzzy test data will be generated first, and then the original data processing logic will be executed.

[0085] Run the software project with the inserted fuzz test code and observe the execution of the program. Record the behavior of the program through log files, including whether it crashes, whether abnormal output is generated, etc.

[0086] During fuzz testing, we can collect the test data generated, including input data, program output, and log information. This data can be used for subsequent analysis and identification of potential security vulnerabilities. Check the program's logs and output, including crash logs, abnormal output, etc. By analyzing these logs and outputs, we can determine whether there are security vulnerabilities or abnormal behavior, and identify possible security vulnerabilities or issues based on the collected test data, logs, and output. This may involve analyzing the behavior of the program, detecting abnormal situations, and attempting to exploit the vulnerabilities for attacks.

[0087] Path establishment module: If it is determined that there is no security vulnerability in the dependent package, the program symbolic execution path of the dependent package is established after symbolic execution of the dependent package, and the program execution space of the dependent package is explored. The program symbolic execution path is sent to the symbolic code generation module;

[0088] Set up the symbolic execution environment, including selecting a symbolic execution engine, configuring environment variables, setting symbolic execution parameters, etc. Ensure the stability and reliability of the symbolic execution environment. Determine the target for symbolic execution of dependent packages, such as specific functions, APIs, interfaces, or the overall execution path of the program. Use the symbolic execution engine to symbolically execute dependent packages to explore the execution space of the program and establish the symbolic execution path of the program. The symbolic execution engine attempts to explore all possible execution paths and add symbolic input variables to the path.

[0089] Traverse the execution path of the program and explore the execution space of the program, including various branches, loops, conditional statements, etc. This helps to understand the logical structure and execution flow of the program. Based on the results of symbolic execution, generate path constraints on the execution path. These constraints describe the input conditions that make the program enter a specific execution path, such as function parameters, global variable status, etc. Based on the path constraints, continue symbolic execution to expand and explore more execution paths. This can be done automatically through the symbolic execution engine to explore a deeper level of program execution space.

[0090] Optimize the generated execution path and find the best execution path to use. Analyze the generated optimal execution path to understand the behavior and status of the program under different conditions. It helps to find potential abnormal behaviors and vulnerabilities in the program. Visualize the generated optimal execution path into a path diagram through visualization tools to more intuitively understand the execution logic and path coverage of the program. The path diagram can help identify bottlenecks and potential security issues in the program.

[0091] The path establishment module sets up the symbolic execution environment, including selecting a symbolic execution engine, configuring environment variables, setting symbolic execution parameters, using the symbolic execution engine to perform symbolic execution on dependent packages according to the symbolic execution target, exploring the execution space of the program and establishing the symbolic execution path of the program;

[0092] The symbolic execution engine is the core component of symbolic execution, responsible for interpreting and executing program code, and generating symbolic execution paths according to the rules of symbolic execution. It is crucial to choose a symbolic execution engine that is suitable for the task. You can consider using existing symbolic execution tools such as Angr, KLEE, SAGE, etc.

[0093] The configuration of the symbolic execution environment involves setting some environment variables to ensure that the symbolic execution engine can correctly execute the target program, including setting environment variables such as path, library path, input file, and adjusting some system parameters to improve the efficiency and accuracy of symbolic execution.

[0094] It is crucial to set the parameters of the symbolic execution engine according to the goals and requirements of symbolic execution. These parameters can affect aspects such as the coverage, depth, and accuracy of symbolic execution. For example, you can set the depth limit of symbolic execution, the resolution strategy of path constraints, the scope of symbolized variables, etc.

[0095] Once the symbolic execution environment is set up, you can use the symbolic execution engine of your choice to perform symbolic execution on the dependent packages. This involves providing the binary files of the dependent packages to the symbolic execution engine and specifying the entry point and other necessary parameters for execution. The symbolic execution engine will explore the execution space of the program based on the given input and generate a symbolic execution path.

[0096] For example: This application chooses to use the Angr symbolic execution engine to perform symbolic execution on a dependency package of a network service software, configure Angr's environment variables, ensure that Angr can correctly load and execute the target program, and set the symbolic execution parameters to explore the execution space of the program. Then, we provide the target program to Angr and specify the entry point and other parameters for execution to start the symbolic execution process. Angr will explore the execution path of the program based on the given input and generate the corresponding symbolic execution path. Finally, we can analyze the results of the symbolic execution to discover potential security vulnerabilities and issues.

[0097] Angr will explore the execution path of the program based on the given input, and generate the corresponding symbolic execution path including the following steps:

[0098] The program contains a function process_input(input_data), which receives an input data and executes different logics based on the input data. We want to use Angr to perform symbolic execution on this function to find potential security vulnerabilities. We provide an input data input_data to Angr and tell Angr that this input data is symbolic, that is, it can take any value. Then, Angr will start exploring the execution path of the program based on this symbolic input data. Angr will start from the entry point of the function and continue to explore possible execution paths according to the control flow graph of the program. At each branch node, Angr will calculate the conditions of the two branches based on the symbolic value of the input data and symbolize them. In this way, Angr can explore two branches at the same time without having to know the specific value of the input data. As the program is explored, Angr will collect constraints, that is, the conditions that cause a certain execution path to be selected or not selected. Once an execution path is found, Angr will generate the corresponding symbolic execution path, which includes all control flows and constraints from the entry point of the program to the path;

[0099] Suppose our program contains a simple branch statement:

[0100] Def process_input(input_data);

[0101] If input_data==10:

[0102] #do something;

[0103] Else:

[0104] #do something else;

[0105] When we use Angr to perform symbolic execution on this function, Angr will explore two branch paths based on the symbolic value of the input data input_data (that is, it can take any value). If the value of input_data is symbolic, Angr will generate two different execution paths on each branch and collect constraints.

[0106] The symbolic execution engine explores all execution paths and adds symbolic input variables to the execution paths. Based on the results of symbolic execution, it generates path constraints on the execution paths, including the following steps:

[0107] The symbolic execution engine first performs static analysis on the program to obtain information such as the program's control flow graph and function call graph. This information will be used to determine the execution path of the program. Before starting symbolic execution, the symbolic execution engine will add symbolic tags to the input variables in the program. This means that they are no longer specific numerical values, but symbolic symbols that indicate that they can take any value.

[0108] The symbolic execution engine starts from the entry point of the program and explores all possible execution paths along the control flow graph. At each branch point, it considers two branches at the same time and records the constraints of each branch. As the symbolic execution engine explores along the execution path, it collects the constraints of each branch point. These constraints describe the conditions that cause a branch to be selected or not selected. For example, when encountering the conditional statement if(x==10), the constraint is x==10 or x!=10.

[0109] At each branch point, the symbolic execution engine performs symbolic calculations based on the symbolic input variables and constraints on the current path. This means that it does not calculate specific input values, but operates on symbols to generate symbolic execution results. When encountering loops or recursive calls in the execution path, the symbolic execution engine may encounter path merging. Try to merge similar paths and simplify paths based on constraints. When the symbolic execution engine completes the exploration of all execution paths, it generates corresponding symbolic execution paths based on the collected constraints. These paths include all control flows of the program from the entry point to each end point, as well as constraints.

[0110] When encountering loops or recursive calls in the execution path, the symbolic execution engine merges similar paths, including the following steps:

[0111] The similarity between paths is determined by comparing the similarity of path constraints. The function expression is:

[0112]

[0113] ; In the formula, express Path and The similarity of the paths, for The path constraints, for The path constraints, express Path and The size of the intersection of the path constraints, that is, the number of constraints that the two paths satisfy in common, express Path and The size of the union of the path constraints, that is, the total number of constraints satisfied by the two paths.

[0114] Simplifying a path based on constraints involves the following steps:

[0115] During symbolic execution, for each execution path, the constraints that appear on it are collected. These constraints usually come from conditional statements, loop statements, function calls, etc. in the program.

[0116] For each execution path, the symbolic execution engine performs path pruning based on the collected constraints. The goal of path pruning is to eliminate unreachable or irrelevant paths, thereby reducing the number and complexity of paths.

[0117] During the path pruning process, a symbolic solver is needed to solve the constraints on the path. The symbolic solver accepts a set of constraints and tries to find variable values ​​that satisfy these constraints. If the constraints on a path cannot be satisfied, the symbolic solver will return an unsatisfiable result.

[0118] For each execution path, the symbolic execution engine uses a symbolic solver to determine its reachability. If the constraints on a path make the path unreachable, the path will be pruned.

[0119] If the constraints on a certain execution path can be simplified or merged, the symbolic execution engine will simplify the path accordingly. This may involve logical reasoning, rewriting and simplifying the constraints, and optimizing using information on the path.

[0120] Repeating the above steps may require multiple iterations until all execution paths are properly pruned and simplified. This ensures that the paths generated by the symbolic execution engine have high accuracy and usability.

[0121] The symbolic execution engine optimizes the generated execution path, and finding the optimal execution path for use includes the following steps:

[0122] The symbolic execution engine obtains the coverage, constraint complexity, and path length of the execution path, and after normalizing the coverage, constraint complexity, and path length of the execution path, outputs the execution index of the execution path through the path analysis model. The function expression of the path analysis model is:

[0123]

[0124] ; In the formula, To execute the index, is the coverage rate, is the number of program statements covered by the execution path, is the total number of program statements of the dependent package, To constrain the complexity, is the number of different types of logical operators involved in the constraints, Indicates the constraint condition The number of types of logical operators, For the The weights of the logical operators of the types, is the path length, , , are the proportionality coefficients of coverage, constraint complexity and path length respectively, and , , Both are greater than 0.

[0125] Sort all execution paths from large to small according to the execution index, generate an execution path list, and select the execution path that is ranked first in the execution path list as the optimal execution path.

[0126] Symbolic code generation module: Analyzes the symbolic execution path, finds the security vulnerability trigger conditions that cause program crashes or abnormal behaviors, and generates symbolic test code with input values ​​based on the discovered security vulnerability trigger conditions;

[0127] Analyze the optimal execution path generated by the path building module to understand the execution logic, program status, and constraints of the optimal execution path. In the optimal execution path, identify the trigger conditions of security vulnerabilities that cause program crashes or abnormal behavior. Involve trigger conditions of vulnerability types such as memory access errors, null pointer dereferences, and integer overflows. Generate symbolic test code with input values ​​based on the identified security vulnerability trigger conditions. The test code includes operations such as assignment of specific input data, setting of parameters, and function calls. When generating symbolic test code, consider the use of symbolic input variables. Symbolic input variables can represent unknown input values, allowing the test code to cover a wider input space.

[0128] To better illustrate the above solution, we give the following example:

[0129] Assume that there is a memory access error vulnerability in the optimal execution path, and the trigger condition is that the index of an array access exceeds the valid range of the array. For this situation, the following symbolic test code can be generated:

[0130] During the path analysis, we found that there is an array arr in the program, and a variable index is used as the index of the array. According to the analysis of the path constraints, we found that there is no effective boundary check on the value range of index in the program, so there is a possibility of out-of-bounds access to the array.

[0131] To generate symbolic test code, we first declare a symbolic integer variable index and set constraints on its value range to ensure that the index value is within the legal range. Then, we access the symbolic index variable as an index of the array to simulate possible out-of-bounds access.

[0132] Finally, the constraint solver is used to solve the constraints and generate test cases. In the test cases, the specific values ​​of the index variables will be determined according to the solver results to cover different index conditions. By executing the generated test cases, the behavior of the program under different index conditions can be verified to find situations that may cause memory access errors.

[0133] Symbolic execution module: inputs the generated symbolic test code into the dependent package, verifies whether the discovered security vulnerability exists, analyzes the results of the verification test, further determines whether there is a security vulnerability, and sends the judgment result to the evaluation report module;

[0134] Import the generated symbolic test code into the test environment of the dependent package. This can be achieved by modifying the source code, inserting test code, dynamic link library injection, etc. Run the dependent package with the imported symbolic test code and observe the execution of the program. Monitor the running status of the program, including whether a crash occurs, whether abnormal output is generated, whether abnormal behavior occurs, etc. Collect the test data generated during the verification test, including input data, program output, log information, etc. This data can help analyze the effect of the verification test and discover potential security issues. Analyze the abnormal conditions and program behavior observed during the verification test to identify whether there are security vulnerabilities. This can include checking the program's crash log, abnormal output, memory errors, etc. Based on the analysis of the test results, further determine whether there are security vulnerabilities.

[0135] Suppose we perform symbolic testing on a dependency package of a network server software. The test code is mainly used to simulate network requests and processing. During the test run, we observed some abnormal situations, such as frequent program crashes and memory errors. By analyzing the test logs and crash stacks, we found that these abnormal situations are related to the processing of input data, and there may be buffer overflows or improper handling of abnormal input. Based on these findings, we further analyzed the source code and confirmed that there are security vulnerabilities that need to be fixed in a timely manner.

[0136] Assessment report module: When a security vulnerability is confirmed in a dependent package, the severity of the security vulnerability is assessed, and the discovered security vulnerability is compiled into a report and submitted to the developer;

[0137] Assess the severity of each discovered security vulnerability. Security vulnerability assessment standards such as CVSS (Common-Vulnerability-Scoring-System) are usually used to assess the severity of the vulnerability. Consider factors such as the impact range of the vulnerability, attack complexity, and potential damage to evaluate. The function expression is:

[0138]

[0139] ; In the formula, is the CVSS base score of the vulnerability, Indicates the historical impact of the vulnerability, Indicates the complexity of the attack, is the compensation factor used to correct Middle Pair and The value range of ISS is between 0.5 and 1.0. Indicates that the calculation result is rounded off. The CVSS base score is usually a decimal. In order to make the score easier to understand and compare, the CVSS specification recommends rounding the base score to the nearest integer. CVSS (Common-Vulnerability-Scoring-System) is a widely used security vulnerability assessment standard used to assess the severity of vulnerabilities. CVSS considers multiple factors, including the impact range of the vulnerability, the complexity of the attack, the potential damage, etc., to comprehensively assess the severity of the vulnerability. Therefore, assessing the severity of the vulnerability through CVSS belongs to the existing technology and is not limited here.

[0140] Compile the assessed security vulnerabilities into a report. The report should include detailed information such as vulnerability description, vulnerability impact, vulnerability exploitation scenario, vulnerability repair suggestions, etc. Ensure the accuracy, clarity and completeness of the report.

[0141] Submit the compiled security vulnerability report to the relevant developer or security team. Ensure that the report is communicated to the person responsible for fixing the vulnerability in a timely manner and provide necessary support and guidance.

[0142] Supervise the vulnerability repair process and ensure that developers repair vulnerabilities according to the repair suggestions in the report. Communicate with the development team regularly to track the progress of repairs and solve problems and obstacles in the repair process in a timely manner.

[0143] After confirming that the vulnerability has been fixed, re-run security testing to verify whether the vulnerability has been successfully fixed. Ensure that the fixed vulnerability no longer exists and that the repair process has not introduced new security issues.

[0144] Update security vulnerability reports to record the status and results of vulnerability repairs. Archive the repaired reports for future reference and review.

[0145] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.

[0146] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0147] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A software dependency package security detection system, characterized by: It includes collection module, static analysis module, fuzzy code generation module, fuzzy testing module, path building module, symbolic code generation module, symbolic execution module and evaluation report module; Collection module: used to collect software dependency packages and dependency package related information; Static analysis module: obtains binary files of dependent packages through search engines, analyzes the binary files of dependent packages, and statically identifies whether there are security vulnerabilities in dependent packages; Fuzzy code generation module: When static identification shows that there are no security vulnerabilities in the dependent package, a fuzzy testing algorithm is used to generate several random or semi-random fuzzy testing codes; Fuzz testing module: inputs the generated fuzz testing code into the dependent package, observes the program behavior of the dependent package and records abnormal situations, analyzes the results of the fuzz testing, identifies the abnormal behavior of the program, and determines whether the dependent package has security vulnerabilities; Path building module: If it is determined that there is no security vulnerability in the dependent package, the symbolic execution path of the program of the dependent package is established after symbolic execution of the dependent package, and the program execution space of the dependent package is explored; Symbolic code generation module: Analyzes the symbolic execution path, finds the security vulnerability trigger conditions that cause program crashes or abnormal behaviors, and generates symbolic test code with input values ​​based on the discovered security vulnerability trigger conditions; Symbolic execution module: inputs the generated symbolic test code into the dependent package to verify whether the discovered security vulnerability exists, analyzes the results of the verification test, and further determines whether there is a security vulnerability; Assessment report module: When a security vulnerability is confirmed in a dependent package, the severity of the security vulnerability is assessed, and the discovered security vulnerability is compiled into a report and submitted to the developer; The path establishment module sets up the symbolic execution environment, including selecting a symbolic execution engine, configuring environment variables, setting symbolic execution parameters, using the symbolic execution engine to perform symbolic execution on dependent packages according to the symbolic execution target, exploring the execution space of the program and establishing the symbolic execution path of the program; The symbolic execution engine explores all execution paths, adds symbolic input variables to the execution paths, and generates path constraints on the execution paths based on the results of symbolic execution. The symbolic execution engine automatically continues to perform symbolic execution based on path constraints, expands and explores more execution paths, optimizes the generated execution paths, finds the optimal execution path for use, and visualizes the generated optimal execution path as a path graph through visualization tools; The symbolic execution engine explores all execution paths, adds symbolic input variables to the execution paths, and generates path constraints on the execution paths based on the results of the symbolic execution, including the following steps: The symbolic execution engine performs static analysis on the program to obtain the control flow graph and function call graph of the program. Before starting symbolic execution, the symbolic execution engine adds symbolic tags to the input variables in the program. The symbolic execution engine starts from the entry point of the program and explores all execution paths according to the control flow graph. At each branch point, the symbolic execution engine considers two branches at the same time and records the constraints of each branch. When the symbolic execution engine explores along the execution path, it collects constraints at each branch point. The constraints describe the conditions under which a branch is selected or not selected. The symbolic execution engine performs symbolic calculations and generates symbolic execution results at each branch point based on the symbolic input variables and constraints on the current path. When a loop or recursive call is encountered in the execution path, the symbolic execution engine merges similar paths and simplifies the path based on the constraints. When encountering loops or recursive calls in the execution path, the symbolic execution engine merges similar paths, including the following steps: The similarity between paths is determined by comparing the similarity of path constraints. The function expression is: Where XSD(P1, P2) represents the similarity between the P1 path and the P2 path, C1 represents the constraint of the P1 path, C2 represents the constraint of the P2 path, |C1∩C2| represents the size of the intersection of the constraints of the P1 path and the P2 path, that is, the number of constraints satisfied by the two paths, |C1∪C2| represents the size of the union of the constraints of the P1 path and the P2 path, that is, the number of constraints satisfied by the two paths in total; The symbolic execution engine optimizes the generated execution path, and finding the optimal execution path for use includes the following steps: The symbolic execution engine obtains the coverage, constraint complexity, and path length of the execution path, and after normalizing the coverage, constraint complexity, and path length of the execution path, outputs the execution index of the execution path through the path analysis model. The function expression of the path analysis model is: In the formula, zx s is the execution index, (fg s / Z s ) is the coverage rate, fg s is the number of program statements covered by the execution path, Z s is the total number of program statements of the dependent package, is the constraint complexity, n is the number of different types of logical operators involved in the constraint, count i represents the number of logical operators of the i-th type in the constraint, ω i is the weight of the logical operator of type i, lj c is the path length, α, β, and γ are the proportional coefficients of coverage, constraint complexity, and path length, respectively, and α, β, and γ are all greater than 0; All execution paths are sorted from large to small according to the execution index to generate an execution path list, and the execution path that is ranked first in the execution path list is selected as the optimal execution path.

2. A software dependency package security detection system according to claim 1, characterized in that: The symbolic execution module imports the generated symbolic test code into the test environment of the dependent package by modifying the source code, inserting the test code or injecting the dynamic link library, runs the dependent package with the imported symbolic test code, and observes the execution of the program; Monitor the running status of the program, including whether it crashes, generates abnormal output, or exhibits abnormal behavior, and collect test data generated during verification testing, including input data, program output, and log information; Analyze the abnormal conditions and program behaviors observed during the verification test, including checking the program's crash logs, abnormal output, memory errors, identifying whether there are security vulnerabilities, and further determine whether there are security vulnerabilities based on the analysis and test results.

3. A software dependency package security detection system according to claim 2, characterized in that: The fuzzy code generation module generates a number of random or semi-random fuzzy test codes according to the fuzzy test target and the dependent package characteristics through a random input generation algorithm. The fuzzy test code includes dependent package function calls, data structure initialization, and parameter passing.

4. A software dependency package security detection system according to claim 3, characterized in that: The fuzz test module inputs the generated fuzz test code into the dependent package to cover the fuzz test target by modifying the source code, inserting a hook function or injecting a dynamic link library; Run the software project with the inserted fuzz test code and observe the execution of the program, including whether it crashes, generates abnormal output, or exhibits abnormal behavior; Collect test data generated during fuzz testing, including input data, program output, and log information. Check the program's crash logs, abnormal output, and memory errors to identify whether dependent packages have security vulnerabilities.

5. A software dependency package security detection system according to claim 4, characterized in that: The assessment report module assesses the severity of each discovered security vulnerability using the CVSS basic score, and compiles the assessed security vulnerabilities into a report, which includes vulnerability description, vulnerability impact, vulnerability exploitation scenario, and vulnerability repair suggestions. The compiled security vulnerability report is submitted to the developer, the security vulnerability report is updated, the vulnerability repair situation and results are recorded, and the repaired report is archived.

6. A method for security detection of software dependency packages, implemented by the detection system according to any one of claims 1 to 4, characterized in that: The detection method comprises the following steps: Collect software dependency packages and related information of dependency packages, obtain binary files of dependency packages through search engines, analyze binary files of dependency packages, and statically identify whether there are security vulnerabilities in dependency packages; When static identification shows that there is no security vulnerability in the dependent package, a fuzz test algorithm is used to generate several random or semi-random fuzz test codes, and the generated fuzz test codes are input into the dependent package to observe the program behavior of the dependent package and record abnormal situations. The results of the fuzz test are analyzed to identify the abnormal behavior of the program and determine whether there is a security vulnerability in the dependent package. If it is determined that there is no security vulnerability in the dependent package, the symbolic execution path of the program of the dependent package is established after symbolic execution of the dependent package, and the program execution space of the dependent package is explored, the symbolic execution path is analyzed, and the security vulnerability triggering conditions that cause program crashes or abnormal behaviors are found. According to the discovered security vulnerability triggering conditions, symbolic test code with input values ​​is generated; Input the generated symbolic test code into the dependent package to verify whether the discovered security vulnerability exists. Analyze the results of the verification test to further determine whether there is a security vulnerability. When it is confirmed that there is a security vulnerability in the dependent package, evaluate the severity of the security vulnerability. The detection system compiles the discovered security vulnerabilities into a report and submits it to the developers.