Distributed multi-agent network penetration method and device and storage medium

Through the distributed multi-agent network penetration method, causal reinforcement learning and temporal convolution causal models are used to divide subnets and train agents, which solves the problems of low penetration testing efficiency and state space explosion in the existing technology, and achieves efficient Penetration testing.

CN118713916AActive Publication Date: 2024-09-27ARMY ENG UNIV OF PLA
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411011791.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-09-27
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

The data-driven reinforcement learning algorithm in the existing technology has low learning efficiency and learning accuracy in automated penetration testing, and is easily interfered by environmental changes, resulting in low penetration efficiency. In large-scale network penetration testing, the execution of attack actions takes a long time, and it is easy to encounter To the problem of exponential explosive growth of state space.

Method used

Using a distributed multi-agent network penetration method, through the attack path discovery task based on causal reinforcement learning, the target large network is divided into subnets, and agents are placed separately for node scanning. The temporal convolutional causal model is used to extract the spatiotemporal characteristics of vulnerability types. Information, and iteratively trained through causal reinforcement learning models to achieve the penetration of sensitive hosts.

Benefits of technology

It improves the efficiency and accuracy of penetration testing, reduces the state space explosion problem, automatically generates attack paths through causal reinforcement learning algorithms, realizes intelligent penetration, alleviates the interference of environmental changes, and improves learning efficiency and learning accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118713916A
    Figure CN118713916A
Patent Text Reader

Abstract

The invention belongs to the technical field of reinforcement learning and penetration testing, and discloses a distributed multi-agent network penetration method and device and a storage medium, and the method comprises the steps: dividing hosts which are located on the same network segment and have different feature information into different subnets; in an attack path discovery task based on distributed causal reinforcement learning, an intelligent agent is placed in each sub-network domain for node scanning, scanned information is input into a time sequence convolution causal model, and spatio-temporal feature information representing vulnerability types is output; aggregating the network state information to obtain a host state sequence; and inputting the host state sequence to each agent to enable the agent to execute a series of actions based on the host state sequence to obtain and share the penetration experience of each agent, and performing iteration until the causal reinforcement learning model converges to obtain a trained causal reinforcement learning model. The method has the advantages that the problems of intelligent body state, action space explosion and the like are effectively relieved, and the training efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a distributed multi-agent network penetration method, device and storage medium, belonging to the technical field of reinforcement learning and penetration testing. Background Art

[0002] In recent years, artificial intelligence has made achievements in many fields and has gradually moved from perceptual intelligence to decision-making intelligence. Reinforcement learning is an important path to achieve decision-making intelligence. For example, AlphaGo's outstanding performance in the Go project has caused a wave of reinforcement learning. In the real world, there are often interactions between multiple agents, such as cooperation and competition, such as robots assembling footballs, avoidance between multiple vehicles in autonomous driving, and various complex scene settings in games, which also promote the development of multi-agent reinforcement learning.

[0003] However, traditional data-driven reinforcement learning algorithms are highly dependent on training data and are easily disturbed by environmental changes. In addition, they are unable to explore the essential relationship between variables and the association between penetration targets, resulting in low learning efficiency and accuracy in the field of automated penetration testing.

[0004] Penetration testing based on traditional reinforcement learning is easily disturbed by environmental changes, and it is unable to explore the essential relationship between variables, so its penetration efficiency is low. In addition, when conducting large-scale network penetration testing, its attack actions take a long time to execute. The low penetration efficiency is also prone to the problem of exponential growth of the state space. Summary of the invention

[0005] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a distributed multi-agent network penetration method.

[0006] In order to solve the above technical problems, the present invention is implemented by adopting the following technical solutions.

[0007] On the one hand, the present invention discloses a distributed multi-agent network penetration method, comprising: Based on the different characteristic information of each network in the target large network, hosts on the same network segment but with different characteristic information are divided into different subnets; After the subnet division, subnet domains divided into different sub-areas are obtained. In the attack path discovery task based on distributed causal reinforcement learning, an agent is placed in each subnet domain to perform node scanning. Each agent includes a pre-trained temporal convolutional causal model. The scanned information is input into the pre-trained temporal convolutional causal model, and the spatiotemporal feature information representing the vulnerability type is output. Aggregate the spatiotemporal feature information of the vulnerability types of the hosts scanned by each agent and the network status information of different subnets to obtain the host status sequence; A causal reinforcement learning model pre-constructed based on the interaction process between multiple agents and the network environment is obtained, and the host state sequence is input to each agent so that the agent performs a series of actions based on the host state sequence to obtain and share the penetration experience of each agent. The causal reinforcement learning model is iterated until convergence, and a trained causal reinforcement learning model is obtained to complete the penetration of sensitive hosts.

[0008] Furthermore, based on the different characteristic information of each network in the target large network, the hosts on the same network segment but with different characteristic information are divided into different subnets, including: Based on the two-bit random walk method, the network status information of the target large network is collected, and the network status information is cleaned, factorized, and standardized in sequence, and then spliced ​​in order to obtain the feature vector of each host. Randomly select k hosts as the central hosts of each sub-network, calculate the feature similarity between the remaining hosts and the central hosts of each sub-network based on the host's feature vector, and assign the remaining hosts to the sub-network to which the most similar central host of the sub-network belongs, where k is a parameter.

[0009] Furthermore, the calculation formula for the similarity between each host is: ; In the formula, d ed , cosθ as well as D ( A , B ) are the Euclidean distance, cosine distance and Manhattan distance between each node respectively; The calculation formulas for Euclidean distance, cosine similarity, and Manhattan distance are as follows: ; ; ; In the formula, a i and b i Represent the feature vectors of the two hosts respectively, n represents the feature dimension, k Represents the feature dimension.

[0010] Furthermore, the temporal convolutional causal model includes: A temporal structure for extracting temporal features, a convolutional structure for extracting spatial features, and a fully connected network for merging temporal features and spatial features to obtain spatiotemporal feature information.

[0011] Furthermore, the training process of the temporal convolutional causal model includes: 1) Input the host feature information at different times in the target time period into the time series structure, and train the time series structure and the fully connected network together; 2) Input the average features and comprehensive distance values ​​of adjacent hosts in the target time period into the convolution structure, and train the convolution structure and the fully connected network together; 3) Simultaneously train the temporal structure, convolutional structure and fully connected structure to extract spatiotemporal feature information; 4) Repeat steps 1) to 3) until the loss function L Converge, complete the alternating training, and obtain the trained temporal convolutional causal model; The loss function L The expression is as follows: ; in, M Indicates the number of vulnerability categories; y ic represents the symbolic function, if the sample i The true category is equal to c If yes, it takes 1, otherwise it takes 0; p ic Represents an observation sample i Belongs to category c probability.

[0012] Furthermore, the causal reinforcement learning model is expressed as: ; in, r represents the immediate reward value, γ represents the discount factor, Indicates that in the next state The maximum expected return under Indicates the action to be performed. θ Represents model parameters.

[0013] Furthermore, the training of the causal reinforcement learning model includes: Inputting the spatiotemporal feature information into an autoencoder to perform noise filtering to obtain purified spatiotemporal feature information; The initial capacity is N Playback memory D , and the action-value function with random weights Q, and then execute the round iteration of the outer loop; in each round of the round iteration of the outer loop, first initialize the sequence s 1 = x 1},in, x 1 Represents the initial network status information, vulnerability type, and purified spatiotemporal status information, and preprocesses it into a fixed length , the outer loop means looping according to the set number of rounds, represents the preprocessed sequence; Execute the time step iteration of the inner loop, the inner loop means looping according to the set number of time steps; in each step of the time step iteration of the inner loop, first select the current time step based on the epsilon-Greedy algorithm t The random action or the current best action a t , and then execute it in the simulator a t Observation Rewards r and Network x t+1 ;set up s t+1 = s t , a t , x t+1 , s t express t The state of the moment, x t+1 express t +1 network information at the moment and perform preprocessing , s t+1 represents the state sequence at time t+1, express t +1 The state sequence after preprocessing at the moment; transfer the state obtained in the current time step Store to playback memory D Among them r t express t The rewards of the moment, express t A sequence of states that have been preprocessed at all times; based on replay memory D Randomly sample small batches of state transitions ,in a j express j The action of the moment, rj express j The rewards of the moment, express j +1 time after preprocessing state sequence, express j The state sequence after preprocessing at each moment; according to Whether it is in the termination state, set y i for: ; in, Indicates the action at the previous moment. Q ( ) represents a neural network function approximator; With loss function Execute gradient descent, update network parameters, and adjust the structural parameters of the model through forward and backward propagation of gradients until the loss function value converges to obtain a trained causal reinforcement learning model; Said It is expressed as: ; represents the original loss, It's about sequence s and actions a The probability distribution of θ i represents the model parameters, MSE is the original data from the input layer of the autoencoder to the hidden layer of the autoencoder X And the decoding result X R The distance metric function is the mean square error.

[0014] Furthermore, the processing process of the autoencoder includes: The raw data from the input layer of the autoencoder to the hidden layer of the autoencoder X The encoding process is: ; in, h Indicates the encoding result, Represents the encoding process, σ is the parameter value, W 1 represents the autoencoder parameters, b 1 represents the bias of the autoencoder; The decoding process from the hidden layer of the autoencoder to the output layer of the autoencoder is: ; in, XR Indicates the decoding result. Represents the decoding process, W 2 Describes the decoder parameters, b 2 Represents the bias of the decoder.

[0015] In a second aspect, the present invention provides a distributed multi-agent network penetration device, comprising: A division module is used to divide hosts on the same network segment but with different characteristic information into different subnets based on different characteristic information of each network in the target large network; The first model processing module is used to obtain subnet domains divided into different sub-areas after subnet division. In the attack path discovery task based on distributed causal reinforcement learning, an agent is placed in each subnet domain to perform node scanning. Each agent includes a pre-trained temporal convolutional causal model, and the scanned information is input into the pre-trained temporal convolutional causal model to output spatiotemporal feature information representing the vulnerability type. Aggregation module, used to aggregate the spatiotemporal characteristic information of vulnerability types of hosts scanned by each agent and network status information of different subnets to obtain a host status sequence; The second model processing module is used to obtain a causal reinforcement learning model pre-constructed based on the interaction process between multiple agents and the network environment, input the host state sequence to each agent, so that the agent performs a series of actions based on the host state sequence to obtain and share the penetration experience of each agent, iterate until the causal reinforcement learning model converges, obtain a trained causal reinforcement learning model, and complete the penetration of sensitive hosts.

[0016] In a third aspect, the present invention provides a computer-readable storage medium storing one or more programs, wherein the one or more programs include instructions, which, when executed by a computing device, cause the computing device to perform the method of one aspect.

[0017] The beneficial effects achieved by the present invention are: 1) Penetration testing based on traditional reinforcement learning is easily disturbed by environmental changes, and it is unable to explore the essential relationship between variables, so the penetration efficiency is low. This scheme designs a method based on causal reinforcement learning, which uses the causal reinforcement learning algorithm model to train the intelligent agent to automatically generate attack paths according to the penetration environment, thereby achieving the purpose of intelligent penetration. 2) When conducting large-scale network penetration tests, the attack actions take a long time to execute, the penetration efficiency is not high, and it is easy to encounter the problem of exponential explosive growth in the state space. In order to improve the penetration efficiency, the random walk method is used to divide the large network into subnets, and then multiple agents are used for scanning and penetration. The scanning penetration test problem is decomposed into subtasks, so that the target sensitive host can be found faster and the vulnerability information can be scanned, so that the problems of intelligent agent state and action space explosion are effectively alleviated, thereby speeding up the training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is the overall flow chart of the present invention; Figure 2 It is a structural diagram of causal reinforcement learning; Figure 3 It is a simulation scene graph. DETAILED DESCRIPTION

[0019] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0020] Example 1, this example introduces a distributed multi-agent network penetration method, step 1, subnet division based on random walk. It is used to segment the target large network. Based on the different characteristic information of the network, the clustering method is applied to divide the hosts on the same network segment into different subnets. The subnet division can reduce the network scale and the number of hosts, and explore the internal connection between subnets, so that the state space that each agent needs to process is reduced. Compared with directly processing large networks, after subnet division, agents in different subnet domains can share the experience learned in their respective subnet domains with agents in other areas, so as to speed up the penetration process.

[0021] Step 2: Scan ports in subnets based on the temporal convolutional causal model. After the subnet division, each agent plans attacks to penetrate hosts in its own subnet domain. Causal reinforcement learning determines the scope of penetration test targets through observation and scanning actions of agents in different subnet domains. Through intelligence information collection, security vulnerabilities and weaknesses of penetration targets are discovered, providing a basis for future penetration attacks. The scanning operation can select the target host for the next attack based on the status of the current controlled host, so that the agent can quickly penetrate all sensitive hosts and complete the path planning task.

[0022] Step 3, host penetration based on causal reinforcement learning. The agents aggregate the status information of the scanned hosts and perform a series of attack actions on sensitive hosts. In order to enable multiple agents to cooperate with each other and perform operations faster, the causal reinforcement learning method is still selected in this step. By inputting the status information of the scanned subnet domain containing sensitive hosts to each agent, performing a series of actions and sharing the penetration experience of each agent, the fastest penetration path and method are selected to complete the penetration of sensitive hosts.

[0023] Iterate the above steps until the causal reinforcement learning algorithm model converges and completes the training of the distributed multi-agent penetration testing model based on causal reinforcement learning. After the training is completed, we will gain control of the sensitive host.

[0024] refer to Figure 1 and Figure 2 , the method comprises the following steps: S1. Subnetting based on random walk.

[0025] S11. Network status information collection and preprocessing. First, various information of the target network is collected based on the two-bit random walk method, including: Address information: server IP address, DNS domain name, open port number and corresponding service process, etc.

[0026] System information: operating system type and version, Web server software type and version, Web application and version, Web application development tools and version, Web application architecture, database management system type and version.

[0027] Account information: including operating system login accounts, database management system accounts, application system management accounts, etc. Configuration information: including network topology, address mapping table (when the Web server is located in an internal LAN and uses private IP addresses), service configuration information, shared resources, firewall type and configuration information, identity authentication and access control methods, encryption and password management mechanisms.

[0028] Other information: security vulnerabilities (software vulnerabilities and management vulnerabilities), DNS registration information, network administrator contact information.

[0029] The collected data are preprocessed, including data cleaning (filling in empty values, merging similar data, etc.), feature factorization, data standardization, etc. Then all the information features of each host are spliced ​​in order to obtain their respective feature vectors. ,in i Indicates the host number. t Indicates the sampling time.

[0030] S12, similarity measurement. First, the Euclidean distance, cosine distance and Manhattan distance between each node are calculated according to the node feature vector obtained in step S11, and then the three distances are multiplied to obtain the result to measure the similarity of each node vector.

[0031] The calculation formula of Euclidean distance is as follows: (1); The formula for calculating cosine similarity is as follows: (2); The Manhattan distance calculation formula is as follows: (3); Then multiply the three distance functions to calculate the similarity between each node vector: (4); Random Selection k hosts as the central hosts of each sub-network, calculate the feature similarity between the remaining hosts and the central hosts of each sub-network according to the host's feature vector, and assign the remaining hosts to the sub-network to which the most similar central host of the sub-network belongs. k The parameters are determined according to the actual number of hosts and their own needs, and each intelligent agent is set to scan and penetrate, thereby speeding up the penetration efficiency.

[0032] S2. After the target network is subnetted according to the method of step S1, subnet domains divided into different areas are obtained. In the attack path discovery task based on distributed causal reinforcement learning, an intelligent agent is placed in each subnet domain to perform port scanning, find sensitive hosts in the target network, and plan attacks to penetrate between hosts.

[0033] S21. Build a time series convolution causal model. The input of the model includes the time series features of nodes collected at different times, the average features of adjacent nodes in the period, and the comprehensive distance value between the node and the adjacent nodes; the output of the model is the vulnerability type after scanning, such as ftp, ssh, etc. The structure of the model includes a time series structure and a convolution structure. The time series structure extracts time features (i.e., node features at different times), and the convolution structure extracts spatial features (i.e., the average features and comprehensive distance values ​​of adjacent nodes in the period). The time series structure is implemented using the LSTM network and the convolution structure is implemented using a general convolution network. LSTM and CNN are finally connected in parallel through full connection to realize the causal reasoning of time series convolution. First, each agent collects the open information of the subnet host collected at different times to form a time series information matrix, and then inputs this time series information matrix into the LSTM long short-term memory network to extract the time series information: (5); After extracting the time series information through the LSTM network, the time series information matrix is ​​input into the CNN convolutional network to extract spatial features: (6); Finally, the temporal feature information and spatial feature information extracted by the LSTM network and the CNN network are input into the fully connected network to merge and extract the temporal and spatial feature information as the input of the reinforcement learning penetration testing model.

[0034] S22. Train the temporal convolutional causal model. The convergence of training is achieved by alternating the temporal structure and the convolutional structure. Use cross entropy (categorical_crossentropy) as the loss function for causal feature extraction network optimization, and its expression is as follows: ; in, M Indicates the number of categories. This patent includes 11 vulnerabilities, including vnc, telent, ssh, rpc, proftdp, phb,mysql, irc, http, apache and prostgresql. y ic is a sign function (0 or 1), if the sample i The true category is equal to c If yes, it takes 1, otherwise it takes 0. p ic Represents an observation sample i Belongs to category c probability.

[0035] The training steps of the causal feature extraction network specifically include: 1) First, the node features at different times are input into the time series structure, and the LSTM long short-term memory network and the fully connected neural network are trained together; 2) Then the average features and comprehensive distance values ​​of the adjacent nodes in the time period are input into the convolution structure to train the convolutional neural network and the fully connected neural network together; 3) Simultaneously train the temporal structure, convolutional structure and fully connected structure to extract spatiotemporal feature information; 4) Repeat steps 1) to 3) until the loss function L Convergence, complete alternating training, and achieve comprehensive learning of temporal causality and spatial causality.

[0036] In this paper, we assume that future rewards decay over time steps, and the decay factor is γ , then in t The sum of rewards at the moment in the future is: (7); in, R t express t The total reward value at the moment, T Indicates the total time, express The reward value at that moment.

[0037] Optimal Action-Value Function To observe a sequence s And perform actions a After that, the maximum expected reward that can be achieved through any subsequent strategy is: (9); in, and Respectively represent the state and action at the next moment, r Represents the reward value, and the entropy form indicates that the target expectation consists of the maximum expectation of the immediate reward and the discounted reward of the next time step. A function approximator is then used to estimate the action-value function: (10); The present invention uses a weight θ The neural network function approximator is called a Q-network. The Q-network passes i Minimize the loss function To train: (11); in, For the current iteration i The goal, It is a sequence s and actions a The probability distribution of is the behavior distribution. The parameters from the previous iteration In optimizing the loss function , which remains unchanged and is used to calculate the optimal value function for the current iteration. The following gradient can be obtained by taking the derivative of the loss function with respect to the weight: (12); Compared with directly calculating the expectation in the above gradient, for the sake of computational efficiency, we can optimize the loss function through stochastic gradient descent. Each time, a single sample is sampled as the expectation based on the behavior distribution and the simulator to update the weight.

[0038] S32. Train a causal reinforcement learning model to achieve rapid penetration of the target network.

[0039] like Figure 2 and Figure 3As shown in the figure, firstly, the spatiotemporal feature information of the fully connected layer is input into the autoencoder to remove noise and purify information. The encoding process of the original data from the autoencoder input layer to the hidden layer is: (13); in, h Indicates the encoding result, Represents the encoding process, σ is the parameter value, W 1 represents the autoencoder parameters, b 1 represents the bias of the autoencoder; Decoding process from hidden layer to output layer: (14); in, X R Indicates the decoding result. Represents the decoding process, W 2 Describes the decoder parameters, b 2 Represents the bias of the decoder.

[0040] Then the optimization objective function of the algorithm is written as: (15); Where is the mean square error of the distance metric function between the two.

[0041] Then initialize the capacity to N Playback memory D , and the action-value function with random weights Q ; Then execute the round iteration (outer loop, total M In each round, the sequence is initialized first. ,in, Represents the purified network status, spatiotemporal status information, and vulnerability type, and preprocesses them into fixed length ; Then execute the time step iteration (inner loop, total T Step), in each step, first select an action based on the epsilon-Greedy algorithm (random action or current best action), and then execute it in the simulator Observation Rewards r and Network ;set up And perform preprocessing ; The transfer obtained in the current time step Save to D in; based on D Randomly sample small batches of transfers ;according to Whether it is in the termination state, set for: (16); in, Indicates the action at the previous moment. Q ( ) represents a neural network function approximator.

[0042] Finally, a regularization term is added to the loss function of formula (11): The loss function performs gradient descent and updates the network parameters. The structural parameters of the model are adjusted through forward and backward propagation of the gradient until the loss function value converges, and finally the sensitive host of the target network is successfully penetrated and the controlled state of the host is obtained.

[0043] Based on this, the present invention applies causal reinforcement learning and clustering methods to penetration testing to improve the effect of penetration testing.

[0044] Causal reinforcement learning is a learning method that considers causal structure by extending the reinforcement learning algorithm. Traditional reinforcement learning focuses on the correlation between actions and rewards, while causal reinforcement learning starts from causality and considers the impact of actions on future states to better deal with interference factors in the environment, thereby improving learning efficiency and learning accuracy. In causal reinforcement learning, an agent maximizes future rewards by constantly trying behaviors. The agent usually perceives one or more states from the environment and the rewards it will receive after performing a certain behavior. In traditional reinforcement learning, the agent only focuses on the correlation between behavior and reward, without considering causality. However, in causal reinforcement learning, behavior may have a causal effect on the next state. For example, a behavior may cause the next state to occur, resulting in changes in subsequent rewards. Therefore, in causal reinforcement learning, the algorithm takes into account the causal relationship between behavior, state, and reward. It not only focuses on the joint distribution between behavior and reward, but also focuses on the causal impact of behavior on future states and rewards, and models the impact of behavior as a causal intervention.

[0045] Fundamentally, causal reinforcement learning can better understand the causal structure of the problem through the analysis and modeling of causal relationships, learn the optimal strategy in a more efficient way, and has a wider application prospect. The application of clustering methods in the penetration process can explore the relationship between different penetration targets, divide them into different categories according to their attributes for distributed penetration, and improve the penetration efficiency and accuracy.

[0046] In summary, the distributed multi-agent penetration testing method based on causal reinforcement learning proposed in this patent can improve efficiency and success rate, focus on the intrinsic connection of penetration targets, consider the causal effect structure, not only pay attention to the joint distribution between behavior and reward, but also pay attention to the causal influence of behavior on future states and rewards, and model the influence of behavior as a causal intervention, thereby completing the penetration of vulnerabilities, which has extremely important practical significance for improving penetration efficiency and accuracy.

[0047] Embodiment 2, this example provides a distributed network penetration method based on causal reinforcement learning and its application in different networks, specifically including the model of the target network and the penetration environment. The network environment includes different configurations of the host, specifically including subnets, network topology, firewalls, routers, etc.; the penetration environment includes the setting of the target penetration network, and the interaction between multiple agents and the network environment. The process of interaction with the environment is modeled as a Markov decision process of distributed causal reinforcement learning based on the DQN algorithm, so as to realize the mutual integration of the network and the penetration environment, and achieve the purpose of distributed penetration in networks of different scales through this method.

[0048] Embodiment 3 is based on the same inventive concept as Embodiment 1. This embodiment introduces a distributed multi-agent network penetration device, including: A division module is used to divide hosts on the same network segment but with different characteristic information into different subnets based on different characteristic information of each network in the target large network; The first model processing module is used to obtain subnet domains divided into different sub-areas after subnet division. In the attack path discovery task based on distributed causal reinforcement learning, an agent is placed in each subnet domain to perform node scanning. Each agent includes a pre-trained temporal convolutional causal model, and the scanned information is input into the pre-trained temporal convolutional causal model to output spatiotemporal feature information representing the vulnerability type. Aggregation module, used to aggregate the spatiotemporal characteristic information of vulnerability types of hosts scanned by each agent and network status information of different subnets to obtain a host status sequence; The second model processing module is used to obtain a causal reinforcement learning model pre-constructed based on the interaction process between multiple agents and the network environment, input the host state sequence to each agent, so that the agent performs a series of actions based on the host state sequence to obtain and share the penetration experience of each agent, iterate until the causal reinforcement learning model converges, obtain a trained causal reinforcement learning model, and complete the penetration of sensitive hosts.

[0049] Based on the same inventive concept as Example 1, this embodiment introduces a computer-readable storage medium storing one or more programs, characterized in that the one or more programs include instructions, which, when executed by a computing device, enable the computing device to execute the method described in Example 1.

[0050] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0051] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0052] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0053] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0054] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A distributed multi-agent network penetration method, characterized in that: include: Based on the different characteristic information of each network in the target large network, hosts on the same network segment but with different characteristic information are divided into different subnets; After the subnet division, subnet domains divided into different sub-areas are obtained. In the attack path discovery task based on distributed causal reinforcement learning, an agent is placed in each subnet domain to perform node scanning. Each agent includes a pre-trained temporal convolutional causal model. The scanned information is input into the pre-trained temporal convolutional causal model, and the spatiotemporal feature information representing the vulnerability type is output. Aggregate the spatiotemporal feature information of the vulnerability types of the hosts scanned by each agent and the network status information of different subnets to obtain the host status sequence; A causal reinforcement learning model pre-constructed based on the interaction process between multiple agents and the network environment is obtained, and the host state sequence is input to each agent so that the agent performs a series of actions based on the host state sequence to obtain and share the penetration experience of each agent. The causal reinforcement learning model is iterated until convergence, and a trained causal reinforcement learning model is obtained to complete the penetration of sensitive hosts.

2. The distributed multi-agent network penetration method according to claim 1, characterized in that: The method of dividing hosts on the same network segment but with different characteristic information into different subnets based on different characteristic information of each network in the target large network includes: Based on the two-bit random walk method, the network status information of the target large network is collected, and the network status information is cleaned, factorized, and standardized in sequence, and then spliced ​​in order to obtain the feature vector of each host. Randomly select k hosts as the central hosts of each sub-network, calculate the feature similarity between the remaining hosts and the central hosts of each sub-network based on the host's feature vector, and assign the remaining hosts to the sub-network to which the most similar central host of the sub-network belongs, where k is a parameter.

3. The distributed multi-agent network penetration method according to claim 2, characterized in that: The calculation formula of the similarity between each host is: ; In the formula, d ed , cosθ as well as D ( A , B ) are the Euclidean distance, cosine distance and Manhattan distance between each node respectively; The calculation formulas for Euclidean distance, cosine similarity, and Manhattan distance are as follows: ; ; ; In the formula, a i and b i Represent the feature vectors of the two hosts respectively, n represents the feature dimension, k Represents the feature dimension.

4. The distributed multi-agent network penetration method according to claim 1, characterized in that: The temporal convolutional causal model includes: A temporal structure for extracting temporal features, a convolutional structure for extracting spatial features, and a fully connected network for merging temporal features and spatial features to obtain spatiotemporal feature information.

5. The distributed multi-agent network penetration method according to claim 4, characterized in that: The training process of the temporal convolutional causal model includes: 1) Input the host feature information at different times in the target time period into the time series structure, and train the time series structure and the fully connected network together; 2) Input the average features and comprehensive distance values ​​of adjacent hosts in the target time period into the convolution structure, and train the convolution structure and the fully connected network together; 3) Simultaneously train the temporal structure, convolutional structure and fully connected structure to extract spatiotemporal feature information; 4) Repeat steps 1) to 3) until the loss function L Convergence, complete alternating training, and obtain the trained temporal convolutional causal model; The loss function L The expression is as follows: ; in, M Indicates the number of vulnerability categories; y ic represents the symbolic function, if the sample i The true category is equal to c If yes, it takes 1, otherwise it takes 0; p ic Represents an observation sample i Belongs to category c probability.

6. The distributed multi-agent network penetration method according to claim 5, characterized in that: The causal reinforcement learning model is expressed as: ; in, r represents the immediate reward value, γ represents the discount factor, Indicates that in the next state The maximum expected return under Indicates the action to be performed. θ Represents model parameters.

7. The distributed multi-agent network penetration method according to claim 6, characterized in that: The training of the causal reinforcement learning model includes: Inputting the spatiotemporal feature information into an autoencoder to perform noise filtering to obtain purified spatiotemporal feature information; The initial capacity is N Playback memory D , and the action-value function with random weights Q , and then execute the round iteration of the outer loop; in each round of the round iteration of the outer loop, first initialize the sequence s 1={ x 1}, where x 1 represents the initial network status information, vulnerability type, and purified spatiotemporal status information, and preprocesses it into a fixed length , the outer loop means looping according to the set number of rounds, represents the preprocessed sequence; Execute the time step iteration of the inner loop, the inner loop means looping according to the set number of time steps; in each step of the time step iteration of the inner loop, first select the current time step based on the epsilon-Greedy algorithm t The random action or the current best action a t , and then execute it in the simulator a t Observation Rewards r and Network x t+1 ;set up s t+1 = s t , a t , x t+1 , s t express t The state of the moment, x t+1 express t +1 network information at the moment and perform preprocessing , s t+1 represents the state sequence at time t+1, express t +1 The state sequence after preprocessing at the moment; transfer the state obtained in the current time step Store to playback memory D Among them r t express t The rewards of the moment, express t A sequence of states that have been preprocessed at all times; based on replay memory D Randomly sample small batches of state transitions ,in a j express j The action of the moment, r j express j The rewards of the moment, express j +1 time after preprocessing state sequence, express j The state sequence after preprocessing at each moment; according to Whether it is in the termination state, set y i for: ; in, Indicates the action at the previous moment. Q ( ) represents a neural network function approximator; With loss function Execute gradient descent, update network parameters, and adjust the structural parameters of the model through forward and backward propagation of gradients until the loss function value converges to obtain a trained causal reinforcement learning model; Said It is expressed as: ; represents the original loss, It's about sequence s and actions a The probability distribution of θ i represents the model parameters, MSE is the original data from the input layer of the autoencoder to the hidden layer of the autoencoder X And the decoding result X R The distance metric function is the mean square error.

8. The distributed multi-agent network penetration method according to claim 7, characterized in that: The processing process of the autoencoder includes: The raw data from the input layer of the autoencoder to the hidden layer of the autoencoder X The encoding process is: ; in, h Indicates the encoding result, Represents the encoding process, σ is the parameter value, W 1 represents the autoencoder parameter, b 1 represents the bias of the autoencoder; The decoding process from the hidden layer of the autoencoder to the output layer of the autoencoder is: ; in, X R Indicates the decoding result. Represents the decoding process, W 2 represents the decoder parameters, b 2 represents the bias of the decoder.

9. A distributed multi-agent network penetration device, characterized in that: include: A division module is used to divide hosts on the same network segment but with different characteristic information into different subnets based on different characteristic information of each network in the target large network; The first model processing module is used to obtain subnet domains divided into different sub-areas after subnet division. In the attack path discovery task based on distributed causal reinforcement learning, an agent is placed in each subnet domain to perform node scanning. Each agent includes a pre-trained temporal convolutional causal model, and the scanned information is input into the pre-trained temporal convolutional causal model to output spatiotemporal feature information representing the vulnerability type. Aggregation module, used to aggregate the spatiotemporal characteristic information of vulnerability types of hosts scanned by each agent and network status information of different subnets to obtain a host status sequence; The second model processing module is used to obtain a causal reinforcement learning model pre-constructed based on the interaction process between multiple agents and the network environment, input the host state sequence to each agent, so that the agent performs a series of actions based on the host state sequence to obtain and share the penetration experience of each agent, iterate until the causal reinforcement learning model converges, obtain a trained causal reinforcement learning model, and complete the penetration of sensitive hosts.

10. A computer-readable storage medium storing one or more programs, characterized in that: The one or more programs include instructions which, when executed by a computing device, cause the computing device to perform the method of any one of claims 1 to 8.

Citation Information

Patent Citations

  • Multi-agent cooperative layered network penetration method based on QMIX algorithm

    CN115766113A

  • Multi-task self-supervised reinforcement learning based on causal rewards

    CN116187174A

  • Multi-agent reinforcement learning method and related device

    WO2023231961A1

  • Intelligent bus scheduling method based on multi-agent reinforcement learning

    WO2024119845A1