SAC-based red team network attack automation method, system and equipment
By modeling red team testing as a Markov decision model and using the SAC algorithm, the automation of red team testing is realized, solving the problems of high cost, poor adaptability and low efficiency of existing red team testing methods, and improving network security evaluation performance and efficiency.
Patent Information
- Application Number
- CN202410596744.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-05-14
AI Technical Summary
Existing red team testing methods have problems such as high cost, poor adaptability, and low efficiency. Especially when facing complex systems, they require a large amount of manual attack plan design, which increases the difficulty.
The red team test problem is modeled as a Markov decision-making model, and the SAC algorithm based on reinforcement learning is used. By constructing the state space, action space and reward function, an automated testing method is designed and implemented using the Actor network, V critic network and Q critic network. Automated red team testing.
The automation and intelligence of red team testing is realized through reinforcement learning algorithms, which reduces testing costs, improves testing performance and efficiency, increases the success rate of automated attack strategies, and provides new technical solutions for network security evaluation.
Smart Images

Figure CN118432910B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security assessment, and in particular to a SAC-based red team network attack automation method, system and device. Background Art
[0002] Red team testing refers to a method of conducting network security assessments in network systems by simulating real hacker attack behaviors. Currently, red team testing mostly uses manual testing methods. On the one hand, manual testing methods have the problem of high labor costs, and the different professional knowledge levels of testers will also affect the test results. On the other hand, when manual testing faces highly complex and different tested systems, it takes a lot of time to design different attack plans, which increases the difficulty of conducting red team testing. Therefore, manual testing methods have the problems of high cost and poor adaptability.
[0003] In view of the above problems, the intelligence and automation of red team testing have become the main solutions. This paper models the red team testing problem as a Markov decision model, designs a testing method based on the reinforcement learning SAC algorithm, realizes the automation of the testing process, can effectively reduce the testing cost, and improve the testing performance and efficiency of network security assessment. Summary of the invention
[0004] The present invention provides a SAC-based red team network attack automation method, system and device to solve the problems of high cost, poor adaptability and low efficiency of manual testing methods.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides a SAC-based red team network attack automation method, comprising the following steps:
[0007] S1. Construct the state space according to the process of the test agent;
[0008] S2. Based on the ATT&CK platform, the attack techniques that the test agent can perform are concretized into attack instructions to build an action space;
[0009] S3. Describe the state transition relationship of the host under test, construct a state transition function, and design a corresponding reward function;
[0010] S4. Through training, automated red team testing can be completed using reinforcement learning.
[0011] In a specific implementation manner, the specific process of S3 is as follows:
[0012] Taking the theft of sensitive information commonly seen in red team testing as the application background, and the real state of the test agent as the state,
[0013] According to the actions taken, the change process of the state corresponding to different actions is obtained:
[0014] (1) After taking the action of creating the cache directory a1, the state changes to obtaining the directory path s2 where the sensitive information is located;
[0015] (2) Taking the action of finding sensitive information a2, the state is transferred from whether to obtain sensitive information s1 to obtaining information path s3;
[0016] (3) Taking action a3 to temporarily store sensitive information requires knowing the directory path s2 and information path s3;
[0017] (4) An action is taken to compress the temporary directory a4, and the state is transferred from the directory path s2 to the compressed path s4;
[0018] (5) Taking action a5 to extract sensitive information requires knowing the compression path s4;
[0019] Reward function based on the state: the reward value R is set to R=20 only when sensitive information is stolen, that is, the action described in (5). For other action-state transitions, it is set to R=-1 as the cost of executing the action;
[0020] If the selected action cannot be performed under the current state, that is, if action a3 is performed without the states s2 and s3 in (3), a penalty of R = -20 is imposed.
[0021] In a specific implementation, the SAC algorithm includes 1 Actor network, 2 V critic networks, and 2 Q critic networks.
[0022] In a specific implementation, the network structure of the Q critic network is a three-layer fully connected neural network, and the loss function of the Q critic network is The design is calculated as follows:
[0023] ,
[0024] in, Represents the norm of all training data in a batch, Indicates value, Indicates that the parameter is The network estimates the value of the action-state pair, j represents the number of the two Q critic networks, ranging from 0 to 1, represents the state at time t, represents the action at time t, represents the state at time t+1, represents the reward at time t+1, Represents the state calculated based on the optimal Bellman equation The true value estimate is calculated as:
[0025] ,
[0026] in, V represents the value of the state obtained by the critic network, represents the reward at time t, A coefficient that represents the value of the state.
[0027] In a specific implementation, the network structure of the V critic network is a three-layer fully connected neural network, and the loss function of the V critic network is Designed for:
[0028] ,
[0029] in, To indicate that the parameter is The network gets the value of the state, are the parameters of the V critic network, is the true value output by the V critic network and is calculated as follows:
[0030] ,
[0031] in, is entropy, is the entropy bonus coefficient, Yes Status The corresponding action space is All possible actions predicted by the Actor network, represents the probability distribution of the action predicted by the Actor network, are the parameters of the Actor network, It means that when j is 0 or 1, the function takes the minimum value.
[0032] In a specific implementation, the network structure of the Actor network is a three-layer fully connected neural network, and the loss function of the Actor network is Designed for: ,
[0033] in, All possible actions predicted by the Actor network, Represents the norm of all training data in a batch, Express Take expectations, is the entropy bonus coefficient, Indicates that the predicted action conforms to the probability distribution predicted by the Actor network. Indicates value, express Taken under the state The value of the Q network output during action, are network parameters.
[0034] In a second aspect, the present invention provides a SAC-based red team network attack automation system, including a processing instruction module for executing each step in the SAC-based red team network attack automation method.
[0035] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the SAC-based red team network attack automation method.
[0036] The beneficial effects of the present invention are:
[0037] By continuously testing and implementing attack strategies through reinforcement learning algorithms, the automation and intelligence of red team testing in network security assessment is achieved, which solves the problems of high cost and poor adaptability of manual red team testing methods. The SAC algorithm is used to transform the fixed strategies in the existing algorithms into random strategies, explores strategies for more possible attack action combinations, and improves the success rate of automated attack strategies, providing a new technical solution for network security assessment. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] By reading the detailed description of the preferred embodiment below, the scheme and advantages of the present application will become clear to those skilled in the art. The accompanying drawings are only for the purpose of illustrating the preferred embodiment and are not to be considered as limiting the present invention.
[0039] Figure 1 It is a structural schematic diagram of the method in the present invention. DETAILED DESCRIPTION
[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "multiple" is two or more. In addition, the use of "based on" or "according to" means openness and inclusiveness, because the process, steps, calculations or other actions "based on" or "according to" one or more of the conditions or values can be based on additional conditions or values beyond the stated in practice.
[0042] In order to solve the problems of high cost, poor adaptability and low efficiency of manual testing methods, the present invention provides a SAC-based red team network attack automation method, system and device.
[0043] Example 1
[0044] A SAC-based red team network attack automation method includes the following steps:
[0045] 1. Construct state space:
[0046] Taking the theft of sensitive information, which is common in red team testing, as the application background, the actual state of the test agent is taken as the state, and the state space is denoted as S, including whether to obtain sensitive information s1, directory path s2, information path s3, and compression path s4.
[0047] 2. Constructing the action space:
[0048] The theft, compression and other attack techniques that the test agent can perform are concretized through the ATT&CK platform to obtain actions. The actions include execution commands, corresponding platforms (such as Linux), executors (such as terminal), and four attributes of the payload contained. The action space is recorded as A. The action space contains 5 specific actions: create a cache directory a1, find sensitive information a2, temporarily store sensitive information a3, compress the temporary directory a4, and extract cached sensitive information a5. Different actions correspond to different commands under Windows and Linux, as shown in Table 1.
[0049] Table 1 Commands for different actions in Windows and Linux
[0050]
[0051] 3. Construct state transfer function mapping:
[0052] Taking the stealing of sensitive information commonly seen in red team testing as the application background, the transition mapping between states is:
[0053] (1) After taking the action of creating the cache directory a1, the state changes to obtaining the directory path s2 where the sensitive information is located;
[0054] (2) Taking the action of finding sensitive information a2, the state is transferred from whether to obtain sensitive information s1 to obtaining information path s3;
[0055] (3) Taking action a3 to temporarily store sensitive information requires knowing the directory path s2 and information path s3;
[0056] (4) An action is taken to compress the temporary directory a4, and the state is transferred from the directory path s2 to the compressed path s4;
[0057] (5) Taking action a5 to extract sensitive information requires knowing the compression path s4.
[0058] 4. Build rewards:
[0059] The reward value R is set to R=20 only when sensitive information is stolen, that is, the action described in (5). The other action-state transitions are all set to R=-1 as the cost of executing the action. If the selected action cannot be executed under the current state, that is, executing action a3 without states s2 and s3 in (3), a penalty of R=-20 is given.
[0060] 5. Build a reinforcement learning experience pool:
[0061] The SAC algorithm consists of 1 Actor network, 2 V critic networks, and 2 Q critic networks, where the Actor network is used to obtain action probabilities. , V critic networks are state value estimation V network and Target V network, which are used to estimate the value v(s) of the state; Q critic network is used to estimate the value q(s, a) of the action-state pair. The inputs of the five networks are all states in the state space;
[0062] Given a state s in the state space in step 1 t , get the probability of all actions in the action space through the Actor network, and then try each action a i The attack effect on the tested host, and the state s after taking this action t+1 And the reward r obtained from this attack action t+1 , such a set of quaternions (s t , a i ,s t+1 , r t+1 ) constitutes an experience of the test agent attacking the host under test, and multiple experiences constitute an experience pool. A batch of experiences randomly selected from the experience pool can constitute the database for training the above network. The value range of i is 0-4.
[0063] 5. Execute training:
[0064] (1) The network structure of the Q critic network is a three-layer fully connected neural network. The loss function of the Q critic network is The design is calculated as follows:
[0065] ,
[0066] in, Represents the norm of all training data in a batch, Indicates value, Indicates that the parameter is The network estimates the value of the action-state pair, j represents the number of the two Q critic networks, ranging from 0 to 1, represents the state at time t, represents the action at time t, represents the state at time t+1, represents the reward at time t+1, Represents the state calculated based on the optimal Bellman equation The true value estimate is calculated as:
[0067] ,
[0068] in, V represents the value of the state obtained by the critic network, represents the reward at time t, A coefficient that represents the value of the state.
[0069] (2) The network structure of the V critic network is a three-layer fully connected neural network. The loss function of the V critic network is Designed for:
[0070] ,
[0071] in, To indicate that the parameter is The network gets the value of the state, are the parameters of the V critic network, is the true value output by the V critic network and is calculated as follows:
[0072] ,
[0073] in, is entropy, is the entropy bonus coefficient, Yes Status The corresponding action space is All possible actions predicted by the Actor network, represents the probability distribution of the action predicted by the Actor network, are the parameters of the Actor network, It means that when j is 0 or 1, the function takes the minimum value.
[0074] (3) The network structure of the Actor network is a three-layer fully connected neural network. The loss function of the Actor network is Designed for: ,
[0075] in, All possible actions predicted by the Actor network, Represents the norm of all training data in a batch, Express Take expectations, is the entropy bonus coefficient, Indicates that the predicted action conforms to the probability distribution predicted by the Actor network. Indicates value, express Taken under the state The value of the Q network output during the action, are network parameters.
[0076] 6. Execute the attack:
[0077] After completing the network training, the red team test attack begins. The first decision is made based on the initial state, an action is selected, and then the action is executed, the state is updated, and it is detected whether the attack is successful. If not, a new state is returned and a decision is made again, and the cycle is repeated. If the attack is successful, the next attack test is started.
[0078] For the application scenario of attacking and obtaining sensitive information in the red team test, two hosts are configured, the hosts are connected through the network, the attack program is run in one host, the other host is used as the host under test, and corresponding software protection measures are configured. As shown in Table 2, different automated attack methods are used for comparison with the method of the present invention.
[0079] Table 2 Comparison of the results of the method of the present invention and different automated attack methods
[0080] .
[0081] Example 2
[0082] A SAC-based red team network attack automation system includes a processing instruction module for executing each step in the SAC-based red team network attack automation method.
[0083] Example 3
[0084] An electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the SAC-based red team network attack automation method.
[0085] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by the computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk (ssD)), etc.
[0086] The above is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A SAC-based red team network attack automation method, characterized in that: The steps include: S1. Construct a state space based on the process of the test agent, taking the actual state of the test agent as the state. The state space is recorded as S, including whether to obtain sensitive information s1, directory path s2, information path s3, and compression path s4; S2. Based on the ATT&CK platform, the attack techniques that the test agent can perform are concretized into attack instructions, and an action space is constructed. The action space is recorded as A, and the action space contains 5 specific actions: create a cache directory a1, find sensitive information a2, temporarily store sensitive information a3, compress the temporary directory a4, and extract cached sensitive information a5; S3. Describe the state transition relationship of the host under test, construct a state transition function, and design a corresponding reward function; The specific process of S3 is as follows: Taking the theft of sensitive information commonly seen in red team testing as the application background, and the real state of the test agent as the state, According to the actions taken, the change process of the state corresponding to different actions is obtained: (1) After taking the action of creating the cache directory a1, the state changes to obtaining the directory path s2 where the sensitive information is located; (2) Taking the action of finding sensitive information a2, the state is transferred from whether to obtain sensitive information s1 to obtaining information path s3; (3) Taking action a3 to temporarily store sensitive information requires knowing the directory path s2 and information path s3; (4) An action is taken to compress the temporary directory a4, and the state is transferred from the directory path s2 to the compressed path s4; (5) Taking action a5 to extract sensitive information requires knowing the compression path s4; Reward function based on the state: the reward value R is set to R=20 only when sensitive information is stolen, that is, the action described in (5). For other action-state transitions, it is set to R=-1 as the cost of executing the action; If the selected action cannot be performed under the current state, that is, if action a3 is performed without states s2 and s3 in (3), a penalty of R = -20 is imposed; S4. Through training, use reinforcement learning to complete automated red team testing; The SAC algorithm consists of 1 Actor network, 2 V critic networks, and 2 Q critic networks; The network structure of the Q critic network is a three-layer fully connected neural network. The loss function of the Q critic network is The design is calculated as follows: , in, Represents the norm of all training data in a batch, Indicates value, Indicates that the parameter is The network estimates the value of the action-state pair, represents the numbers of the two Q critic networks, ranging from 0 to 1. express The state of the moment, express The action of the moment, express The state of the moment, express The rewards of the moment, Represents the state calculated based on the optimal Bellman equation The true value estimate is calculated as: , in, V represents the value of the state obtained by the critic network, express The rewards of the moment, The coefficient representing the value of the state; The network structure of the V critic network is a three-layer fully connected neural network. The loss function of the V critic network is Designed for: , in, To indicate that the parameter is The network gets the value of the state, are the parameters of the V critic network, is the true value output by the V critic network and is calculated as follows: , in, is entropy, is the entropy bonus coefficient, Yes Status The corresponding action space is All possible actions predicted by the Actor network, represents the probability distribution of the action predicted by the Actor network, are the parameters of the Actor network, Indicates that when j is 0 or 1, the function takes the minimum value; The network structure of the Actor network is a three-layer fully connected neural network. The loss function of the Actor network is Designed for: , in, All possible actions predicted by the Actor network, Represents the norm of all training data in a batch, Express Take expectations, is the entropy bonus coefficient, Indicates that the predicted action conforms to the probability distribution predicted by the Actor network. Indicates value, express Taken under the state The value of the Q network output during the action, is a network parameter.
2. A SAC-based red team network attack automation system, characterized by: It includes a processing instruction module for executing each step in the SAC-based red team network attack automation method described in claim 1.
3. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the SAC-based red team network attack automation method as described in claim 1.
4. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the SAC-based red team network attack automation method as described in claim 1.
