Conditional competition vulnerability detection method and device
By detecting and extracting the target program and executing information, business instructions are built to detect conditional competition vulnerabilities, the problem of low detection efficiency in the existing technology is solved, and efficient vulnerability detection is achieved.
Patent Information
- Application Number
- CN202411195337.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The detection efficiency of conditional competition vulnerabilities in the prior art is low, especially when facing large systems and complex programs, the detection coverage is low and time-consuming.
By receiving the target detection request, the target program is detected, code related to concurrent operations is extracted, business instructions are constructed based on the code information, program operation is controlled and operation information is extracted, and conditional competition vulnerabilities are detected.
Accurate and efficient detection of conditional competition vulnerabilities is achieved, detection efficiency is improved, and vulnerabilities in programs can be exposed in a targeted testing environment.
Smart Images

Figure CN119167368A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and more specifically, to a method and device for detecting a conditional competition vulnerability. Background Art
[0002] With the rapid development of computer technology and the increasing complexity of applications, race conditions have gradually become a common and serious security issue. A race condition vulnerability refers to the situation where two or more threads or processes fail to properly synchronize the order of operations when accessing shared resources, resulting in uncertainty in program behavior and data inconsistency. Race conditions may lead to security issues such as system crashes and data corruption. Therefore, detecting race conditions is crucial to protecting system security. In related technologies, the way to detect race conditions vulnerabilities is usually through manual testing, that is, developers or security experts identify possible race conditions by manually checking the code and testing the application. Although this method can detect vulnerabilities to a certain extent, the detection coverage is low when facing large systems and complex programs, and it takes a lot of time, resulting in low efficiency in detecting race conditions. Summary of the invention
[0003] The embodiments of the present application provide a method and device for detecting a conditional competition vulnerability, so as to at least solve the problem of low detection efficiency of conditional competition vulnerabilities in the related art.
[0004] According to an embodiment of the present application, a method for detecting a conditional competition vulnerability is provided, comprising:
[0005] Receiving a target detection request, wherein the target detection request is used to request detection of a conditional competition vulnerability of a target program;
[0006] In response to the target detection request, the program code of the target program is detected to obtain the target code in the target program, wherein the target code is the code in the target program that is associated with the concurrent operation;
[0007] Constructing a target business instruction for the target program according to the code information of the target code, wherein the code information is used to characterize the operation status of the operation indicated by the target code, and the target business instruction is used to indicate the business handling method of the business to be handled on the target program;
[0008] Controlling the target program to run in accordance with the business handling mode indicated by the target business instruction, and extracting target running information of the target code, wherein the target running information is used to indicate the running timing of the target code during the running of the target program;
[0009] A conditional competition vulnerability in the target program is detected according to the target operation information.
[0010] Optionally, controlling the target program to run according to the business handling method indicated by the target business instruction includes:
[0011] Generating a corresponding target monitoring program for each target code, wherein the target monitoring program is used to monitor the running status of the target code in the target program;
[0012] Inserting the target monitoring program into the position corresponding to the target code in the target program;
[0013] The target program into which the target monitoring program is inserted is run according to the business handling mode indicated by the target business instruction.
[0014] Optionally, generating a corresponding target monitoring program for each target code includes:
[0015] generating a timestamp recording program for detecting the running time of the target code, wherein the timestamp recording program is used to record the running time of the target code;
[0016] In a case where the operation indicated by the target code is an access operation to a shared resource, an operation identification program is generated for the target code, wherein the operation identification program is used to identify the operation indicated by the target code, and the target monitoring program includes the timestamp recording program and the operation identification program.
[0017] Optionally, extracting target operation information of the target code includes:
[0018] Obtaining a target operation identifier output by an operation identifier program, and obtaining a target timestamp output by a timestamp recording program carried in the target program, wherein the operation identifier program is used to identify a shared resource access operation corresponding to the target code, and the timestamp recording program is used to record the running time of the target code;
[0019] Searching for log data corresponding to the target timestamp and the target operation identifier from the operation log of the target program;
[0020] Querying the target shared resource accessed by the shared resource access operation executed by the target code from the log data;
[0021] The target operation identifier, the target timestamp and the target shared resource having a corresponding relationship are constructed as the target operation information.
[0022] Optionally, detecting a conditional competition vulnerability in the target program according to the target running information includes:
[0023] Sorting target operation identifiers corresponding to the plurality of target codes according to a target timestamp to obtain a target identifier sequence, wherein the target timestamp is used to indicate the running time of the target code in the target program, and the target operation identifier is used to identify the operation indicated by the target code to be executed;
[0024] Filtering out a plurality of reference operation identifiers from the target identifier sequence, wherein the difference between the target timestamps corresponding to the plurality of reference operation identifiers is less than or equal to a target threshold;
[0025] determining an operation type of the operation identified by each reference operation identifier;
[0026] In the case where the operations identified by the multiple reference operation identifiers are operations of the same operation type, matching the target shared resource corresponding to each of the multiple reference operation identifiers, wherein the target shared resource is a resource accessed when the operation identified by the reference operation identifier is executed, and the target operation information includes the target operation identifier of the operation indicated by the target code, the target timestamp of the operation of the target code in the target program, and the target shared resource accessed when the operation indicated by the target code is executed;
[0027] When the configurations of the plurality of target shared resources are consistent, it is determined that a conditional competition vulnerability exists between the target codes corresponding to the reference operation identifier in the target program.
[0028] Optionally, constructing a target business instruction for the target program according to the code information of the target code includes:
[0029] Determining the target business type of the business to be handled by the target program and the target number of businesses of each target business type according to the operation type of the execution operation indicated by each target code, wherein the code information includes the operation type of the execution operation indicated by each target code;
[0030] According to the target business type and the target quantity of each target business type, configure the multiple target businesses to be handled by the target program;
[0031] Sorting the plurality of target services according to the target service type to obtain a target service sequence;
[0032] A target service instruction corresponding to the target service sequence is generated, wherein the target service instruction is used to instruct the target program to handle the target service in a service handling order indicated by the target service sequence.
[0033] Optionally, after detecting a conditional competition vulnerability in the target program according to the target running information, the method further includes:
[0034] Acquire a target number of conditional competition vulnerabilities in the target program stored according to the target operation information monitoring;
[0035] Determine the candidate number of services of each target service type corresponding to the target number of vulnerabilities and the target service type from the corresponding relationship among the number of vulnerabilities, the service type and the number of services of each service type;
[0036] According to the target business type and the candidate quantity of each target business type, configure a plurality of candidate businesses to be handled by the target program;
[0037] Sorting the plurality of candidate services according to the target service type to obtain a candidate service sequence;
[0038] A candidate service instruction corresponding to the candidate service sequence is generated, wherein the candidate service instruction is used to instruct the target program to handle the candidate service in a service handling order indicated by the candidate service sequence.
[0039] According to another embodiment of the present application, a detection device for a conditional competition vulnerability is provided, comprising:
[0040] A receiving module, used for receiving a target detection request, wherein the target detection request is used for requesting to detect a conditional competition vulnerability of a target program;
[0041] A response module, used to respond to the target detection request, detect the program code of the target program, and obtain the target code in the target program, wherein the target code is the code in the target program that is associated with the concurrent operation;
[0042] A construction module, used to construct a target business instruction for the target program according to the code information of the target code, wherein the code information is used to characterize the operation status of the operation indicated by the target code, and the target business instruction is used to indicate the business handling method of the business to be handled on the target program;
[0043] A control module, used to control the target program to run in accordance with the business handling mode indicated by the target business instruction, and to extract target running information of the target code, wherein the target running information is used to indicate the running timing of the target code during the running of the target program;
[0044] The detection module is used to detect the conditional competition vulnerability in the target program according to the target operation information.
[0045] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0046] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0047] Through the present application, by detecting the program code in the target program, the target code related to the concurrent operation is extracted from the target program, and then the operation status of the operation performed by the target code is obtained according to the code information of the target code, and then the target business instruction is constructed for the target program according to the code information representing the execution operation status of the target code, so that the business instruction can be constructed for the target program according to the concurrent operation status included in the target program, so that the conditional competition vulnerability in the target program can be effectively exposed, and then the target program is controlled to run according to the business handling method indicated by the target business instruction, and then the operation information of the target code when it is running is extracted in this targeted test environment, and the target operation information indicating the running sequence of the target code during the operation of the target program is obtained, and the conditional competition vulnerability in the target program is detected by the target operation information, so as to accurately and efficiently detect the conditional competition vulnerability existing in the program. Therefore, the problem of low detection efficiency of conditional competition vulnerability in the related art can be solved, and the effect of improving the detection efficiency of conditional competition vulnerability can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a hardware structure block diagram of a server device of a method for detecting a conditional competition vulnerability in an embodiment of the present application;
[0049] Figure 2 It is a flow chart of a method for detecting a conditional competition vulnerability according to an embodiment of the present application;
[0050] Figure 3 It is a flow chart of detecting a conditional competition vulnerability according to an embodiment of the present application;
[0051] Figure 4 It is a structural block diagram of a detection device for conditional competition vulnerability according to an embodiment of the present application. DETAILED DESCRIPTION
[0052] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0053] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0054] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a method for detecting a conditional competition vulnerability in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0055] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the detection method of the conditional competition vulnerability in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0056] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0057] In this embodiment, a method for detecting a conditional competition vulnerability is provided. Figure 2 is a flow chart of a method for detecting a conditional competition vulnerability according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0058] Step S202, receiving a target detection request, wherein the target detection request is used to request detection of a conditional competition vulnerability of a target program;
[0059] Step S204, in response to the target detection request, detecting the program code of the target program to obtain the target code in the target program, wherein the target code is the code in the target program that is associated with the concurrent operation;
[0060] Step S206, constructing a target business instruction for the target program according to the code information of the target code, wherein the code information is used to characterize the operation status of the operation indicated by the target code, and the target business instruction is used to indicate the business handling method of the business to be handled on the target program;
[0061] Step S208, controlling the target program to run in accordance with the business handling mode indicated by the target business instruction, and extracting target running information of the target code, wherein the target running information is used to indicate the running timing of the target code during the running of the target program;
[0062] Step S210: detecting a conditional race vulnerability in the target program according to the target running information.
[0063] Through the above steps, by detecting the program code in the target program, the target code related to the concurrent operation is extracted from the target program, and then the operation status of the operation performed by the target code is obtained according to the code information of the target code, and then the target business instruction is constructed for the target program according to the code information representing the execution operation status of the target code, so that the business instruction can be constructed for the target program according to the concurrent operation status included in the target program, so that the conditional competition vulnerability in the target program can be effectively exposed, and then the target program is controlled to run according to the business handling method indicated by the target business instruction, and then the running information of the target code when running is extracted in this targeted test environment, and the target running information indicating the running sequence of the target code during the running process of the target program is obtained, and the conditional competition vulnerability in the target program is detected through the target running information, so as to accurately and efficiently detect the conditional competition vulnerability existing in the program. Therefore, the problem of low detection efficiency of conditional competition vulnerability in the related technology can be solved, and the effect of improving the detection efficiency of conditional competition vulnerability can be achieved.
[0064] In the embodiment provided in the above step S202, the conditional race vulnerability is a security vulnerability that occurs in a concurrent execution environment.
[0065] In the embodiment provided in the above step S204, the purpose of detecting the program code in the target program is to pre-identify the code that may have concurrent operations from the target program, and then perform targeted detection of conditional competition vulnerabilities that may appear in the concurrent operation code block. The method of detecting the program code in the target program can be: obtaining a concurrent keyword in the target program, wherein the concurrent keyword is used to indicate a keyword in a code block related to concurrent operations in the target program, traversing the program code in the target program according to the concurrent keyword, inserting a start marker code at the starting position of the program code block containing the concurrent keyword, inserting an end marker code at the end position of the program code block containing the concurrent keyword, and determining the program code block between the start marker code and the end marker code as the target code, wherein the start marker code is located before the end marker code. Among them, the method of obtaining concurrent keywords in the target program includes: using static analysis tools to scan the entire code base, analyzing thread creation and management codes, and identifying concurrent code segments that are executed concurrently; analyzing lock operations and semaphore usage, marking possible resource contention point codes; analyzing the access to variables and data structures, and identifying access operation codes for shared resources, wherein the concurrent keywords include the concurrent code segments, the resource contention point codes, and the access operation codes for shared resources. Through the above content, by identifying the concurrent keywords in the code base, all possible codes for storing concurrent operations included in the target program are identified, and then the concurrent keywords in the target program are marked, thereby marking the concurrent operations that may exist in the target program and avoiding omissions in the monitoring of concurrent operations in the target program.
[0066] Optionally, in an embodiment of the present application, concurrent operations are operations performed simultaneously by multiple threads or processes in a target program. Concurrent operations may include, but are not limited to, synchronous business operations and synchronous access operations. Synchronous business operations are used to indicate operations performed simultaneously by multiple threads or processes in a target program. Synchronous business operations may include, but are not limited to, thread creation, lock operations, semaphores, etc.; synchronous access operations are used to indicate synchronous access to shared resources by multiple threads or processes in a target program, where shared resources may include, but are not limited to, code, variables, files, etc., and this solution does not limit this.
[0067] In the embodiment provided in the above step S206, the code information may include, but is not limited to, information used to characterize the operation execution status such as the operation type, the number of operations, the operation logic, etc., and this solution does not limit this.
[0068] Optionally, in an embodiment of the present application, the target business instruction may be, but is not limited to, indicating the business handling type of the target program, the number of businesses of each business type, the concurrent volume of business handling, etc., and this solution does not limit this.
[0069] Optionally, in an embodiment of the present application, since the execution operation indicated by the target code is an operation related to parallel operation, that is, running the target code may cause a conditional competition vulnerability, a test environment can be built for the target program in a targeted manner according to the operation situation indicated by the target code. Therefore, a target business instruction can be constructed for the target program according to the code information of the target code, which is equivalent to building a test environment in which a large number of parallel operations may occur in each program module, thereby enabling the target program to fully expose possible conditional competition vulnerabilities in the program when running according to the target business instructions, thereby improving the coverage of detecting conditional competition vulnerabilities. The method of constructing the target business instructions for the target program according to the code information of the target code can be: the method of randomly constructing the program, and the random construction of the target business instructions for the target program can be: obtaining multiple target business types corresponding to the code information of the current target code, and the target number of businesses required for each of the target business types from the code information, business types and business numbers of the businesses of the business type with corresponding relationships, and randomly screening out a target number of target businesses from a business library of the target business type, wherein the business library is used to store the businesses of the target business type; randomly arranging the target number of target businesses corresponding to each target business type in the multiple target business types to obtain a target business sequence, and then generating a target business instruction corresponding to the target business sequence.
[0070] In the embodiment provided in the above step S208, the purpose of controlling the target program to run in the business handling method indicated by the target business instruction is to enable the target program to fully expose possible conditional competition vulnerabilities in the program in a specific test environment. The target operation information may include but is not limited to the running timing, running times, number of running vulnerabilities, etc. during the running of the target program. This solution does not limit this.
[0071] Optionally, in an embodiment of the present application, the target operation information of the target code can be, but is not limited to, obtained by analyzing the business processing log of the target program in response to the target business instruction to handle the business output, such as identifying the target code in the business processing log, and identifying and analyzing the log data including the target code, thereby obtaining the target operation information indicating the running timing of the target code during the running of the target program. This scheme is not limited to this.
[0072] Optionally, in an embodiment of the present application, the target running information of the target code can also be collected by an running information collection program inserted in the target program. For example, the target code to be found is searched in the target program, and the dynamic insertion tool is called to insert the running information collection program at the corresponding position of the target code in the target program. Then, during the running of the target program, when the target code is called, the running information collection program inserted at the target code position will collect the running information of the target code and output it.
[0073] In the embodiment provided in the above step S210, the method of detecting the conditional competition vulnerability in the target program according to the target operation information can be to use the conditional competition detection algorithm, and the specific method can be: before performing the conditional competition detection, pre-process the collected target operation information, extract the recorded concurrent operations and shared resource access data from the target operation information, eliminate irrelevant information, and only retain the records related to the conditional competition detection; initialize the data structure: use a dictionary to store the access record of each shared resource, the key is the resource ID, and the value is the access record list (including timestamp, thread ID and operation type). Traverse the log records: traverse the sorted log records and process each operation one by one. For each operation, add it to the corresponding access record list according to its resource ID; sort the access record list of each resource according to the timestamp to ensure that the order of the access records is consistent with the actual order; traverse the sorted access records, for each pair of adjacent operations, check their thread IDs, if the two adjacent operations are from different threads or requests, then further check their operation types; if one of the two operations is a write operation, it is determined that there is a conditional competition, and the pair of operations is recorded.
[0074] As an optional embodiment, controlling the target program to run according to the business handling method indicated by the target business instruction includes:
[0075] Generating a corresponding target monitoring program for each target code, wherein the target monitoring program is used to monitor the running status of the target code in the target program;
[0076] Inserting the target monitoring program into the position corresponding to the target code in the target program;
[0077] The target program into which the target monitoring program is inserted is run according to the business handling mode indicated by the target business instruction.
[0078] Optionally, in an embodiment of the present application, the target monitoring program is a program that detects the running status of the target code in the target program. The target monitoring program may include but is not limited to a timestamp recording program, an operation identification program, a business recording program, etc., wherein the timestamp recording program is used to record the running timestamp of the target code, the operation identification program is used for the operations performed by the target code, and the business recording program is used to record the business handled by the target code (such as the resources accessed). This solution does not limit this.
[0079] Optionally, in an embodiment of the present application, the running status of the target code in the target program may include but is not limited to running timing, running times, running business conditions, etc., and this solution does not limit this.
[0080] Optionally, in an embodiment of the present application, generating a target monitoring program for the target code may be: configuring a debugger in the target program to detect the running time of the target code, wherein the debugger is used to calculate the running time of the target code; configuring a monitor to monitor the running status of the target code, wherein the monitor is used to monitor the business involved in the execution operation of the target code and the business processing results of the business handled by the execution operation of the target code, etc. This solution does not limit this.
[0081] Through the above content, by inserting the target monitoring program at the position corresponding to each target code in the target program, it is possible to monitor the running status of the target code in the target program through the target monitoring program during the running of the target program, thereby improving the monitoring efficiency of the running status of the target code in the target program.
[0082] As an optional embodiment, generating a corresponding target monitoring program for each target code includes:
[0083] generating a timestamp recording program for detecting the running time of the target code, wherein the timestamp recording program is used to record the running time of the target code;
[0084] In a case where the operation indicated by the target code is an access operation to a shared resource, an operation identification program is generated for the target code, wherein the operation identification program is used to identify the operation indicated by the target code, and the target monitoring program includes the timestamp recording program and the operation identification program.
[0085] Optionally, in an embodiment of the present application, the purpose of recording the running time of the target code is to detect whether the execution operation of the target code will occur at the same time. If the running time of the target code is the same, it may be a parallel operation, resulting in a conditional competition vulnerability. The running time of the target code can be recorded by: setting breakpoints at the beginning and end positions of the target code block; running the program, when the program stops at the first breakpoint, recording the current time t1; continuing to run the program until it stops at the second breakpoint, and recording the current time t2 again; calculating the execution time of the target code block: t2-t1.
[0086] Optionally, in an embodiment of the present application, the purpose of generating an operation identification program for the target code is to identify a code segment in the target code whose operation type is accessing a shared resource. The specific method may be: obtaining an operation identification word generated by the operation identification program, wherein the operation identification word is used to indicate an identification word in the target code that indicates an operation of accessing a shared resource; traversing the target code to match a reference code segment containing the operation identification word, wherein the reference code segment is used to indicate that the target code executes an operation of accessing a shared resource; inserting a thread ID recording code before and after the reference code segment, wherein the thread ID recording code is used to record an execution operation ID of the reference code segment, and the execution operation ID is used to distinguish access operations of different requests.
[0087] In the above manner, by generating a timestamp recording program and an operation identification program for the target code, the running time of the target code and the operation type indicated by the target code can be obtained. Therefore, it is possible to judge whether there are operations executed simultaneously in the target program according to the running time of the target code, and to judge whether there are operations to access shared resources according to the operation type indicated by the target code, thereby improving the accuracy of identifying parallel operations.
[0088] As an optional embodiment, the extracting target operation information of the target code includes:
[0089] Obtaining a target operation identifier output by an operation identifier program, and obtaining a target timestamp output by a timestamp recording program carried in the target program, wherein the operation identifier program is used to identify a shared resource access operation corresponding to the target code, and the timestamp recording program is used to record the running time of the target code;
[0090] Searching for log data corresponding to the target timestamp and the target operation identifier from the operation log of the target program;
[0091] Querying the target shared resource accessed by the shared resource access operation executed by the target code from the log data;
[0092] The target operation identifier, the target timestamp and the target shared resource having a corresponding relationship are constructed as the target operation information.
[0093] Optionally, in an embodiment of the present application, the target operation identifier is used to indicate that the type of operation executed by the target code is access to shared resources. The target operation identifier can be but is not limited to identifying the resource type, resource quantity, etc. of the shared resources accessed by the target code execution. This solution does not limit this.
[0094] Optionally, in an embodiment of the present application, the running time of the target code may include but is not limited to the time point when the target code starts running, the time point when the target code ends running, and the length of the time period during which the target code runs, and this solution does not limit this.
[0095] Optionally, in an embodiment of the present application, the operation log of the target program is used to record the operation information during the program running process. The operation log may include but is not limited to the timestamp of the code running, log level, program or module identification, user information, exception and error information, etc. This solution does not limit this.
[0096] Optionally, in an embodiment of the present application, the log data corresponding to the target timestamp in the operation log may include but is not limited to the thread ID, operation ID, request ID, etc. corresponding to each timestamp; the log data corresponding to the target operation identifier in the operation log may include but is not limited to the access type, number of accesses, access frequency, etc. of the target shared resources executed by the target code; the target shared resources may include but are not limited to the resource type and quantity of shared resources, etc.; this solution does not impose any restrictions on this.
[0097] Through the above content, by inserting an operation identification program and a timestamp recording program into the target code of the target program, it is possible to output the target operation identification of the shared resource access operation corresponding to the target code and the target timestamp representing the running time of the target code during the running of the target program. Then, the target shared resource accessed by the shared resource access operation to be executed by the target code can be found in the log data according to the target timestamp and the target operation identification, thereby improving the efficiency of collecting target running information and avoiding the complex operation of directly performing keyword analysis on the log data in the related technology.
[0098] As an optional embodiment, detecting a conditional competition vulnerability in the target program according to the target running information includes:
[0099] Sorting target operation identifiers corresponding to the plurality of target codes according to a target timestamp to obtain a target identifier sequence, wherein the target timestamp is used to indicate the running time of the target code in the target program, and the target operation identifier is used to identify the operation indicated by the target code to be executed;
[0100] Filtering out a plurality of reference operation identifiers from the target identifier sequence, wherein the difference between the target timestamps corresponding to the plurality of reference operation identifiers is less than or equal to a target threshold;
[0101] determining an operation type of the operation identified by each reference operation identifier;
[0102] In the case where the operations identified by the multiple reference operation identifiers are operations of the same operation type, matching the target shared resource corresponding to each of the multiple reference operation identifiers, wherein the target shared resource is a resource accessed when the operation identified by the reference operation identifier is executed, and the target operation information includes the target operation identifier of the operation indicated by the target code, the target timestamp of the operation of the target code in the target program, and the target shared resource accessed when the operation indicated by the target code is executed;
[0103] When the configurations of the plurality of target shared resources are consistent, it is determined that a conditional competition vulnerability exists between the target codes corresponding to the reference operation identifier in the target program.
[0104] Optionally, in an embodiment of the present application, sorting target operation identifiers corresponding to multiple target codes according to the target timestamp can be: converting the target timestamp into a directly comparable numerical type to obtain a reference timestamp; creating a data set corresponding to the reference timestamp and the target operation identifier, and passing the data set as input to a sorting function (such as the sorted() function in Python); specifying a key parameter, which is a function for extracting a timestamp for comparison from each data element, and if the timestamp has been processed (such as converted to a datetime object), the function should return the processed timestamp; executing the sorting algorithm to sort the data elements according to the timestamp value returned by the key function.
[0105] Optionally, in an embodiment of the present application, the purpose of matching the target shared resource corresponding to each reference operation identifier in multiple reference operation identifiers is to determine whether the operation type of the operation indicated by multiple target codes is to access the same shared resource. If the operation type of the operation indicated by multiple target codes is to access the same shared resource, it is determined that there is a conditional competition vulnerability between the target codes corresponding to the reference operation identifier in the target program.
[0106] Through the above content, by analyzing the running time indicated by the timestamp and matching the target shared resources corresponding to each reference operation identifier in multiple reference operation identifiers, it is possible to avoid judging different operations in the same time and the same operation at different times as conditional competition vulnerabilities, thereby improving the accuracy of conditional competition vulnerability detection.
[0107] As an optional embodiment, constructing a target business instruction for the target program according to the code information of the target code includes:
[0108] Determining the target business type of the business to be handled by the target program and the target number of businesses of each target business type according to the operation type of the execution operation indicated by each target code, wherein the code information includes the operation type of the execution operation indicated by each target code;
[0109] According to the target business type and the target quantity of each target business type, configure the multiple target businesses to be handled by the target program;
[0110] Sorting the plurality of target services according to the target service type to obtain a target service sequence;
[0111] A target service instruction corresponding to the target service sequence is generated, wherein the target service instruction is used to instruct the target program to handle the target service in a service handling order indicated by the target service sequence.
[0112] Optionally, in an embodiment of the present application, the target business type of the business to be processed by the target program can be determined from a mapping table with corresponding target codes indicating the execution operation type and the business type to be processed, and the target number of businesses of each target business type can be determined from a mapping table with corresponding business types and business quantities. This scheme does not limit this.
[0113] Optionally, in an embodiment of the present application, a method for configuring multiple target businesses for a target program may be to create a to-be-done business template for the target program, add the target business type and target business quantity of the to-be-done business of the target program to the to-be-done business template deployed in the target program, and generate a target configuration process for the target program based on the to-be-done business template, wherein the target configuration process is used to indicate the configuration of the target business for the target program according to the to-be-done business template.
[0114] Optionally, in an embodiment of the present application, sorting multiple target businesses according to target business types can be: determining a target priority corresponding to the target business type for performing operations indicated by the target code from business types and priorities with corresponding relationships, wherein the target priority is used to indicate the order in which the operations indicated by the current target code are run in the target program.
[0115] Through the above content, by determining the target business type that the target program needs to handle and the target quantity required for each business type according to the operation type of the operation indicated by the target code, it is possible to classify the business to be handled by the target program according to the operation type of the concurrent operation involved, and then sort multiple target businesses according to the business type to obtain a target business sequence, and then expose as many conditional competition vulnerabilities in the target program as possible by handling the business in the business handling order indicated by the target business sequence.
[0116] As an optional embodiment, after detecting a conditional competition vulnerability in the target program according to the target running information, the method further includes:
[0117] Acquire a target number of conditional competition vulnerabilities in the target program stored according to the target operation information monitoring;
[0118] Determine the candidate number of services of each target service type corresponding to the target number of vulnerabilities and the target service type from the corresponding relationship among the number of vulnerabilities, the service type and the number of services of each service type;
[0119] According to the target business type and the candidate quantity of each target business type, configure a plurality of candidate businesses to be handled by the target program;
[0120] Sorting the plurality of candidate services according to the target service type to obtain a candidate service sequence;
[0121] A candidate service instruction corresponding to the candidate service sequence is generated, wherein the candidate service instruction is used to instruct the target program to handle the candidate service in a service handling order indicated by the candidate service sequence.
[0122] Optionally, in an embodiment of the present application, after a conditional competition vulnerability is detected, the business volume configured by the target code in the program can be optimized according to the detection result. The specific method can be: using the number of vulnerabilities, business types and the number of businesses of each business type with corresponding relationships as multiple groups of input values, randomly generating training sets and test sets, and performing data normalization on the input data, and then constructing a neural network model, setting appropriate training parameters (such as learning rate, maximum number of training times, etc.) for model training, and after outputting the final result, selecting the type and number of candidate businesses corresponding to the predicted value with the smallest number of vulnerabilities, and then configuring the corresponding business operations for the target program according to the predicted optimal candidate business information.
[0123] Optionally, in an embodiment of the present application, a lock mechanism, such as a mutex lock or a read-write lock, can be created for the target program based on the specific location information of each vulnerability, such as the code line number, operation type, and thread ID, to ensure the correct access order of concurrent operations and shared resources. The execution order of the code can also be reconstructed based on the timestamp to reduce conflicts in concurrent operations and shared resource access.
[0124] Through the above content, by obtaining the number of conditional competition vulnerabilities detected by running the target program according to the target business instructions, and then optimizing the number of business candidates for each target business type according to the number of detected conditional competition vulnerabilities, it is possible to optimize the business instructions according to the conditional competition vulnerability detection results, so that after the program runs according to the business instructions, the conditional competition vulnerabilities in the target program are exposed as much as possible, thereby improving the detection efficiency of the conditional competition vulnerabilities of the target program and shortening the time required for testing the program for conditional competition vulnerabilities.
[0125] Figure 3 is a flow chart of detecting a conditional competition vulnerability according to an embodiment of the present application, such as Figure 3 As shown in the figure, the specific process of detecting conditional competition vulnerabilities is as follows:
[0126] (1) Static analysis:
[0127] The specific process of the static analysis phase is as follows:
[0128] 1. Use static analysis tools to scan the entire code base and identify all possible concurrent operations (such as thread creation, lock operations, semaphores, etc.) and access operations to shared resources.
[0129] 2. Analyze thread creation and management code to identify concurrently executed code segments.
[0130] 3. Analyze lock operations and semaphore usage, and mark possible resource contention points.
[0131] 4. Analyze access to variables and data structures, and identify access operations to shared resources.
[0132] (2) Dynamic instrumentation:
[0133] The specific process of the dynamic instrumentation stage is as follows:
[0134] 1. Insert timestamp recording code before and after each concurrent operation (such as thread creation, lock acquisition and release) to accurately record the time when the operation occurred.
[0135] 2. Insert thread ID or request ID recording code before and after the code segment that accesses shared resources, record the ID of the current operation, and ensure that access operations of different threads or requests can be distinguished.
[0136] 3. Compile and build the instrumented code to ensure that detailed log information can be generated at runtime.
[0137] (3) Execution monitoring:
[0138] The specific process of executing the monitoring phase is as follows:
[0139] 1. Set up the test environment to ensure that typical user operations and concurrent requests can be simulated.
[0140] 2. Run the instrumented application to simulate user operations and concurrent requests, covering all possible concurrent operations and shared resource access paths.
[0141] 3. Dynamically monitor the running process of the application and record the timestamp, thread ID and operation type (read or write) of each concurrent operation and shared resource access.
[0142] 4. Store the generated log data in a log file or database for subsequent analysis.
[0143] (4) Data collection and processing:
[0144] The specific process of data collection and processing is as follows:
[0145] 1. Data extraction: Extract recorded concurrent operations and shared resource access data from log files or databases, mainly including timestamp, thread ID (or request ID), and operation type (read or write).
[0146] 2. Data filtering: Eliminate irrelevant information and only keep records related to conditional competition detection.
[0147] 3. Data sorting: Sort the records by timestamp to ensure that operations can be processed in chronological order during analysis.
[0148] (5) Conditional competition detection algorithm:
[0149] The race condition detection algorithm analyzes the collected log data based on timestamps and thread IDs to identify and report race condition vulnerabilities. The following are the specific implementation steps and details:
[0150] 1. Data preprocessing: Before performing conditional competition detection, the collected log data needs to be preprocessed to facilitate subsequent analysis.
[0151] 2. Conditional competition detection algorithm: The conditional competition detection algorithm analyzes the preprocessed log data to identify whether there is a conditional competition vulnerability. The main steps are as follows: Initialize the data structure: Use a dictionary to store the access record of each shared resource, the key is the resource ID, and the value is the access record list (including timestamp, thread ID and operation type).
[0152] Traverse the log records: Traverse the sorted log records and process each operation one by one. For each operation, add it to the corresponding access record list according to its resource ID.
[0153] Analyze access records: Sort access records: Sort the access record list of each resource by timestamp to ensure that the order of access records is consistent with the actual order; Check interleaved access: Traverse the sorted access records, and for each pair of adjacent operations, check their thread IDs. If the two adjacent operations come from different threads or requests, further check their operation types. If one of the two operations is a write operation, it is determined that there is a conditional competition. Record the pair of operations.
[0154] 3. Report detection results: Record the detected conditional competition vulnerabilities, including detailed operation information (timestamp, thread ID, operation type and resource ID).
[0155] (6) Result report and repair suggestions:
[0156] The specific process of the result report and repair suggestion stage is as follows:
[0157] 1. Generate a test result report, which includes:
[0158] Details of all detected race conditions.
[0159] Specific location information for each vulnerability, such as line number, operation type, and thread ID.
[0160] 2. Propose repair suggestions:
[0161] Use locking mechanisms or other synchronization control methods to ensure the correct order of access to concurrent operations and shared resources.
[0162] Refactor code to reduce conflicts in concurrent operations and access to shared resources.
[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0164] In this embodiment, a detection device for a conditional competition vulnerability is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0165] Figure 4 is a structural block diagram of a detection device for a conditional competition vulnerability according to an embodiment of the present application, such as Figure 4 As shown, the device includes: a receiving module, which is used to receive a target detection request, wherein the target detection request is used to request the detection of a conditional competition vulnerability of a target program; a response module, which is used to respond to the target detection request, detect the program code of the target program, and obtain the target code in the target program, wherein the target code is the code in the target program that has an associated relationship with concurrent operations; a construction module, which is used to construct a target business instruction for the target program according to the code information of the target code, wherein the code information is used to characterize the operation status of the operation indicated by the target code, and the target business instruction is used to indicate the business handling method of the business to be handled on the target program; a control module, which is used to control the target program to run in accordance with the business handling method indicated by the target business instruction, and extract the target operation information of the target code, wherein the target operation information is used to indicate the running sequence of the target code during the operation of the target program; a detection module, which is used to detect the conditional competition vulnerability in the target program according to the target operation information.
[0166] Through the above content, through this application, by detecting the program code in the target program, the target code related to the concurrent operation is extracted from the target program, and then the operation status of the operation performed by the target code is obtained according to the code information of the target code, and then the target business instruction is constructed for the target program according to the code information representing the execution operation status of the target code, so that the business instruction can be constructed for the target program according to the concurrent operation status included in the target program, so that the conditional competition vulnerability in the target program can be effectively exposed, and then the target program is controlled to run according to the business handling method indicated by the target business instruction, and then the running information of the target code when running is extracted in this targeted test environment, and the target running information indicating the running sequence of the target code during the running process of the target program is obtained, and the conditional competition vulnerability in the target program is detected through the target running information, so as to accurately and efficiently detect the conditional competition vulnerability existing in the program. Therefore, the problem of low detection efficiency of conditional competition vulnerability in the related technology can be solved, and the effect of improving the detection efficiency of conditional competition vulnerability can be achieved.
[0167] Optionally, the control module includes:
[0168] A first generating unit, configured to generate a corresponding target monitoring program for each target code, wherein the target monitoring program is configured to monitor the running state of the target code in the target program;
[0169] An inserting unit, used for inserting the target monitoring program into the position corresponding to the target code in the target program;
[0170] An operating unit is used to operate the target program into which the target monitoring program is inserted according to the business handling mode indicated by the target business instruction.
[0171] Optionally, the first generating unit is further used to:
[0172] generating a timestamp recording program for detecting the running time of the target code, wherein the timestamp recording program is used to record the running time of the target code;
[0173] In a case where the operation indicated by the target code is an access operation to a shared resource, an operation identification program is generated for the target code, wherein the operation identification program is used to identify the operation indicated by the target code, and the target monitoring program includes the timestamp recording program and the operation identification program.
[0174] Optionally, the control module further includes:
[0175] an acquisition unit, configured to acquire a target operation identifier output by an operation identifier program, and to acquire a target timestamp output by a timestamp recording program carried in the target program, wherein the operation identifier program is used to identify a shared resource access operation corresponding to the target code, and the timestamp recording program is used to record the running time of the target code;
[0176] A search unit, configured to search the operation log of the target program for log data corresponding to the target timestamp and the target operation identifier;
[0177] A query unit, used for querying the target shared resource accessed by the shared resource access operation executed by the target code from the log data;
[0178] The construction unit is used to construct the target operation identifier, the target timestamp and the target shared resource that have a corresponding relationship into the target operation information.
[0179] Optionally, the detection module includes:
[0180] A first sorting unit is used to sort the target operation identifiers corresponding to the plurality of target codes according to a target timestamp to obtain a target identifier sequence, wherein the target timestamp is used to indicate the running time of the target code in the target program, and the target operation identifier is used to identify the operation indicated by the target code to be executed;
[0181] A screening unit, configured to screen out a plurality of reference operation identifiers from the target identifier sequence, wherein the difference between the target timestamps corresponding to the plurality of reference operation identifiers is less than or equal to a target threshold;
[0182] A first determining unit, configured to determine an operation type of the operation identified by each reference operation identifier;
[0183] a matching unit, configured to match a target shared resource corresponding to each of the reference operation identifiers in a case where the operations identified by the multiple reference operation identifiers are operations of the same operation type, wherein the target shared resource is a resource accessed when the operation identified by the reference operation identifier is executed, and the target operation information includes the target operation identifier of the operation indicated by the target code, the target timestamp of the operation of the target code in the target program, and the target shared resource accessed when the operation indicated by the target code is executed;
[0184] The second determining unit is used to determine whether a conditional competition vulnerability exists between the target codes corresponding to the reference operation identifier in the target program when the configurations of the plurality of target shared resources are consistent.
[0185] Optionally, the building block includes:
[0186] A third determining unit is used to determine the target business type of the business to be handled by the target program and the target number of businesses of each target business type according to the operation type of the operation to be performed indicated by each target code, wherein the code information includes the operation type of the operation to be performed indicated by each target code;
[0187] A configuration unit, configured to configure a plurality of target services to be handled by the target program according to the target service type and the target quantity of each target service type;
[0188] A second sorting unit, configured to sort the plurality of target services according to the target service type to obtain a target service sequence;
[0189] The second generating unit is used to generate a target business instruction corresponding to the target business sequence, wherein the target business instruction is used to instruct the target program to handle the target business in a business handling order indicated by the target business sequence.
[0190] Optionally, the device further comprises:
[0191] An acquisition module, configured to acquire a target vulnerability number of conditional competition vulnerabilities in the target program monitored and stored according to the target operation information after detecting the conditional competition vulnerabilities in the target program according to the target operation information;
[0192] A determination module, configured to determine the candidate number of services of each target service type corresponding to the target number of vulnerabilities and the target service type from the corresponding relationship among the number of vulnerabilities, the service type and the number of services of each service type;
[0193] A configuration module, configured to configure a plurality of candidate services to be handled by the target program according to the target service type and the candidate quantity of each target service type;
[0194] A sorting module, used to sort the plurality of candidate services according to the target service type to obtain a candidate service sequence;
[0195] A generation module is used to generate candidate business instructions corresponding to the candidate business sequence, wherein the candidate business instructions are used to instruct the target program to handle the candidate business in the business handling order indicated by the candidate business sequence.
[0196] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0197] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0198] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0199] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0200] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0201] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0202] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0203] The embodiments of the present application also provide a computer program, which includes computer instructions, which are 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 performs the steps in any one of the above method embodiments.
[0204] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0205] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0206] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for detecting a conditional competition vulnerability, characterized in that: include: Receiving a target detection request, wherein the target detection request is used to request detection of a conditional competition vulnerability of a target program; In response to the target detection request, the program code of the target program is detected to obtain the target code in the target program, wherein the target code is the code in the target program that is associated with the concurrent operation; a target business instruction is constructed for the target program according to the code information of the target code, wherein the code information is used to characterize the operation status of the operation indicated by the target code, and the target business instruction is used to indicate the business handling method of the business to be handled on the target program; Controlling the target program to run in accordance with the business handling mode indicated by the target business instruction, and extracting target running information of the target code, wherein the target running information is used to indicate the running timing of the target code during the running of the target program; A conditional competition vulnerability in the target program is detected according to the target operation information.
2. The method according to claim 1, characterized in that The controlling the target program to run according to the business handling method indicated by the target business instruction includes: Generating a corresponding target monitoring program for each target code, wherein the target monitoring program is used to monitor the running status of the target code in the target program; Inserting the target monitoring program into the position corresponding to the target code in the target program; The target program into which the target monitoring program is inserted is run according to the business handling mode indicated by the target business instruction.
3. The method according to claim 2, characterized in that The generating a corresponding target monitoring program for each target code comprises: generating a timestamp recording program for detecting the running time of the target code, wherein the timestamp recording program is used to record the running time of the target code; In a case where the operation indicated by the target code is an access operation to a shared resource, an operation identification program is generated for the target code, wherein the operation identification program is used to identify the operation indicated by the target code, and the target monitoring program includes the timestamp recording program and the operation identification program.
4. The method according to claim 1, characterized in that: The step of extracting target operation information of the target code includes: Obtaining a target operation identifier output by an operation identifier program, and obtaining a target timestamp output by a timestamp recording program carried in the target program, wherein the operation identifier program is used to identify a shared resource access operation corresponding to the target code, and the timestamp recording program is used to record the running time of the target code; Searching for log data corresponding to the target timestamp and the target operation identifier from the running log of the target program; Querying the target shared resource accessed by the shared resource access operation executed by the target code from the log data; The target operation identifier, the target timestamp and the target shared resource having a corresponding relationship are constructed as the target operation information.
5. The method according to claim 1, characterized in that The detecting a conditional competition vulnerability in the target program according to the target operation information includes: Sorting target operation identifiers corresponding to the plurality of target codes according to a target timestamp to obtain a target identifier sequence, wherein the target timestamp is used to indicate the running time of the target code in the target program, and the target operation identifier is used to identify the operation indicated by the target code to be executed; Filtering out a plurality of reference operation identifiers from the target identifier sequence, wherein the difference between the target timestamps corresponding to the plurality of reference operation identifiers is less than or equal to a target threshold; determining an operation type of the operation identified by each reference operation identifier; In the case where the operations identified by the multiple reference operation identifiers are operations of the same operation type, matching the target shared resource corresponding to each of the multiple reference operation identifiers, wherein the target shared resource is a resource accessed when the operation identified by the reference operation identifier is executed, and the target operation information includes the target operation identifier of the operation indicated by the target code, the target timestamp of the operation of the target code in the target program, and the target shared resource accessed when the operation indicated by the target code is executed; When the configurations of the plurality of target shared resources are consistent, it is determined that a conditional competition vulnerability exists between the target codes corresponding to the reference operation identifier in the target program.
6. The method according to claim 1, characterized in that The step of constructing a target business instruction for the target program according to the code information of the target code includes: Determining the target business type of the business to be handled by the target program and the target number of businesses of each target business type according to the operation type of the execution operation indicated by each target code, wherein the code information includes the operation type of the execution operation indicated by each target code; According to the target business type and the target quantity of each target business type, configure the multiple target businesses to be handled by the target program; Sorting the plurality of target services according to the target service type to obtain a target service sequence; A target service instruction corresponding to the target service sequence is generated, wherein the target service instruction is used to instruct the target program to handle the target service in a service handling order indicated by the target service sequence.
7. The method according to claim 6, characterized in that After detecting a conditional competition vulnerability in the target program according to the target running information, the method further includes: Acquire a target number of conditional competition vulnerabilities in the target program stored according to the target operation information monitoring; Determine the candidate number of services of each target service type corresponding to the target number of vulnerabilities and the target service type from the corresponding relationship among the number of vulnerabilities, the service type and the number of services of each service type; According to the target business type and the candidate quantity of each target business type, configure a plurality of candidate businesses to be handled by the target program; Sorting the plurality of candidate services according to the target service type to obtain a candidate service sequence; A candidate service instruction corresponding to the candidate service sequence is generated, wherein the candidate service instruction is used to instruct the target program to handle the candidate service in a service handling order indicated by the candidate service sequence.
8. A detection device for a conditional competition vulnerability, characterized in that: include: A receiving module, used for receiving a target detection request, wherein the target detection request is used for requesting to detect a conditional competition vulnerability of a target program; A response module, used to respond to the target detection request, detect the program code of the target program, and obtain the target code in the target program, wherein the target code is the code in the target program that is associated with the concurrent operation; A construction module, used to construct a target business instruction for the target program according to the code information of the target code, wherein the code information is used to characterize the operation status of the operation indicated by the target code, and the target business instruction is used to indicate the business handling method of the business to be handled on the target program; A control module, used to control the target program to run in accordance with the business handling mode indicated by the target business instruction, and to extract target running information of the target code, wherein the target running information is used to indicate the running timing of the target code during the running of the target program; The detection module is used to detect the conditional competition vulnerability in the target program according to the target operation information.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Logic vulnerability detection method and device, equipment and storage medium
CN116108453A
LLM-driven industrial network intrusion detection method and response system
CN118381627A
System management states
WO2022015494A1
