Method, device, computer-readable medium and electronic device for detecting code vulnerabilities
By covering and initializing the code and adding a stain marking function, the loopholes in the code files are detected, which solves the problem of inaccurate detection results in the existing technology and achieves higher detection authenticity and comprehensiveness.
Patent Information
- Application Number
- CN202010680830.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-15
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-07-15
AI Technical Summary
When the existing technology detects vulnerabilities in code files, the detection effect is not accurate enough and cannot fully identify security threats in the code, affecting the normal operation of the files.
By obtaining the code to be detected and detection parameters, the code is covered and initialized, the taint marking function and the taint detection function are added, the security threats of parameters are detected during the function parameter passing process of the code, and potential vulnerabilities are identified through taint marking.
It improves the authenticity and comprehensiveness of code detection, can more accurately identify security vulnerabilities in the code, and enhances the reliability of detection.
Smart Images

Figure CN111753302B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, computer-readable medium and electronic device for detecting code vulnerabilities. Background Art
[0002] When a code file has a vulnerability, it is easy to be attacked and affect the normal operation of the file. In the related art, the attack prevention and detection of files are carried out, for example, by static analysis of the code file to detect the potential hidden dangers, but this method cannot fully detect the vulnerabilities in the code file, resulting in the problem of inaccurate detection effect. Summary of the invention
[0003] The embodiments of the present application provide a method, apparatus, computer-readable medium, and electronic device for detecting code vulnerabilities, thereby improving the authenticity, comprehensiveness, and reliability of code detection at least to a certain extent.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a method for detecting code vulnerabilities is provided, comprising: obtaining a code to be detected and a detection parameter for detecting the code; performing overwriting initialization on the code to obtain a code having a taint marking function and a taint detection function; inputting the detection parameter into the code, and during a function parameter passing process of the code, when the taint marking function detects that a parameter in the code has a security threat, taint marking the parameter to obtain a marked parameter; when the taint detection function detects that a parameter of the function carries a taint mark, the function is identified as a vulnerability of the code.
[0006] According to one aspect of an embodiment of the present application, a device for detecting code vulnerabilities is provided, comprising: an acquisition unit for acquiring a code to be detected and a detection parameter for detecting the code; an initialization unit for overwriting and initializing the code to obtain a code having a taint marking function and a taint detection function; a marking unit for inputting the detection parameter into the code, and in the function parameter transmission process of the code, when the parameter in the code is detected to have a security threat through the taint marking function, the parameter is tainted to obtain a marking parameter; a detection unit for identifying the function as a vulnerability of the code when the parameter of the function is detected to carry a taint mark through the taint detection function. In some embodiments of the present application, based on the aforementioned scheme, the initialization unit comprises: a function detection unit for identifying a function to be processed in the code that needs to be overwritten and initialized based on the properties of the function in the code; a function adding unit for adding a taint marking function and a taint detection function to the function to be processed to obtain a code having a taint marking function and a taint detection function.
[0007] In some embodiments of the present application, based on the aforementioned scheme, the function detection unit includes: a first detection unit, used to identify a function whose number of strings exceeds a preset number as a string-related function; and a second detection unit, used to identify the string-related function and the function processor in the code as the function to be processed.
[0008] In some embodiments of the present application, based on the aforementioned scheme, the marking unit includes: a detection parameter input unit, used to input the detection parameter into the code to instruct the code to start running; a parameter attribute detection unit, used to detect the attributes of the parameter when the parameter obtained based on the detection parameter is passed into the function of the code; a parameter marking unit, used to mark the parameter based on the attribute of the parameter, if it is detected that the parameter in the code has a security threat, through the taint marking function, to obtain the marked parameter.
[0009] In some embodiments of the present application, based on the aforementioned scheme, the parameter attribute detection unit is used to detect whether the input parameter of the function carries the taint mark during the function parameter passing process of the code; the parameter marking unit is used to determine that the input parameter has a security threat if the input parameter of the function carries the taint mark; through the taint marking function, the output parameter corresponding to the input parameter is tainted to obtain the marked parameter.
[0010] In some embodiments of the present application, based on the aforementioned scheme, the marking unit includes: a first determination unit, used to determine, based on the function in the code, the variable corresponding to the parameter in the code, and generate an identification bit in the variable; a setting unit, used to obtain a taint mark and set the value of the identification bit to the taint mark; and a second marking unit, used to generate the marking parameter based on the parameter and the taint mark corresponding to the identification bit.
[0011] In some embodiments of the present application, based on the aforementioned scheme, the detection unit includes: a second detection unit, used to detect whether there is a function with security risks in the code based on a preset function type with security risks; a third detection unit, used to detect whether the parameters of the function contain taint marks based on the taint detection function if there is a function with security risks in the code; and a third detection unit, used to identify the function as a vulnerability of the code if the parameters of the function contain the taint mark.
[0012] In some embodiments of the present application, based on the aforementioned scheme, the parameters include incoming parameters; the third detection unit includes: a fourth detection unit, used to detect whether there is an identification bit in the incoming parameter of the function; and a fifth detection unit, used to determine that the incoming parameter contains the taint mark if the identification bit exists in the incoming parameter and the value on the identification bit is the same as the taint mark.
[0013] In some embodiments of the present application, based on the aforementioned scheme, the function types with security risks include one or at least two of the following functions: command execution function, callback function, code execution function, file reading function, file inclusion function, file writing function, data display function and database injection function.
[0014] In some embodiments of the present application, based on the aforementioned scheme, the acquisition unit includes: a code acquisition unit, used to acquire the code to be detected; a scenario simulation unit, used to simulate the running scenario of the code and determine the target interface for inputting initial input parameters in the code; a parameter generation unit, used to acquire the detection parameters corresponding to the running scenario based on the configuration information of the target interface.
[0015] In some embodiments of the present application, based on the aforementioned scheme, the device for detecting code vulnerabilities also includes: a target detection unit, used to identify the function corresponding to the parameter carrying the taint mark as a target function; a name acquisition unit, used to obtain the function name of the target function; and an alarm unit, used to generate security alarm information based on the function name.
[0016] In some embodiments of the present application, based on the aforementioned scheme, the device for detecting code vulnerabilities also includes: a position determination unit, used to determine the target position of the target function in the code based on the function name of the target function; a code marking unit, used to mark the target position and generate a marking code; and a detection result unit, used to generate the vulnerability detection result based on the marking code.
[0017] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for detecting code vulnerabilities as described in the above embodiment is implemented.
[0018] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for detecting code vulnerabilities as described in the above embodiments.
[0019] According to one aspect of an embodiment of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for detecting code vulnerabilities provided in the above-mentioned various optional implementations.
[0020] In the technical solutions provided in some embodiments of the present application, after the code and the detection parameters used to detect the code are obtained and the code is covered and initialized to obtain the code with the taint mark and the detection function, the detection parameters are input into the initialized code, the parameters are passed during the code running process, and the parameters are detected to see whether they are parameters with security threats, so as to mark the parameters with security threats, and when the taint detection function detects that the parameters of the function carry the taint mark, the function is identified as a vulnerability in the code. By obtaining the corresponding detection parameters based on the code, the authenticity of the code detection is improved, and the functions with security vulnerabilities are detected based on the transmission of the taint mark in the function, which improves the comprehensiveness and reliability of the code detection.
[0021] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0023] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;
[0024] Figure 2 A flowchart of a method for detecting code vulnerabilities according to an embodiment of the present application is schematically shown;
[0025] Figure 3 A flowchart schematically shows the transfer of taint marks in a code function according to an embodiment of the present application;
[0026] Figure 4 A schematic diagram schematically shows a method of stain marking a detection parameter according to an embodiment of the present application;
[0027] Figure 5 A schematic diagram of transferring a stain mark according to an embodiment of the present application is schematically shown;
[0028] Figure 6 A schematic diagram of detecting code vulnerabilities according to an embodiment of the present application is schematically shown;
[0029] Figure 7 A flowchart for identifying a function as a code vulnerability according to an embodiment of the present application is schematically shown;
[0030] Figure 8 A flowchart for detecting code vulnerabilities according to an embodiment of the present application is schematically shown;
[0031] Fig. 9 A block diagram of a device for detecting code vulnerabilities according to an embodiment of the present application is schematically shown;
[0032] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0034] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0035] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0036] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0037] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0038] like Figure 1 As shown, the system architecture may include terminal devices (such as Figure 1 The embodiment of the present invention is a schematic diagram of a mobile phone 101, a tablet computer 102, a portable computer 103, a desktop computer, etc., a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc.
[0039] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0040] The user can use the terminal device to interact with the server 105 through the network 104 to receive or send messages, etc. The server 105 can be a server that provides various services. For example, the user uses the terminal device 103 (or the terminal device 101 or 102) to upload the code to be detected to the server 105, and the server 105 obtains the code to be detected and the detection parameters used to detect the code, and then overwrites and initializes the code to obtain the code with the taint marking function and the taint detection function; then the detection parameters are input into the code, and in the process of function parameter transmission of the code, when the parameters in the code are detected to have security threats through the taint marking function, the parameters are tainted and the marked parameters are obtained; when the taint detection function detects that the parameters of the function carry the taint mark, the function is identified as a vulnerability in the code. By acquiring the code and the detection parameters used to detect the code, the code is overwritten and initialized to obtain the code with taint marks and detection functions, and then the detection parameters are input into the initialized code, and the parameters are passed during the code running process, and the parameters are detected to see if they are parameters with security threats, so as to mark the parameters with security threats, and when the taint detection function detects that the parameters of the function carry taint marks, the function is identified as a vulnerability in the code. By acquiring the corresponding detection parameters based on the code, the authenticity of the code detection is improved, and the functions with security vulnerabilities are detected based on the transmission of taint marks in the function, which improves the comprehensiveness and reliability of the code detection.
[0041] It should be noted that the method for detecting code vulnerabilities provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the device for detecting code vulnerabilities is generally arranged in the server 105. However, in other embodiments of the present application, the terminal device may also have similar functions as the server, so as to execute the scheme for detecting code vulnerabilities provided in the embodiment of the present application. For example, the vulnerability of the code is directly detected by a computer, and the vulnerability of the code is obtained, and a detection result is generated.
[0042] The implementation details of the technical solution of the embodiment of the present application are described in detail below:
[0043] Figure 2 A flowchart of a method for detecting code vulnerabilities according to an embodiment of the present application is shown. The method for detecting code vulnerabilities can be executed by a server, which can be Figure 1 Refer to the server shown in Figure 2 As shown, the method for detecting code vulnerabilities at least includes steps S210 to S240, which are described in detail as follows:
[0044] In step S210, a code to be detected and detection parameters for detecting the code are obtained.
[0045] With the development of computer systems, more and more system software has sprung up. Thanks to the development of front-end technology, more and more systems have become web-based and online, and people have begun to be able to obtain more and more services online through browsers. Along with the enrichment of online website functions, network security has become more complicated, and hackers are also sparing no effort to find the possibility of loopholes in every system. In this embodiment, the code in the network and system is obtained to detect loopholes in the code.
[0046] In one embodiment of the present application, the code to be detected can be obtained through the background of the system, or from a folder of the system code, etc.
[0047] The code in this embodiment is used to represent the source file written by the programmer in the language supported by the development tool, which is a set of clear rules that represent information in discrete form by characters, symbols or signal code elements. The code types in this embodiment may include: Hyper Text Markup Language (HTML), Cascading Style Sheets (CSS), Java, C, C++ and other programming languages, etc.
[0048] In one embodiment of the present application, when the code is detected, the detection is performed by simulating the actual running scenario of the code. Therefore, the input parameters can be generated based on the actual running scenario. In this embodiment, the running scenario of the code is simulated to obtain the detection parameters corresponding to the running scenario, so as to detect the code based on the detection parameters.
[0049] In one embodiment of the present application, the process of obtaining the code to be detected and the detection parameters used to detect the code in step S210 includes the following steps: obtaining the code to be detected; simulating the running scenario of the code to determine the target interface for inputting initial input parameters in the code; and obtaining the detection parameters corresponding to the running scenario based on the configuration information of the target interface.
[0050] In practical applications, each code needs an initial input data when running to start the running of the code. In this embodiment, the running scenario of the code is simulated to determine the target interface in the code where the initial data needs to be input. Based on the configuration information of the target interface, the detection parameters corresponding to the running scenario are generated, so that the detection parameters are used as the input parameters of the code. In one embodiment of the present application, the configuration information of the target interface may include the interface type of the target interface, the parameter type of the corresponding input parameter, etc., so as to determine the data corresponding to it based on the interface type or parameter type as the detection parameter.
[0051] Exemplarily, in the application scenario of web shell, the embodiment adopts the form of simulating dynamic input parameters to input custom parameters into the entrance of the web shell to receive external parameters, simulating the real scenario of online operation. Specifically, in the embodiment, the value taking place in the code, that is, the input interface, is first judged, and combined with the analysis of security intrusion cases, a custom string parameter is passed to the common parameter input interface with potential security risks, such as GET, POST, COOKIE and other interfaces. The specific value of the parameter is not important, and a value that is easy to identify or meaningful can be set. Assuming that a security-threatening content is passed in by an external malicious attacker of the web shell as a detection parameter, the value of the detection parameter can be set to 'ATTACK' to facilitate the transmission of parameters.
[0052] In step S220, the code is overwritten and initialized to obtain a code having a stain marking function and a stain detection function.
[0053] In one embodiment of the present application, before the code is detected, the code may be initialized. The initialization operation in this embodiment may include overwriting the code, deleting redundant data in the code, such as deleting comments in the code, etc., and may also add a stain marking function and a stain detection function to the code to be detected.
[0054] In one embodiment of the present application, Figure 3 As shown, the process of performing overwriting initialization on the code in step S220 to obtain the code with the stain marking function and the stain detection function includes steps S2201 to S2202, which are described in detail as follows:
[0055] In step S2201, based on the properties of the functions in the code, the functions to be processed in the code that need to be overwritten and initialized are identified.
[0056] In one embodiment of the present application, the functions to be processed may include various types of functions, functions with special operation modes, or functions with more corresponding characters in the code, etc. The overwriting initialization in this embodiment is used to indicate that the new function is overwritten on the basis of the original function of the function, so that the function obtained by overwriting initialization has both the original function and the new function.
[0057] In one embodiment of the present application, the process of identifying the to-be-processed function in the code that needs to be overwritten and initialized based on the properties of the function in the code in step S2201 includes the following steps:
[0058] Identify functions with more than a preset number of strings as string-related functions;
[0059] Identify string-related functions and function handlers in the code as functions to be processed;
[0060] In one embodiment of the present application, functions whose string quantity exceeds a preset quantity in the code are first detected and regarded as string-related functions. String-related functions and function processors in the code are regarded as functions to be processed, so as to add a layer of proxy on the upper layer of the functions to be processed without changing the original functions of the functions to be processed.
[0061] In step S2202, a stain marking function and a stain detection function are added to the function to be processed to obtain a code having the stain marking function and the stain detection function.
[0062] In one embodiment of the present application, after the functions to be processed are determined, a layer of agent is added to the upper layer of the functions to be processed without changing the original functions of these functions to be processed, and on the basis of entrusting the original function processor to execute the original functions, the functions of taint marking and taint detection are added to obtain the code with taint marking function and taint detection function.
[0063] For example, in a web shell code written in PHP language, when the driver entry function MODULE_INIT is running, the code is overwritten. MODULE_INIT is the entry function of the Linux driver. When MODULE_INIT is running, the code initialization process can be executed. In this process, the code is overwritten, that is, a large number of string-related functions and opcode function processors native to the PHP kernel are overwritten. Before each function of the code takes effect, the taint mark and taint detection functions are added.
[0064] In step S230, the detection parameter is input into the code, and during the function parameter transmission process of the code, when the parameter in the code is detected to have a security threat through the taint marking function, the parameter is tainted to obtain a marked parameter.
[0065] In one embodiment of the present application, the detection parameters are input into the code, and the detection parameters with security threats are tainted by the taint marking function to obtain the marking parameters. In this way, during the transmission of the marking parameters, the taint marking is used to identify the functions or other code elements related to the marking parameters in the code.
[0066] In one embodiment of the present application, in step S230, the detection parameter is input into the code, and in the function parameter transmission process of the code, when the parameter in the code is detected to have a security threat through the taint marking function, the parameter is tainted and marked to obtain the marked parameter, including steps S2301 to S2303, which are described in detail as follows:
[0067] In step S2301, the detection parameter is input into the code to instruct the code to start running.
[0068] In one embodiment of the present application, after the code is initialized, the detection parameters are input into the code to indicate or trigger the code to start running. During the code running process, operations and other processing are performed based on the marked parameters to generate processing results obtained by each operation. At the same time, during the running process, the code will generate new parameters based on the detection parameters and pass them between various functions, that is, pass parameters, thereby completing the function of the entire code.
[0069] In step S2302, when the parameter obtained based on the detection parameter is passed into the function of the code, the attribute of the parameter is detected.
[0070] In one embodiment of the present application, based on the parameter information of the detection parameter, it is determined whether the detection parameter is a parameter that poses a security threat. For externally transmitted parameters that pose a security threat, that is, tainted content, we need a means to trace its transmission in the code. First, it needs to be marked so that we can identify it at any time through the mark. Because our purpose is not to detect all externally transmitted parameters, but only to track and detect parameters that have the potential for threat.
[0071] In one embodiment of the present application, when the parameter obtained based on the detection parameter is passed into the function of the code, detecting the attribute of the parameter includes: during the function parameter passing process of the code, detecting whether the input parameter of the function carries the taint mark.
[0072] In one embodiment of the present application, the attribute of the parameter can be determined by the input party of the detection parameter. For example, when simulating the actual running scenario of the code, the input party of the detection parameter can be simulated as an attacker of the code, and the input detection parameter is attack data, and the identity information of the input party of the detection parameter is judged to obtain a conclusion on whether the detection parameter is a parameter with security threats.
[0073] In step S2303, based on the attribute of the parameter, if it is detected that the parameter in the code has a security threat, the parameter is marked by the taint marking function to obtain the marked parameter.
[0074] In one embodiment of the present application, if it is detected that the input parameter of the function carries the taint mark, the input parameter is determined to have a security threat; through the taint mark function, the output parameter corresponding to the input parameter is tainted to obtain the marked parameter. If it is detected that the input parameter of the function does not carry the taint mark, the input parameter is determined to have no security threat, and there is no need to mark the output parameter of the function. In the above manner, the taint mark is passed in the function of the code to detect the function with security vulnerabilities in the code.
[0075] In this embodiment, when the detection parameter is a parameter with a security threat, the detection parameter is marked to obtain a marked parameter. Optionally, the parameter information of the detection parameter in this embodiment can be the type of the detection parameter, the value of the detection parameter, or a simulated input of the detection parameter.
[0076] In one embodiment of the present application, the process of performing stain marking on the parameters in step S230 to obtain the marked parameters includes the following steps:
[0077] Based on the function in the code, determine the variable corresponding to the parameter in the code, and generate an identification bit in the variable;
[0078] Get the taint mark and set the value of the flag bit to the taint mark;
[0079] Generate a marking parameter based on the detection parameter and the stain mark corresponding to the identification bit.
[0080] Figure 4 A schematic diagram of stain marking of detection parameters provided in an embodiment of the present application.
[0081] like Figure 4 As shown, in one embodiment of the present application, during the running process of the code, the function operation is realized by assigning values to the functions and their variables in the code, thereby completing the function of the code. In this embodiment, by determining the variable 410 corresponding to the detection parameter in the code, the variable is tainted, and then the function operation and parameter transfer are performed based on the variable carrying the taint mark. Specifically, in this embodiment, a flag 420 is first generated in the variable, and then the value of the flag 420 is set to the taint mark 440, and the value of the variable body 430 is set to the detection parameter 450; finally, the taint mark and the detection parameter are combined to assign a value to the variable, and a marking parameter 460 carrying the taint mark is obtained.
[0082] For example, there are many ways to taint the detection parameters. Taking the hypertext preprocessor PHP language as an example, a flag bit reserved for PHP variables in the PHP7 version is used, and the flag bit is set to a certain value, which is regarded as tainting the variable. In addition, for other development languages, the characteristics of other languages can be used for taint marking.
[0083] In one embodiment of the present application, during the code execution, the taint mark in the mark parameter is transferred in the code. The specific transfer method is to transfer it in sequence in each function of the code, and the order of transfer is consistent with the operation logic or reference relationship between each function in the code.
[0084] Exemplarily, during the operation of the webshell program, the parameter may be passed and calculated multiple times. For example, it is passed as a parameter of a function inside the webshell. For example, $a=$b.$c, or $a=base64($c). In these processes, although we marked the variable $c at the beginning, its value will be passed to other variables during the calculation or function parameter transfer process. In this embodiment, the variable calculation and function transfer process are transformed. Based on the original function function, it is determined whether its parameter has a taint mark. If so, the return result of the function is also marked with a taint mark to complete the propagation of the taint.
[0085] In one embodiment of the present application, the process of passing a taint mark in a function of a code includes the following steps: when passing a taint mark in a function of the code, detecting whether an input parameter of the function carries a taint mark; if the input parameter of the function carries a taint mark, tainting the output parameter of the function so that the output parameter carrying the taint mark can be passed in other functions.
[0086] Figure 5 A schematic diagram of transferring a stain mark provided in an embodiment of the present application.
[0087] like Figure 5 As shown, in one embodiment of the present application, there are at least two functions in the code, such as functions 510, 560, 570 and 580 in the figure. When the taint mark is passed in the function, each variable in the related function is tainted. Specifically, first detect whether the input parameter 520 of the function 510 carries the taint mark 530. If the input parameter 510 of the function carries the taint mark 530, the output parameter 510 of the function is also tainted 550, so that the output parameter carrying the taint mark in the function is used as the input parameter of the next function 570, so as to realize the transfer of the taint mark.
[0088] In addition, for Figure 5In the function 560, if there is no taint mark in the input parameter, then the output parameter is not tainted. In addition, when a function has at least two input parameters, and some of the input parameters have taint marks and some do not, then the output parameter of the function is tainted to prevent the phenomenon of missing marks.
[0089] In step S240, when it is detected by the taint detection function that the parameter of the function carries a taint mark, the function is identified as a vulnerability of the code.
[0090] In one embodiment of the present application, during the transfer of the taint mark, the function will have corresponding parameters passed in, and the input parameters and output parameters of each function may be shared. Therefore, during the execution of a code, the taint mark may be passed to all functions, or may be transmitted to some functions, depending on the specific operation logic between these functions. In this embodiment, by detecting the parameters of a function, the function carrying the taint mark is judged as a vulnerability in the code.
[0091] In addition, when the taint detection function detects that the function parameters do not carry taint marks, it means that the function will not be affected by the taint mark, that is, the function will not be identified as a code vulnerability, and the remaining functions will continue to be detected.
[0092] Figure 6 A schematic diagram of detecting code vulnerabilities provided in an embodiment of the present application.
[0093] like Figure 6 As shown, in the web system 610, the Webshell code 620 based on the PHP programming language is input into the Webshell intrusion detection tool 630; the code is first overwritten and initialized 640 so that the code has the functions of marking and vulnerability detection; then the dynamic incoming parameters are simulated 650, and the taint marking and detection are performed based on the incoming parameters 660 to obtain the detection result 670 with security risks.
[0094] In one embodiment of the present application, Figure 7 As shown, in step S240, when the taint detection function detects that the parameter of the function carries a taint mark, the process of identifying the function as a vulnerability of the code includes steps S2401 to S2402, which are described in detail as follows:
[0095] In step S2401, based on preset function types with potential safety hazards, it is detected whether there is a function with potential safety hazards in the code.
[0096] In one embodiment of the present application, function types with potential safety hazards are preset, and based on these preset function types, functions with potential safety hazards in the code are determined, and based on these functions with potential safety hazards, key potential safety hazard detection is performed.
[0097] In one embodiment of the present application, the function types with security risks include one or at least two of the following functions: command execution function, callback function, code execution function, file reading function, file inclusion function, file writing function, data display function and database injection function.
[0098] Specifically, in one embodiment of the present application, the command execution function may include: system system function, exec program startup function, etc.; the callback function may include: call_user_func user call function, forward_static_call keyword call function, etc.; the code execution function includes: preg_replace regular replacement function, assert run function, etc.; the file reading function may include: file file function, file_get_contents file directory function, etc.; the file inclusion function may include: include inclusion function, require loading run function, etc.; the file writing function may include: file_put_contents directory writing function, fwrite file processing function, etc.; data display may include: printf output function, print_r print variable function, etc.; sql injection related includes: mysqli extension library function, sqlitedatabase database control function, etc.; in the return value acquisition function eval, there are external parameters in the content of code execution, such as:
[0099] eval(gzinflate(base64_decode('U0lUsFVQiXd3DYk2jLUGAA=='))); is used to indicate obtaining the corresponding return value.
[0100] In step S2402, if there is a function with a security risk in the code, it is detected whether the parameters of the function contain a taint mark based on the taint detection function.
[0101] In one embodiment of the present application, since there may be multiple functions in a code, it will take a lot of time and computing power to detect each function. In this embodiment, by first detecting the functions with potential security risks, and then based on the functions with potential security risks, using the stain detection function to specifically detect whether there are stain marks in them, the efficiency of stain detection is improved.
[0102] In one embodiment of the present application, the parameters include incoming parameters; detecting whether the parameters of a function contain a taint mark includes: detecting whether there is an identification bit in the incoming parameters of the function; if there is an identification bit in the incoming parameters, and the value on the identification bit is the same as the taint mark, then determining that the incoming parameters contain a taint mark.
[0103] In one embodiment of the present application, corresponding to the above-mentioned method of adding a taint mark to a variable, when detecting whether there is a taint mark in a parameter of a function, first detect whether there is a flag bit in the transmission parameter of the function. If there is a flag bit in the transmission parameter, detect whether the value on the flag bit is the same as the taint mark; if the value on the flag bit is the same as the taint mark, it is determined that the incoming parameter contains the taint mark. In addition, if there is no flag bit in the incoming parameter, it is determined that the incoming parameter of the function does not contain the taint mark; or, if there is a flag bit in the incoming parameter, but the value in the flag bit is different from the taint mark, it is determined that the incoming parameter does not contain the taint mark.
[0104] It should be noted that the taint detection method for the input parameters in this embodiment can be applied to the taint detection of other parameters in the function, which is only an example.
[0105] In step S2403, if the function parameter contains a taint mark, the function is identified as a code vulnerability.
[0106] In one embodiment of the present application, if the function parameters contain taint marks, it means that the detection parameters and the taint marks have a greater impact on the function and will directly affect the output of the function. In this embodiment, this type of function is regarded as a code vulnerability.
[0107] For example, for the following code written via webshell:
[0108] <?php
[0109] $a=$_GET['call']; / / first line
[0110] $b=$_GET['cmd']; / / Second line
[0111] $c = base64_decode($a); / / The third line
[0112] system($b); / / The fourth line
[0113] eval($c); / / line 5
[0114] ? >
[0115] Assuming that the code has been overwritten and initialized, the processing of each subsequent line of code is as follows:
[0116] The first line: Determine that GET is an entry with potential security risks, assign 'ATTACK' to $a, and mark it using the flag bit reserved by PHP7;
[0117] The second line: Determine that GET is an entry with potential security risks, assign 'ATTACK' to $b, and mark it using the flag bit reserved by PHP7;
[0118] The third line: The original function is to decrypt $a with base64 and assign it to $c. After overwriting initialization, the taint will be propagated and $c will also be tainted;
[0119] Line 4: When encountering a high-risk function (system), check whether its parameters have tainted marks. Since $b has a tainted mark, an alarm is issued.
[0120] Line 5: When encountering a high-risk function (eval), check whether its parameters have tainted marks. Since $c has a tainted mark (propagated from $a), an alarm is issued;
[0121] The detection is completed. Due to the existence of an alarm, the webshell code file is determined to be a file with security risks.
[0122] Figure 8 A flowchart for detecting code vulnerabilities provided in an embodiment of the present application.
[0123] like Figure 8 As shown, in step S810, the actual running environment of the model code dynamically passes in parameters; in step S820, it is determined whether the variable whose parameter value is taken is a sensitive variable, that is, a variable with a security threat; if not, it returns to step 810; if so, in step S830, the reserved mark of the simulated input parameter is set and tainted; in step S840, based on the preset function type with security vulnerabilities, it is detected whether the variable is a sensitive function during the transmission process; if not, in step S850, the taint mark is propagated downward in terms of function function technology; if so, in step S860, it is determined whether the parameter is tainted; if so, in step S870, an alarm is issued and the function is determined to be a function with security risks.
[0124] In one embodiment of the present application, in step S240, during the taint mark transmission process, when the taint detection function detects that the parameter of the function carries the taint mark, after the process of identifying the function as a vulnerability of the code, the process also includes the steps of: identifying the function corresponding to the parameter carrying the taint mark as the target function; obtaining the function name of the target function; and generating security warning information based on the function name.
[0125] Specifically, in this embodiment, after detecting a parameter carrying a tainted mark, the function corresponding to the parameter is identified as the target function, and a security warning message is generated based on the function name of the target function. The management device is notified that the function has a security risk, so that the function can be packaged and maintained to improve the security and reliability of the target function.
[0126] In one embodiment of the present application, after the process of obtaining the function name of the target function, it also includes: determining the target position of the target function in the code based on the function name of the target function; marking the target position and generating a marking code; and generating a vulnerability detection result based on the marking code.
[0127] Specifically, in one embodiment of the present application, after all functions in a code are detected, at least one target function is obtained. In this embodiment, the target position of the target function in the code is determined by searching in the code based on the function name of the target function. The code is marked based on the target position, and a marked code after marking is generated. Finally, a vulnerability detection result is generated based on the marked code.
[0128] In one embodiment of the present application, the objective function may be marked by marking with different colors, or by adding annotations, and so on.
[0129] The following describes an embodiment of the device of the present application, which can be used to execute the method for detecting code vulnerabilities in the above-mentioned embodiment of the present application. It is understandable that the device can be a computer program (including program code) running in a computer device, for example, the device is an application software; the device can be used to execute the corresponding steps in the method provided in the embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method for detecting code vulnerabilities in the above-mentioned embodiment of the present application.
[0130] Fig. 9 A block diagram of a device for detecting code vulnerabilities according to an embodiment of the present application is shown.
[0131] Reference Fig. 9As shown, according to an embodiment of the present application, a device 900 for detecting code vulnerabilities includes: an acquisition unit 910, used to acquire a code to be detected and a detection parameter for detecting the code; an initialization unit 920, used to overwrite and initialize the code to obtain a code with a taint marking function and a taint detection function; a marking unit 930, used to input the detection parameter into the code, and during the function parameter passing process of the code, when the taint marking function detects that the parameter in the code has a security threat, the parameter is tainted to obtain a marked parameter; a detection unit 940, used to identify the function as a vulnerability of the code when the taint detection function detects that the parameter of the function carries a taint mark.
[0132] In some embodiments of the present application, based on the aforementioned scheme, the initialization unit 920 includes: a function detection unit, used to identify the pending functions in the code that need to be overwritten and initialized based on the properties of the functions in the code; and a function adding unit, used to add a taint marking function and a taint detection function to the pending functions to obtain a code with a taint marking function and a taint detection function.
[0133] In some embodiments of the present application, based on the aforementioned scheme, the function detection unit includes: a first detection unit, used to identify a function whose number of strings exceeds a preset number as a string-related function; and a second detection unit, used to identify the string-related function and the function processor in the code as the function to be processed.
[0134] In some embodiments of the present application, based on the aforementioned scheme, the marking unit 930 includes: a detection parameter input unit, used to input the detection parameter into the code to instruct the code to start running; a parameter attribute detection unit, used to detect the attributes of the parameter when the parameter obtained based on the detection parameter is passed into the function of the code; a parameter marking unit, used to mark the parameter based on the attribute of the parameter, if it is detected that the parameter in the code has a security threat, through the taint marking function, to obtain the marked parameter.
[0135] In some embodiments of the present application, based on the aforementioned scheme, the parameter attribute detection unit is used to detect whether the input parameter of the function carries the taint mark during the function parameter passing process of the code; the parameter marking unit is used to determine that the input parameter has a security threat if the input parameter of the function carries the taint mark; through the taint marking function, the output parameter corresponding to the input parameter is tainted to obtain the marked parameter.
[0136] In some embodiments of the present application, based on the aforementioned scheme, the marking unit 930 includes: a first determination unit, used to determine, based on the function in the code, the variable corresponding to the parameter in the code, and generate an identification bit in the variable; a setting unit, used to obtain a taint mark and set the value of the identification bit to the taint mark; and a second marking unit, used to generate the marking parameter based on the parameter and the taint mark corresponding to the identification bit.
[0137] In some embodiments of the present application, based on the aforementioned scheme, the detection unit 910 includes: a second detection unit, used to detect whether there is a function with security risks in the code based on a preset function type with security risks; a third detection unit, used to detect whether the parameters of the function contain taint marks based on the taint detection function if there is a function with security risks in the code; and a third detection unit, used to identify the function as a vulnerability of the code if the parameters of the function contain the taint mark.
[0138] In some embodiments of the present application, based on the aforementioned scheme, the parameters include incoming parameters; the third detection unit includes: a fourth detection unit, used to detect whether there is an identification bit in the incoming parameter of the function; and a fifth detection unit, used to determine that the incoming parameter contains the taint mark if the identification bit exists in the incoming parameter and the value on the identification bit is the same as the taint mark.
[0139] In some embodiments of the present application, based on the aforementioned scheme, the function types with security risks include one or at least two of the following functions: command execution function, callback function, code execution function, file reading function, file inclusion function, file writing function, data display function and database injection function.
[0140] In some embodiments of the present application, based on the aforementioned scheme, the acquisition unit 910 includes: a code acquisition unit, used to acquire the code to be detected; a scenario simulation unit, used to simulate the running scenario of the code and determine the target interface for inputting initial input parameters in the code; and a parameter generation unit, used to acquire the detection parameters corresponding to the running scenario based on the configuration information of the target interface.
[0141] In some embodiments of the present application, based on the aforementioned scheme, the device 900 for detecting code vulnerabilities also includes: a target detection unit, used to identify the function corresponding to the parameter carrying the taint mark as a target function; a name acquisition unit, used to obtain the function name of the target function; and an alarm unit, used to generate security alarm information based on the function name.
[0142] In some embodiments of the present application, based on the aforementioned scheme, the device 900 for detecting code vulnerabilities also includes: a position determination unit, used to determine the target position of the target function in the code based on the function name of the target function; a code marking unit, used to mark the target position and generate a marking code; and a detection result unit, used to generate the vulnerability detection result based on the marking code.
[0143] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0144] It should be noted that Fig.10 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0145] like Fig.10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 to the random access memory (RAM) 1003, such as executing the method described in the above embodiment. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002 and the RAM 1003 are connected to each other through the bus 1004. The input / output (I / O) interface 1005 is also connected to the bus 1004.
[0146] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0147] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1009, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, various functions defined in the system of the present application are executed.
[0148] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0149] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0150] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0151] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0152] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0153] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0154] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0155] Those skilled in the art will readily come up with other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0156] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for detecting code vulnerabilities, characterized in that: include: Obtain the code to be detected, simulate the running scenario of the code, determine the target interface for inputting the initial input parameter in the code, and obtain the string parameter corresponding to the running scenario based on the configuration information of the target interface as the detection parameter for detecting the code, wherein the string parameter is a custom value that is easy to identify or has meaning; Based on the properties of the functions in the code, a function whose number of strings exceeds a preset number is identified as a string-related function, and the string-related function and a function processor in the code are identified as pending functions in the code that need to be overwritten and initialized; Adding a layer of agent on the upper layer of the function to be processed, the agent is used to add a taint marking function and a taint detection function on the basis of entrusting the original function processor to execute the original function, so as to obtain a code with the taint marking function and the taint detection function; Inputting the detection parameter into the code to instruct the code to start running; Based on the parameter information of the detection parameter, when it is determined that the detection parameter is a parameter with a security threat, the detection parameter is tainted by using the taint marking function; During the function parameter transmission process of the code, when the parameter in the code is detected to have a security threat by the taint marking function, the parameter is tainted to obtain a marked parameter; When the taint detection function detects that the parameter of the function carries a taint mark, the function is identified as a vulnerability of the code.
2. The method according to claim 1, characterized in that During the function parameter transmission process of the code, when the parameter in the code is detected to have a security threat by the taint marking function, the parameter is tainted to obtain a marked parameter, including: When a parameter obtained based on the detection parameter is passed into a function of the code, detecting a property of the parameter; Based on the attribute of the parameter, if it is detected that the parameter in the code has a security threat, the parameter is marked by the taint marking function to obtain the marked parameter.
3. The method according to claim 2, characterized in that During the function parameter passing process of the code, detecting the attributes of the parameters in the code includes: During the function parameter passing process of the code, detecting whether the input parameter of the function carries the taint mark; Based on the attribute of the parameter, if it is detected that the parameter in the code has a security threat, the parameter is marked by the taint marking function to obtain the marked parameter, including: If the input parameter of the function carries the tainted mark, it is determined that the input parameter has a security threat; The output parameter corresponding to the input parameter is tainted by the taint marking function to obtain the marked parameter.
4. The method according to claim 1, characterized in that The parameters are tainted to obtain marked parameters, including: Based on the function in the code, determine the variable corresponding to the parameter in the code, and generate an identification bit in the variable; Obtain a taint mark, and set the value of the flag bit to the taint mark; The marking parameter is generated based on the parameter and the stain mark corresponding to the identification bit.
5. The method according to claim 1, characterized in that When the taint detection function detects that the parameter of the function carries a taint mark, identifying the function as a vulnerability of the code includes: Based on the preset function types with potential safety hazards, detecting whether there is a function with potential safety hazards in the code; If there is a function with potential security risks in the code, detecting whether a parameter of the function contains a taint mark based on the taint detection function; If the parameter of the function contains the taint mark, the function is identified as a vulnerability of the code.
6. The method according to claim 5, characterized in that The parameters include incoming parameters; Detecting whether the function's parameters contain taint marks includes: Check whether the parameter passed into the function has a flag bit; If the flag bit exists in the input parameter, and the value of the flag bit is the same as the taint mark, it is determined that the input parameter contains the taint mark.
7. The method according to claim 5, characterized in that The function types with potential security risks include one or at least two of the following functions: command execution function, callback function, code execution function, file reading function, file inclusion function, file writing function, data display function and database injection function.
8. The method according to claim 1, characterized in that When the taint detection function detects that the parameter of the function carries a taint mark, after identifying the function as a vulnerability of the code, the method further includes: Identify the function corresponding to the parameter carrying the taint mark as the target function; Obtaining the function name of the objective function; Generate security warning information based on the function name.
9. The method according to claim 8, characterized in that After obtaining the function name of the target function, it also includes: Based on the function name of the target function, determining a target position of the target function in the code; Marking the target location and generating a marking code; Based on the marking code, a vulnerability detection result is generated.
10. A device for detecting code vulnerabilities, characterized in that: include: an acquisition unit, configured to acquire a code to be detected, simulate a running scenario of the code, determine a target interface for inputting an initial input parameter in the code, and acquire a string parameter corresponding to the running scenario based on configuration information of the target interface, as a detection parameter for detecting the code, wherein the string parameter is a custom value that is easy to identify or has meaning; an initialization unit, for identifying, based on the properties of the functions in the code, a function whose number of strings exceeds a preset number as a string-related function, and identifying the string-related function and the function processor in the code as pending functions in the code that need to be overwritten and initialized, and adding a layer of proxy on the upper layer of the pending function, the proxy being used to add a taint marking function and a taint detection function on the basis of entrusting the original function processor to perform the original function, so as to obtain a code with the taint marking function and the taint detection function; a marking unit, configured to input the detection parameter into the code to instruct the code to start running, and based on parameter information of the detection parameter, when judging that the detection parameter is a parameter with a security threat, marking the detection parameter with a taint mark function, and during the function parameter transmission process of the code, when detecting that the parameter in the code has a security threat, marking the parameter with a taint mark function, to obtain a marked parameter; The detection unit is used to identify the function as a vulnerability of the code when it is detected through the taint detection function that the parameter of the function carries a taint mark.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for detecting code vulnerabilities according to any one of claims 1 to 10 is implemented.
12. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the method for detecting code vulnerabilities as described in any one of claims 1 to 10.
13. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the method for detecting code vulnerabilities according to any one of claims 1 to 10.
