A botnet situation prediction method and prediction system based on neural network
By building a dynamic infection cascade network and HintBot framework, using neural networks to extract the propagation characteristics of botnets, the problem of difficult to predict the future situation and scale of botnets in the existing technology is solved, and high-accuracy prediction and defense measures are achieved.
Patent Information
- Application Number
- CN202210966921.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-11
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-08-11
AI Technical Summary
The existing technology is difficult to effectively predict the future situation and scale of botnets, and it is impossible to fully characterize the characteristics of botnets during the propagation process. It is not clear whether deep learning networks can learn infection characteristics for scale prediction.
Using a neural network-based botnet situation prediction method, dynamic heterogeneous infections in the botnet propagation path are extracted by constructing a dynamic infection cascade network (DICN), using infection influence priority sampling strategy, attention mechanism and multiple neural networks. Features, construct the HintBot framework for prediction.
Achieving a deep understanding of the propagation and evolutionary patterns of botnets, it can effectively predict future propagation trends, including the scale of propagation and burst time, improve prediction accuracy, help security professionals take defensive measures in a timely manner, and reduce the botnets' harm.
Smart Images

Figure CN115442084B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of neural network botnet situation prediction, and specifically relates to a botnet situation prediction method and prediction system based on neural network. Background Art
[0002] Botnets are considered one of the most serious threats to critical industry infrastructure. Driven by considerable profits, peer-to-peer (P2P) botnets have spread recklessly on the Internet of Things (IoT), infecting more and more devices. By June 2021, botnets had explosively infected 1.5 million smart devices, resulting in a series of cybercrimes such as distributed denial of service (DDoS), spam, and phishing. The infamous Mozi botnet is a new botnet that has emerged in recent years, which is extremely aggressive and extremely harmful. The impact of botnets has crossed national borders, and our online world may be attacked by botnets at any time, and even suffer huge losses. In order to minimize the potential risks of botnets, we need effective monitoring technology to understand the overall situation of botnets before large-scale botnets are formed.
[0003] There has been a lot of work in the academic community to study the properties of botnets. A large number of previous studies have expanded on the existing susceptible-infected (SI) epidemic transmission model and measured the total number of infections by studying epidemic behavior. Some scholars have also used Markov chains to model the botnet propagation process. Most existing studies use mathematical methods, such as differential equations, to evaluate the infection of botnets. These methods can effectively reveal the dynamics of botnet propagation, but they ignore the global topological information of botnets and cannot characterize the heterogeneity of botnets across time and space during the propagation process. In addition, these works have not verified the effectiveness of their models in the real world, so it is difficult to be applied to mitigate the spread of botnets. In the direction of botnet mitigation, there are also a large number of related literature on botnet detection. This type of work can only detect existing botnets based on features such as traffic, and cannot effectively predict the future trend of botnets, let alone provide timely warnings for possible outbreaks. Existing deep learning-based research has achieved good results in cascade prediction, but it is not clear whether deep learning networks can better learn the infection characteristics of botnets for scale prediction. Therefore, in order to achieve effective scale prediction, building a model that can fully characterize the characteristics of botnets in propagation evolution and building an effective prediction pipeline that can fully learn infection characteristics are two key issues. Summary of the invention
[0004] The purpose of the present invention is to provide a botnet situation prediction method and prediction system based on neural network to solve the problems of comprehensive modeling of propagation and evolution characteristics during the infection process of existing botnets and construction of a botnet scale prediction framework, and to have a high accuracy in predicting the future situation and scale of botnets.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] A method for predicting a botnet situation based on a neural network comprises the following steps:
[0007] S1. Obtain basic zombie infection traffic data, use it to construct multiple dynamic infection cascade networks DICN, form a dynamic infection cascade network dataset, and divide the dataset into a training set, a validation set, and a test set;
[0008] S2. Construct a botnet infection prediction framework; specifically, it includes the following sub-steps:
[0009] S2.1. For each input dynamic infection cascade network DICN, sequence embedding processing is performed to obtain K sequence embeddings of the DICN. Each sampling sequence embedding consists of L node sequences, and the K sequence embeddings contain K×L node embeddings in total. The node embedding of the i-th node in the k-th sampling sequence is expressed as
[0010] S2.2, the K sampling sequence embeddings obtained in step S2.1 are combined using the attention mechanism to obtain the network embedding of the dynamic infection cascade network DICN;
[0011] S2.3, the network embeddings of all DICNs obtained by iterative processing of steps S2.1 and S2.2 are input into the LSTM unit in parallel, and then processed using the masked multi-head self-attention mechanism, and the network embedding of the last DICN is selected as the input of the dynamic prediction module;
[0012] S3, using the training set obtained in step S1 to train the botnet infection prediction framework obtained in step S2 until the set loss function converges, thereby obtaining a pre-trained botnet infection prediction framework;
[0013] S4, using the validation set obtained in step S1 to iteratively validate the pre-trained botnet infection prediction framework, and selecting the botnet infection prediction framework with the best performance on the prediction set;
[0014] S5, using the test set obtained in step S1 to test the botnet infection prediction framework obtained in step S4, and judging whether it meets the prediction requirements based on the test results and the evaluation index; if not, returning to step S3, continuing iterative training until the test results meet the prediction requirements, and outputting a botnet infection prediction framework that meets the requirements;
[0015] S6. Predict the size of the botnet using the botnet infection prediction box that meets the prediction requirements generated in step S5.
[0016] Furthermore, the step S1 specifically includes the following steps:
[0017] S1.1, capture 2 months of basic zombie infection traffic as the basic data set;
[0018] S1.2, using the basic data set of zombie infection traffic constructed in step S1.1, for each traffic, select the attack initiator IP address src_ip, the attacked host IP address dst_ip, the attacked host location dst_loc, the attacked host line type dst_iptype and the threat attack timestamp timestamp, and construct<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection;
[0019] S1.3, divide the output of step S1.2 by timestamp<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection, forming multiple<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> The traffic data subsets are used to construct multiple dynamic infection cascade networks; the traffic data set from day 1 to day 2 is used to construct the first dynamic infection cascade network, the traffic data set from day 1 to day 4 is used to construct the second dynamic infection cascade network, the traffic data set from day 1 to day 6 is used to construct the third dynamic infection cascade network, and so on, a total of 30 dynamic infection cascade networks are output to construct 30 dynamic infection cascade networks.<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data subset;
[0020] S1.4, using the 30 traffic data subsets divided according to timestamps output in step S1.3, a total of 30 dynamic infection cascade networks are constructed as DICN data sets;
[0021] S1.5. Divide the DICN dataset output in step S1.4 into training set, validation set and test set according to a certain ratio.
[0022] Furthermore, in step S1.2, for multiple<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> If the src_ip and dst_ip are the same but the timestamps are different, the one with the earliest timestamp is retained.
[0023] Furthermore, in step S1.4, the construction steps of each dynamic infection cascade network DICN are as follows:
[0024] S1.4.1 Select a directed edge that is not constructed in the current traffic data subset<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Correspondingly, a unique directed edge with a specific starting point and end point in the dynamic infection cascade network DICN is constructed;
[0025] S1.4.2 Determine the starting point and starting point type of the directed edge: Set src_ip as the starting point of the directed edge and mark the starting point type as Bot (B);
[0026] S1.4.3 Determine the endpoint and endpoint type of the directed edge: Take dst_ip as the endpoint of the directed edge. If the host represented by dst_ip is used as src_ip in a captured traffic data in the future, the endpoint type is marked as Bot (O), otherwise the endpoint type is marked as Target (T);
[0027] S1.4.4 Calculate the edge weight of the directed edge:
[0028] If the start and end points of the directed edges marked in steps S1.4.2 and S1.4.3 are of type Bot(B) and Target(T) respectively, then the edge weight is α, which is calculated using formula (1), i.e., α = α1·x1+α2·x2+b, where x1 and x2 are the numerical representations of dst_loc and dst_iptype respectively, α1 and α2 are the weight coefficients assigned to x1 and x2 respectively, and α1, α2 and b are pre-learned by NN-1;
[0029] If the start and end points of the directed edges marked in steps S1.4.2 and S1.4.3 are of type Bot(B) and Bot(B) respectively, then the edge weight is β, using formula (2), that is, Calculate, where α is calculated using formula (1), N T and N I is the total number of targeted and infected devices in the botnet during the complete botnet outbreak cycle;
[0030] S1.4.5 Mark the timestamp of the directed edge: Use timestamp as the timestamp of the directed edge;
[0031] S1.4.6 If there are still directed edges that have not been constructed in the current traffic data subset<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> , then iteratively execute step S1.4.1 and its subsequent steps.
[0032] Furthermore, the specific execution steps of step S2.1 are:
[0033] S2.1.1. Apply the infection influence priority sampling strategy EIFS to each dynamic infection cascade network DICN, and obtain a total of K sequences in a certain order, each sequence consists of L nodes;
[0034] S2.1.2, process each node of each sequence sampled in step S2.1.1 using a node embedding module. Specifically, the node embedding module is used to map the one-hot high-dimensional vector representation of the node to a vector embedding in its unified low-dimensional space. This step obtains a total of K×L node embeddings, each of which constitutes K sequence embeddings;
[0035] S2.1.3. The K sequence embeddings obtained in step S2.1.3 are further processed using a bidirectional gated recursive unit, i.e., the L nodes of each sequence are input into the bidirectional gated recursive unit in parallel, and each node in the sequence is given embedded infection flow information; this step outputs K sequence embeddings, each of which is composed of the L node embeddings that constitute the sequence.
[0036] Furthermore, the step S2.1.1 applies the infection influence priority sampling strategy EIFS to obtain a total of K sequences in a certain order, which specifically includes the following sub-steps:
[0037] S2.1.1.1, using formula (6), that is Calculate the effective infection influence score of each node in the dynamic infection cascade network DICN input into this step. In the formula, v represents the downstream reachable neighbor of node u, W(·) is the weighted scoring function, and D(u, v) represents the effective infection distance between node u and each of its downstream reachable neighbor nodes v;
[0038] Furthermore, the weight score calculation formula for each node u is: Where N out (u) is the set of direct out-degree neighbors of node u, outdeg(w) represents the out-degree of node w, and weight(u, w) refers to the edge weight of the directed edge from node u to node w;
[0039] The calculation formula of the effective infection distance D(u, v) between node u and each of its downstream reachable neighbor nodes v is D(u, v) = mmin{1-log2(P(u, v) * )}
[0040] P(u,v) * =P(u,l1)×P(l1,l2)×...×P(l n-1 , l n )×P(l n , v), Among them, from node l i To node l i+1 A directed edge is formed, and the path from node u to node v needs to pass through this directed edge. Represents the slave node l i Select neighbor node l from all direct out-degree neighbors i+1 The average probability, weight(l i , l i+1 ) represents the slave node l i To node l i+1 The edge weights of the directed edges of ;
[0041] S2.1.1.2, initialization sampling step: set the initial values of the number of sampling sequences K and the length of the sampling sequence L, and set the starting node set to be sampled to all nodes in the dynamic infection cascade network DICN of the input step S2.1.1.1;
[0042] S2.1.1.3. Substitute the effective infection influence score of each node in the starting node set to be sampled into formula (4), that is, Calculate the probability of each node in the set of starting nodes to be sampled as the starting node of the current sampling sequence, select the node with the largest probability as the starting node of the current sampling sequence, and remove the node from the set of starting nodes to be sampled; where o is the smoothing factor, V c A set of nodes representing the dynamic infection cascade network DICN;
[0043] S2.1.1.4. For each current sampling sequence, when a sampled node u does not have a direct out-degree neighbor node, a node represented by a special symbol '0' is filled at the end of the current sampling sequence; otherwise, the effective infection influence score of the node calculated in step S2.1.1.1 is substituted into formula (5), that is, Calculate the sampling probability of each direct out-degree neighbor node v of u, select the node v with the largest sampling probability as the sampling node, and include it in the current sampling sequence; where o is the smoothing factor, V c Represents the starting node set to be sampled;
[0044] S2.1.1.5. Determine whether the length of the sampling sequence composed of sampling nodes outputted in step S2.1.1.4 satisfies L. If not, iterate step S2.1.1.4 until the length of the output sequence satisfies L. At this time, the sampling of one sequence is completed, and the number of sampling sequences is increased by 1.
[0045] S2.1.1.6. Determine whether K sequences have been sampled. If the number of sampled sequences is less than K, return to execute step S2.1.1.3, and execute subsequent steps in sequence until the number of sampled sequences is K. If the number of sampled sequences is less than K when the set of starting nodes to be sampled is an empty set, restore the set of starting nodes to be sampled to all nodes in the dynamic infection cascade network DICN, and return to execute S2.1.1.3.
[0046] Furthermore, the execution steps of step S2.2 are:
[0047] S2.2.1. Use the attention mechanism 1, i.e. the geometric attention mechanism of small batch division, to assign attention weights to the K sampling sequences obtained in step S2.1. Specifically: first, divide the K sampling sequences obtained in step S2.1 into a fixed size V B The "small batch" of A small batch, using the formula The attention weight assigned to each sequence is calculated, where AA1(k) represents the attention weight assigned to the kth sequence, and p s Learn during training; K and p s The mutual restriction relationship between
[0048] S2.2.2. Use the second attention mechanism, i.e., the standard polynomial distribution of attention, to assign attention weights to the L nodes in each sampling sequence. Specifically, when the i-th node in a given sampling sequence is used, the formula AA2(i) = λ i The attention assigned to each node in the sampled sequence is calculated, where AA2(i) is the attention weight assigned to the i-th node in the sampled sequence, and λ is learned during training. i ,λ i It follows a multinomial distribution, so the multinomial distribution {λ1,λ2,λ3,...,λ L} are applied to the L nodes in the sampling sequence respectively; L and λ i The mutual restriction relationship between
[0049] S2.2.3. Use the attention weights assigned to the K sampling sequences and the attention weights assigned to the L nodes calculated in steps S2.2.1 and S2.2.2 as assembly factors, and embed the K×L nodes of the K sampling sequences output in step S2.1 into the application formula The network embedding is composed of DICN, where is the node embedding of the i-th node in the k-th sampling sequence, Represents the current dynamic infection cascade network DICN.
[0050] On the other hand, the present invention discloses a botnet situation prediction system based on a neural network, comprising the following connected modules:
[0051] The basic zombie infection traffic data set acquisition module is used to achieve the following functions: obtain basic zombie infection traffic data, and use it to construct multiple dynamic infection cascade networks DICN to form a dynamic infection cascade network data set, and divide the data set into a training set, a verification set, and a test set;
[0052] The botnet infection prediction framework builds modules to implement the following functions:
[0053] (1) For each input dynamic infection cascade network DICN, sequence embedding processing is performed to obtain K sequence embeddings of the DICN. Each sampling sequence embedding consists of L node sequences, and the K sequence embeddings contain a total of K×L node embeddings. The node embedding of the i-th node in the k-th sampling sequence is expressed as
[0054] (2) The K sampling sequences obtained in step (1) are embedded and combined using the attention mechanism to obtain the network embedding of the dynamic infection cascade network DICN;
[0055] (3) The network embeddings of all DICNs obtained by iterative processing of steps (1) and (2) are input into the LSTM unit in parallel, and then processed using the masked multi-head self-attention mechanism, and the network embedding of the last DICN is selected as the input of the dynamic prediction module;
[0056] The botnet infection prediction framework pre-training module is used to implement the following functions: train the botnet infection prediction framework using the training set until the set loss function converges to obtain a pre-trained botnet infection prediction framework;
[0057] The botnet infection prediction framework training module is used to implement the following functions: iteratively verify the pre-trained botnet infection prediction framework using the validation set, and select the botnet infection prediction framework with the best performance on the prediction set;
[0058] The final prediction framework training module is used to achieve the following functions: use the test set to test the botnet infection prediction framework, and judge whether it meets the prediction requirements based on the test results and evaluation indicators. If not, return to the botnet infection prediction framework pre-training module, continue iterative training until the test results meet the prediction requirements, and output a botnet infection prediction framework that meets the requirements;
[0059] The testing module is used to predict the size of the botnet using a botnet infection prediction box that meets the prediction requirements.
[0060] Compared with the prior art, the present invention has the following beneficial effects:
[0061] (1) Compared with existing modeling methods, the botnet infection model of the present invention combines the advantages of HIN and SEIR, and achieves the characterization of important local (such as infected nodes and their interactive behaviors) and global (such as global infection topology) characteristics of the overall botnet infection process in spatial and temporal dimensions. Most importantly, the present invention constructs a real P2P botnet dataset based on large-scale detection data. The prediction experimental results of the model on the real dataset prove the effectiveness of the model of the present invention and its good ability to reveal the botnet infection dynamics.
[0062] (2) The innovative framework HintBot proposed in this invention integrates sampling strategies, multiple attention mechanisms and multiple neural networks (NNs). The infection influence priority sampling strategy designed and implemented can sample a series of propagation sequences representative of infection influence from the infection cascade network, effectively extract dynamic heterogeneous infection features in the botnet propagation path, and retain the potential structural spatiotemporal dependencies between botnet nodes. HintBot can deeply understand the propagation of botnets and the entire evolutionary pattern, thereby estimating future propagation trends, such as the scale of propagation and the time of outbreak.
[0063] (3) The infection model and prediction framework constructed by the present invention have demonstrated good results on the constructed large-scale real data set, achieving a high prediction accuracy. The comprehensive experimental results verify that the present invention solves the bottleneck that the existing technology cannot effectively predict the future spread scale and outbreak of botnets, and can effectively predict the situation scale of botnets, help security professionals to perceive important botnet trends in a timely manner, and deploy and implement effective security defense measures in advance before a possible large-scale outbreak causes serious social and economic damage, thereby minimizing the serious harm caused by P2P botnets in the future through attack methods such as DDos. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The accompanying drawings are used to provide further understanding of the present disclosure and constitute a part of the specification. They are used to explain the present disclosure together with the following detailed description, but do not constitute a limitation of the present disclosure.
[0065] Figure 1 It is a botnet infection flow chart of the present invention;
[0066] Figure 2 This is a diagram of a botnet infection model of the present invention;
[0067] Figure 3 This is a diagram of HintBot, a botnet situation scale prediction framework of the present invention. DETAILED DESCRIPTION
[0068] The present invention implements a botnet situation prediction method and prediction system based on neural network in two steps. The first step is to construct a botnet infection model, and the second step is to comprehensively use neural network and other technologies to construct a botnet scale prediction framework. Among them, the botnet infection modeling models the propagation and evolution of the botnet as a dynamic heterogeneous infection network (DHIN) embedded with an improved SEIR (Susceptible-Exposed-Infected-Recovered) mechanism, which can generate multiple continuous dynamic infection cascade networks (DICN), and globally retain the infection propagation characteristics of the botnet across time and space dimensions. Based on the infection cascade network DICN generated by the dynamic heterogeneous infection network DHIN obtained by botnet infection modeling, we then designed an intelligent end-to-end deep learning pipeline called HintBot, which comprehensively applies the Epidemic Influence-First Sampling (EIFS), attention mechanism and multiple neural networks (NNs) to extract and learn the important node-level, path-level and network-level propagation and evolution characteristics of botnets across heterogeneous spatiotemporal dimensions during the propagation process, forming an automated prediction pipeline, and obtaining situation prediction information such as the botnet propagation scale and outbreak time through a series of continuous infection cascade networks formed by botnet modeling.
[0069] To achieve the above-mentioned purpose, the present invention provides the following technical solutions:
[0070] The present invention discloses a method for predicting a botnet situation based on a neural network, comprising the following steps:
[0071] S1. Obtain basic zombie infection traffic data from the National Internet Emergency Center CNCERT, use it to build multiple dynamic infection cascade networks DICN, form a dynamic infection cascade network dataset, and divide the dataset into training set, verification set and test set;
[0072] S2, build a botnet infection prediction framework;
[0073] S3, using the training set obtained in step S1 to train the botnet infection prediction framework obtained in step S2 until the set loss function converges, thereby obtaining a pre-trained botnet infection prediction framework;
[0074] S4, using the validation set obtained in step S1 to iteratively validate the pre-trained botnet infection prediction framework, and selecting the botnet infection prediction framework with the best performance on the prediction set;
[0075] S5, using the test set obtained in step S1 to test the botnet infection prediction framework obtained in step S4, and judging whether it meets the prediction requirements based on the test results and the evaluation index; if not, returning to step S3, continuing iterative training until the test results meet the prediction requirements, and outputting a botnet infection prediction framework that meets the requirements;
[0076] S6. Predict the size of the botnet using the botnet infection prediction box that meets the prediction requirements generated in step S5.
[0077] Furthermore, the step S1 specifically includes the following steps:
[0078] S1.1. The National Internet Emergency Center provided the basic zombie infection traffic captured from August 1, 2020 to September 30, 2020 for a total of 2 months (60 days) as the basic data set;
[0079] S1.2, using the basic data set of zombie infection traffic constructed in step S1.1, for each flow, select src_ip (attack initiator IP address), dst_ip (attacked host IP address), dst_loc (attacked host location), dst_iptype (attacked host line type) and timestamp (threat attack timestamp) items to construct<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection. Note that there are multiple<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> With the same src_ip and dst_ip, but different timestamps, the zombie infection traffic data with the same src_ip and dst_ip are deduplicated according to their timestamps, and only the first one (that is, the one with the earliest timestamp) needs to be retained;
[0080] S1.3, divide the output of step S1.2 by timestamp<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection, forming multiple<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data subsets are used to construct multiple dynamic infection cascade networks. Specifically, the traffic data set from 2020.8.1 to 2020.8.2 (i.e., day 1 to day 2) is used to construct the first dynamic infection cascade network, the traffic data set from 2020.8.1 to 2020.8.4 (i.e., day 1 to day 4) is used to construct the second dynamic infection cascade network, the traffic data set from 2020.8.1 to 2020.8.6 (i.e., day 1 to day 6) is used to construct the third dynamic infection cascade network, and so on, a total of 30 dynamic infection cascade networks are output to construct 30 dynamic infection cascade networks.<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data subset;
[0081] S1.4, using the 30 traffic data subsets divided by timestamp output in step S1.3, a total of 30 dynamic infection cascade networks are constructed as DICN data sets. The construction steps of a single dynamic infection cascade network DICN are as follows:
[0082] S1.4.1 Select a directed edge that is not constructed in the current traffic data subset<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Correspondingly, a unique directed edge with a specific starting point and end point in the dynamic infection cascade network DICN is constructed;
[0083] S1.4.2 Determine the starting point and starting point type of the directed edge: Set src_ip as the starting point of the directed edge and mark the starting point type as Bot (B);
[0084] S1.4.3 Determine the endpoint and endpoint type of the directed edge: Take dst_ip as the endpoint of the directed edge. If the host represented by dst_ip is used as src_ip in a captured traffic data in the future, the endpoint type is marked as Bot (O), otherwise the endpoint type is marked as Target (T);
[0085] S1.4.4 Calculate the edge weight of the directed edge:
[0086] If the start and end points of the directed edges marked in steps S1.4.2 and S1.4.3 are of type Bot(B) and Target(T) respectively, the edge weight is α, which is calculated using formula (1), i.e., α = α1·x1+α2·x2+b, where x1 and x2 are numerical representations of dst_loc and dst_iptype respectively, α1 and α2 are weight coefficients assigned to x1 and x2 respectively, and α1, α2, and b are pre-learned by NN-1. NN-1 is a neural network with one neuron, in which a feature vector that comprehensively represents the attributes of a specific node is input, and "1" or "0" is output, where "1" indicates that the device is prone to become a target of botnet infection, and vice versa;
[0087] If the start and end points of the directed edges marked in steps S1.4.2 and S1.4.3 are of type Bot(B) and Bot(B) respectively, then the edge weight is β, using formula (2), that is, Calculate, where α is calculated using formula (1), N T and N I It is the total number of target devices and infected devices in the botnet during the complete botnet outbreak cycle. This paper calculates the basic bot infection traffic from 2020.8.1 to 2020.9.30 for a total of 2 months (60 days) provided by CNCERT. is 0.00895;
[0088] S1.4.5 Mark the timestamp of the directed edge: Use timestamp as the timestamp of the directed edge;
[0089] S1.4.6 If there are still directed edges that have not been constructed in the current traffic data subset<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> , then iteratively execute step S1.4.1 and its subsequent steps.
[0090] S1.5. Divide the DICN dataset output in step S1.4 into training set, validation set and test set according to a certain ratio.
[0091] Furthermore, the specific method of constructing the botnet infection prediction framework in step S2 is as follows: given a series of continuous dynamic infection cascade networks DICN as model input, before they are sent to the LSTM (Long Short-Term Memory) unit in step S2.3 in parallel, each dynamic infection cascade network DICN is processed in turn in an iterative manner using steps S2.1 and S2.2 to obtain the network embedding of each DICN. Specifically, it includes the following sub-steps:
[0092] S2.1. For each dynamic infection cascade network DICN input into this step, the sequence embedding module of the present invention is input to obtain K sequence embeddings of the DICN. Each sequence embedding consists of L node sequences, and the K sequence embeddings contain K×L node embeddings in total. It should be noted that the node embedding of the i-th node in the k-th sampling sequence obtained in this step is expressed as The specific steps are:
[0093] S2.1.1. Apply the infection influence priority sampling strategy EIFS proposed in the present invention to each dynamic infection cascade network DICN, and obtain a total of K sequences in a certain order, each sequence consisting of L nodes;
[0094] S2.1.2, process each node of each sequence sampled in step S2.1.1 using a node embedding module. Specifically, the node embedding module is used to map the one-hot high-dimensional vector representation of the node to a vector embedding in its unified low-dimensional space. This step obtains a total of K×L node embeddings, each of which constitutes K sequence embeddings;
[0095] S2.1.3, the K sequence embeddings obtained in step S2.1.3 are further processed using a bidirectional gated recurrent unit (Bi-GRU), that is, the L nodes of each sequence are input into the Bi-GRU in parallel, and each node in the sequence is given embedded infection flow information. This step outputs K sequence embeddings, each of which is composed of the L node embeddings that make up the sequence.
[0096] Specifically, step S2.1.1 applies the infection influence priority sampling strategy EIFS to obtain a total of K sequences in a certain order, which specifically includes the following sub-steps:
[0097] S2.1.1.1, using formula (6), that is Calculate the effective infection influence score of each node in the dynamic infection cascade network DICN input into this step. In the formula, v represents the downstream reachable neighbor of node u, W(·) is the weighted scoring function, and D(u, v) represents the effective infection distance between node u and each of its downstream reachable neighbor nodes v;
[0098] Furthermore, the weight score calculation formula for each node u is: Where N out (u) is the set of direct out-degree neighbors of node u, outdeg(w) represents the out-degree of node w, and weight(u, w) refers to the edge weight of the directed edge from node u to node w;
[0099] The calculation formula of the effective infection distance D(u, v) between node u and each of its downstream reachable neighbor nodes u is D(u, v) = min{1-log2(P(u, v) * )}P(u,v) * =P(u,l1)×P(l1,l2)×...×P(l n-1 , l n )×P(l n , v), Among them, from node l i To node l i+1 A directed edge is formed, and nodes from node u to node u need to pass through this directed edge. Represents the slave node l i Select neighbor node l from all direct out-degree neighbors i+1 The average probability, weight(l i , l i+1 ) represents the slave node l i To node l i+1 The edge weights of the directed edges of ;
[0100] S2.1.1.2, initialization sampling step: set the initial values of the number of sampling sequences K and the length of the sampling sequence L, and set the starting node set to be sampled to all nodes in the dynamic infection cascade network DICN of the input step S2.1.1.1;
[0101] S2.1.1.3. Substitute the effective infection influence score of each node in the starting node set to be sampled into formula (4), that is, (where o is the smoothing factor, V cThe node set representing the dynamic infection cascade network DICN) calculates the probability of each node in the starting node set to be sampled being the starting node of the current sampling sequence (a total of K sequences), selects the node with the largest probability as the starting node of the current sampling sequence, and removes the node from the starting node set to be sampled;
[0102] S2.1.1.4. For each current sampling sequence, when a sampled node u does not have a direct out-degree neighbor node, a node represented by a special symbol '0' is filled at the end of the current sampling sequence; otherwise, the effective infection influence score of the node calculated in step S2.1.1.1 is substituted into formula (5), that is, (where o is a smoothing factor) Calculate the sampling probability of each direct out-degree neighbor node v of u, select the node v with the largest sampling probability as the sampling node, and include it in the current sampling sequence;
[0103] S2.1.1.5. Determine whether the length of the sampling sequence composed of sampling nodes outputted in step S2.1.1.4 satisfies L. If not, iterate step S2.1.1.4 until the length of the output sequence satisfies L. At this time, the sampling of one sequence is completed, and the number of sampling sequences is increased by 1.
[0104] S2.1.1.6, determine whether K sequences have been sampled. If the number of sampled sequences is less than K, return to execute step S2.1.1.3, and execute the subsequent steps in sequence until the number of sampled sequences is K. It should be noted that if all nodes in the set of starting nodes to be sampled have been sampled as sequence starting nodes (that is, the set of starting nodes to be sampled is an empty set), but the number of sampling sequences is less than K at this time, then the set of starting nodes to be sampled is restored to all nodes in the dynamic infection cascade network DICN, and return to execute S2.1.1.3. The purpose of this design is: if all nodes in the dynamic infection cascade network DICN have been used as sampling sequence starting nodes, but K sampling sequences have not been obtained, at this time, the nodes that have been used as sampling sequence starting nodes need to be re-selected according to the results calculated by formula (4) in S2.1.1.3, that is, the used nodes can be selected again.
[0105] S2.2, embed the K sampling sequences obtained in step S2.1 into the network embedding module of the present invention. Specifically, the module uses the attention mechanism to combine the K sampling sequence embeddings to obtain the network embedding that represents the entire dynamic infection cascade network DICN. Specifically, the execution steps are:
[0106] S2.2.1. Use attention mechanism 1, i.e., the geometric attention mechanism with small batches, to assign attention weights to the K sampling sequences obtained in step S2.1.
[0107] Specifically: First, divide the K sampling sequences obtained in step S2.1 into fixed-size V B The "small batch" of A small batch, using the formula The attention weight assigned to each sequence is calculated, where AA1(k) represents the attention weight assigned to the kth sequence, and p s Learning during training. Note that after setting the initial value of K in step S2.1.2, the subsequent training and learning process will dynamically adjust the value of K so that the K sampled sequences can best represent the dynamic infection cascade network DICN. K and p s The mutual restriction relationship between
[0108]
[0109] S2.2.2. Use the second attention mechanism of the present invention, that is, the standard polynomial distribution of attention, to assign attention weights to the L nodes in each sampling sequence.
[0110] Specifically, when the i-th node in the given sampling sequence is used, the formula AA2(i) = λ i The attention assigned to each node in the sampled sequence is calculated, where AA2(i) is the attention weight assigned to the i-th node in the sampled sequence, and λ is learned during training. i ,λ i It follows a multinomial distribution, so the multinomial distribution {λ1,λ2,λ3,...,λ L} are applied to the L nodes in the sampling sequence respectively. It should be noted that after setting the initial value of L in step S2.1.2, the subsequent training and learning process will dynamically adjust the value of L so that the dynamic infection cascade network DICN can be best characterized when the sampling sequence has L nodes. L and λ i The mutual restriction relationship between
[0111] S2.2.3. Use the attention weights assigned to the K sampling sequences and the attention weights assigned to the L nodes calculated in steps S2.2.1 and S2.2.2 as assembly factors, and embed the K×L nodes of the K sampling sequences output in step S2.1 into the application formula The network embedding is composed of DICN, where is the node embedding of the i-th node in the k-th sampling sequence, Represents the current dynamic infection cascade network DICN.
[0112] Each time step S2.1 and step S2.2 are sequentially executed, a network embedding of a dynamic infection cascade network DICN can be obtained. The sequential execution of step S2.1 and step S2.2 is iterated until the network embedding of all input dynamic infection cascade networks DICN is obtained.
[0113] S2.3, the network embeddings of all DICNs obtained by iterative processing of steps S2.1 and S2.2 are input into the LSTM unit of the scale evolution embedding module of the present invention in parallel, and then processed by the masked multi-head self-attention mechanism, and the network embedding of the last DICN is selected as the input of the dynamic prediction module. At this time, the botnet infection prediction framework is constructed.
[0114] In order to make the purpose, technical solution and advantages of the present invention clearer, the specific implementation methods of botnet infection modeling and botnet situation prediction model HintBot will be described below.
[0115] 1. Botnet Propagation Modeling
[0116] 2.1 Basic Concepts
[0117] First, the main knowledge and theoretical concepts required to build a botnet infection model are introduced, mainly including the heterogeneous information network (HIN) and the SEIR basic epidemic model.
[0118] (1) Dynamically weighted heterogeneous graph. A dynamically weighted heterogeneous graph is represented as It has a development duration T after starting at initiation time T0 i ,in represents a node set, Represents a set of temporal edges (i.e. events). represents the edge weight set, A set of timestamps representing the timestamps at which edges appear, and represent the predefined node type set and edge type set respectively, and In addition, there are two corresponding type mapping functions, including and Each event e∈ε is defined as a 5-tuple e=(v i ,w,t,r,v j ), where v i and v j are the source node and the target node respectively. is the event weight, is a continuous timestamp, Is the event type.
[0119] (2) Dynamically weighted heterogeneous cascade graph. Let c∈C be a cascade. It starts at T0 and has a development duration T i The dynamically weighted heterogeneous cascade graph is defined as It is a dynamically weighted heterogeneous graph in represents the duration T after the cascade c starts from the initiation time T0 i The internal A subset of a node set, represents a subset of the edge set whose end nodes belong to Represents the edge weight set A subset of A collection of timestamps indicating when an edge appeared A subset of and Represents a set of node types and edge type set A subset of Note that the dynamically weighted heterogeneous cascade graph is identical to the dynamically weighted heterogeneous graph in which it resides. Have the same characteristics.
[0120] (3) Dynamic weighted heterogeneous graph mode. Dynamic weighted heterogeneous graph mode is a dynamic weighted heterogeneous graph. The meta-template of Is the node type For the directed graph defined above, the edge types come from The edge weights come from Timestamp from
[0121] (4) SEIR basic epidemic model. It is a mathematical description of the spread of infection and information, such as the spatial scope, transmission path and dynamic mechanism of infectious diseases. It divides all nodes into four states with multiple state transition rates, where "S" represents susceptible nodes; "E" nodes have been exposed to infected people but cannot infect others for the time being; "I" nodes can infect susceptible neighbors at the infection rate, or they can enter the recovery state at the recovery rate; "R" represents isolated or immune nodes, and the immunity period of nodes in the recovery state is limited in most cases. The state transition rate explains the probability of an entity converting from one type to another. Note that the entire process is dynamically random.
[0122] 2.2 Model construction
[0123] It is of great significance to model the behavior of botnets. It can help us deeply understand the propagation mechanism of different botnet behaviors and understand the fundamental dynamics of the formation of global topology. Based on the large amount of data and research in the center, this paper adopts independent cascade, heterogeneous information network and epidemic propagation theory to systematically model botnets. This paper streamlines the propagation process of P2P botnets as follows: Figure 1 shown.
[0124] The expansion of botnets depends on the continuous infection and exploitation of vulnerable devices. Figure 1 As shown in the figure, the workflow of botnet propagation is as follows:
[0125] (1) Target scanning: At the beginning of infection, the current zombie node conducts a large-scale scan of benign devices by randomly selecting IP addresses.
[0126] (2) Vulnerability exposure: Some benign devices may become targets of zombie node infiltration due to certain vulnerabilities.
[0127] (3) Vulnerability Exploitation: The zombie node attempts to exploit the vulnerability on the target and then downloads the sample file from the sample download web link of the current zombie node.
[0128] (4) Sample download: The zombie node downloads the malicious sample and implants it into the target victim.
[0129] (5) Zombie node binding: Once the infection operation is successfully implemented, the zombie node will bind the victim to the relevant port and try to connect to the peer node.
[0130] (6) Zombie node information upload. The newly infected zombie node uploads its information so that the botnet controller can find and control it.
[0131] The botnet repeatedly performs the above steps, during which vulnerable benign devices are constantly targeted by old zombie nodes and turned into new zombie programs due to successful infection operations. In addition, devices may occasionally die due to shutdown, or they may regain the ability to be infected again one day.
[0132] Based on how P2P communication occurs, the botnet forms an overlay topology. On the other hand, devices may occasionally die due to manual shutdown, vulnerability repair, network or system failure. However, if new vulnerabilities or weak passwords are found on the early dead nodes, they are manually opened, or the failure is repaired, the dead node will be resurrected and become a node that can be captured by the botnet.
[0133] 2.2.1 Node Evolution Paradigm
[0134] Since the spread of botnets is similar to the spread of diseases in a population, we can use the SEIR epidemic model to describe the transition state of individual nodes during the spread of botnets. Figure 1 As shown in the figure, there are four types of entities in the propagation of botnets, namely benign devices (Benign), target devices (Target), zombie nodes (Bot), and dead devices (Dead). For a single node, they can influence and transform each other under certain conditions. For example, a benign device (Benign) will be transformed into a target (Target) because it is selected as an infection object by a zombie node (Bot), and the target device (Target) will be transformed into a new zombie node (Bot) because the infection operation initiated by the zombie node (Bot) is successful. In other words, during the propagation of the botnet, each individual node may have different states. The transition state diagram of the entire single node formally consists of four different states. Therefore, as shown in Figure 2 As shown in (b), the present invention introduces the node evolution paradigm, which is mainly responsible for describing the type change pattern of the main nodes in the botnet infection process, characterizing the dynamic evolution of the node type and the reason why the botnet continues to expand along the infection path in the time dimension. In the node evolution paradigm, there are four types of node states, namely benign, target, zombie, and dead, respectively represented by B, T, O, and D. There are seven types of transitions between any two node states, as shown in Table 1. Through the analysis of the botnet propagation process, we can verify that the two state transitions from benign Benign (B) to target Target (T) and target Target (T) to Bot (B) play an important role in the expansion of the botnet. Next, we constructed a heterogeneous dynamic heterogeneous infection network.
[0135] Table 1 Explanation of the state transition diagram
[0136] Conversion condition B->T Become a target of zombie nodes B->D The device is shut down, or the vulnerability or weak password is fixed T->B Login failure due to vulnerability exploit or weak password T->O Vulnerability exploit or weak password login success T->D The device is shut down, or the vulnerability or weak password is fixed O->D The device is shut down, or the vulnerability or weak password is fixed D->B The device is opened, or a new vulnerability or weak password is discovered
[0137] 2.2.2 Dynamic Heterogeneous Infection Network Model
[0138] Based on the state transition of the existing individual types, the local infection behavior of the botnet is further analyzed. Here, the botnet infection DHIN (Dynamic Hterogeneous Infection Network) model is proposed. As a template for dynamic global networks, such as Figure 2As shown in (a), there are four node types, namely benign, target, zombie node (Bot), and dead (Dead), denoted as B, T, O, and D respectively, and two edge types, namely, choose (Choose) means that the zombie node chooses a device as a target to initiate infection behavior, and successfully infected (Successfully Infected) means that the zombie node successfully infects a new device into a zombie node, denoted as C and IS respectively. The edge has a continuous timestamp t indicating the relative time when the action occurs. s , and two edge weights α and β representing the probability of two types of actions C and IS occurring. Specifically, α represents the probability that the Bot(O) node selects Target(T) to initiate an infection operation, such as the probability of vulnerability exploitation. The α value depends largely on the properties of the node itself, including IP type, location, and available ports, because these properties are always bound to certain specific vulnerabilities. The formula for α is defined here as follows.
[0139] α=α1·x1+α2·x2+b (1)
[0140] Where 0<α<1, α1 and a2 are coefficients associated with the device's IP type and location, respectively. x1 and x2 are numerical values representing the IP type and location of a specific device, respectively. b is the bias coefficient. Note that α1, α2, and b are pre-learned through NN-1, which is a neural network with one neuron. In NN-1, it inputs a feature vector that comprehensively represents the attributes of a specific node and outputs "1" or "0", where "1" means that the device is prone to becoming a target of botnet infection and vice versa.
[0141] More specifically, the edge weight β refers to the probability of a Bot(O) successfully infecting a new Bot(O). Intuitively, its value is determined by two consecutive steps. The first step is that a Bot(O) locks a Target(T) and prepares to initiate an infection action, the probability of which is represented by the edge weight α. The following steps describe the process of Bot(O) successfully converting Target(T) into a new Bot(O). Mathematically, β can be calculated by the following formula:
[0142]
[0143] Where N T and N I is the total number of targeted and infected devices in the botnet. is a fixed probability coming from global statistics.
[0144] The above modeling represents spatial features, such as local topology, temporal characteristics, such as the time of occurrence of marker selection C and successful infection behavior, and heterogeneous properties in the real botnet infection propagation process, namely, multiple device types and actions. In this way, we can define each infection event as a five-tuple e = (u i ,w,t s , r, v j ), where u i and u j are the source node and the target node respectively, φ(v i )=O,φ(v j )=TorO, w is the event weight, t s is a continuous timestamp, and r is the event type, namely C and IS. For example, v i Represents a Bot(O), u j represents a Target(T), r represents a Choose(C) relationship, and v i Select a specific u j Initiate an infection operation with probability w = α. Note that we ignore the scanning behavior initiated by zombie nodes on benign devices when constructing the infection model, because this behavior does not directly cause the increase in the number of zombie nodes.
[0145] The DHIN model provides heterogeneous spatiotemporal dependencies among infected zombie nodes during botnet infection through infection diffusion paths. Therefore, the dynamic diffusion path of botnet infection can be described as This dynamic diffusion path is a semantic abstraction that illustrates a dynamic infection process, where a Bot(O) continuously recruits new indirect Bot(O) through directly infected Bot(O) with a certain probability β.
[0146] 2.2.3 Dynamic Heterogeneous Infection Network and Dynamic Infection Cascade Network
[0147] Now we can observe a continuously expanding zombie epidemic network consisting of target nodes Target(T) and zombie nodes Bot(O) transformed from target nodes. In the dynamic global network where it resides, through infection events, namely Choose(C) and InfectedSuccessfully(IS), it continuously devours benign hosts Benign(B) along different infection paths, expanding the scope of botnet infection. In our work, in order to intuitively and comprehensively reveal the ever-expanding botnet and its variable dynamic global network across space, time and heterogeneous dimensions, based on the proposed DHIN model, such as Figure 2As shown in (c), we generate a dynamic heterogeneous infection network, which starts from T0 and develops i When the development stops, it is recorded as The specific generation process is as shown in Algorithm 1, which continuously assigns IDs to nodes that become new Targets (T) and expands the botnet by iteratively infecting new devices. Note that the generation process will pause until the nodes in the network are immune to the infection, that is, most Benign (B) devices become Bots (O).
[0148]
[0149]
[0150] Among them, the sustainable botnet consisting of visible bot nodes Bot (O), target nodes Target (T), and their edges, edge weights and timestamps is called Dynamic Infection Cascade Network (DICN), denoted as Among them we can observe Infection path characterized by patterns. Note that we focus more on DICN because the dynamic generation process of Bot (O) and target node Target (T) is actually observable from the detection data of the botnet, while the rest of the nodes in DHIN, namely the benign node Benign (B) and the dead node Dead (D), are invisible from the detection data.
[0151] In order to describe the evolution of the overall infection scale of the botnet, Figure 2 As shown in (d), we i ∈{T1, T2, T3, T4, ..., T N} generates a series of consecutive DHINs, represented by and from Take out the corresponding series of continuous DICNs, such as Figure 2 (e) is shown, which is expressed as Our Applications As input for downstream scale prediction tasks.
[0152] 2. Botnet Infection Prediction Framework
[0153] First, we define the problem of botnet size prediction. Then, based on DHIN, we propose Hintbot to predict the future infection size of botnets. Figure 3 As shown in the figure, it consists of five parts, which are introduced below respectively.
[0154] 3.1 Problem Definition
[0155] Before we start to elaborate on the proposed framework, we must formulate the problem to better deal with the problem of botnet situation scale prediction. In the botnet scenario, due to the in-depth analysis of the characteristics of botnets in all three dimensions and the limited botnet detection data in reality, we transform the prediction problem into two specific problems: 1) estimation (prediction) of the future botnet propagation scale, and 2) outbreak time. In addition, a nonlinear prediction function f based on botnet is defined to deal with the above two specific problems.
[0156] Botnet situation scale prediction function. Given a series of continuous DICN The prediction of the future botnet size situation can be considered to be within the set prediction time range. in ΔT is a given time interval, and the future number of nodes in DICN is expressed as Following this line of thought, the outbreak time of the botnet can be considered as the time when the growth rate of the number of DICN nodes exceeds the set outbreak threshold, and then further defined as when B max is the set outbreak threshold. Finally, the botnet situation scale prediction function f is defined as It maps a series of continuous DICNs to digital values representing the scale of future situations through the combined use of sampling strategies, multiple neural networks, and attention mechanisms scattered across the design modules of a sophisticated implementation framework.
[0157] Guided by the botnet situation size prediction function, our proposed framework will be introduced in detail next.
[0158] 3.2 Node Embedding
[0159] The embedding operation of DICN basic unit nodes is the premise for achieving prediction. Figure 3 As shown in (a), node embedding maps the high-dimensional vector representation of nodes in DICN to a unified node embedding in a low-dimensional vector space. The mapping operation for a specific node is as follows:
[0160] x=Aq Formula (3)
[0161] in represents a node embedding with a fixed embedding dimension H, is the shared projection matrix that maps the high-dimensional representation of a node to its low-dimensional vector, N n is the number of nodes in the infection cascade network, H<<N n , The raw one-hot vector representing the node ID.
[0162] 3.3 Sequence Embedding
[0163] Before a given series of DICNs are fed into the LSTM (Long Short-Term Memory) of the scale evolution embedding module in parallel, each of them must be processed iteratively to obtain its overall embedding. Figure 3 (b) shows the sequence embedding, where the Epidemic Influence-First Sampling (EIFS) strategy initially mines features from the smallest unit, that is, the edges between nodes, because the spread of the botnet depends on the infection interaction between botnet nodes and nodes, and assembles the nodes into a sequence according to a certain order determined by the local and global structural features in the spatial dimension, the dynamic infection events in the temporal dimension, and their weights. The higher the ranking of the node in the sequence, the greater the comprehensive infection influence. The sequence embedding module uses a bidirectional gated recurrent unit (Bi-GRU) to continuously embed the infection flow information of each node.
[0164] 3.3.1 Prioritize sampling based on infection influence
[0165] First, in order to To sample the infection, we designed an infection influence priority sampling strategy (EIFS) to capture the complex features across spatial, temporal and heterogeneous dimensions. We perform random walks (RW) on the dataset to obtain a fixed number of sequences of fixed length, and the sampled sequences represent the propagation pattern between nodes along the infection path. Formally, the number of walks is defined as K and the length of the walk is defined as L. Note that most existing works use predefined K and L, while in our work, after setting the initial values, we automatically learn the actual values of K and L during training to obtain the best representation of DICN, which will be described in detail in 3.4. We define S = {S1, S2, ..., S K-1 , S K}, represents a set of sampling sequences of fixed length L, where Represents a sampling sequence. When executing RW, determining the start node for a sequence and the next sampling node in a specific sequence depends on the following two formulas:
[0166]
[0167]
[0168] Where u represents the starting node waiting to be selected, that is, the zombie node Bot(O), v∈N out (u) represents u’s downstream reachable neighbor waiting to be visited, i.e., the zombie node Bot(O) to which u is connected through Successfully Infected(SI), or the target node Target(T) to which u is pointed through Choose(C), o is the smoothing factor, S Einf (·) is the effective infection influence score function. S Einf (u) Comprehensive assessment The effective influence of the middle node u on the spread of botnet infection, and to a large extent, characterizes the specific nodes that u wants to visit. Based on the law of universal gravitation, in order to comprehensively consider the potential local and global complex structural characteristics of the spatial dimension, the dynamic infection interaction between nodes in the time dimension (i.e., infection and successful infection), and the weights of different edges in the heterogeneous dimension, S Einf (u) is defined as follows:
[0169]
[0170] Where W(u) represents the infection weight score of zombie node u, and D(u, v) represents the effective infection distance from u to its downstream neighbor v. W(u) and D(u, v) are described in detail below.
[0171] (1) Zombie node infection weight score
[0172] Commonly used weight scoring functions for nodes, such as degree, out-degree, in-degree, degree centrality, K-shell centrality, clossness centrality, betweenness centrality, etc., cannot measure the role of the semantic content of dynamic infection events between zombie nodes in the time dimension, nor can they measure the weights of different infection events in the heterogeneous dimension. Considering the unidirectional nature of the infection path and the main focus on nodes that spread botnet viruses, the zombie node weight scoring function W(u) is formulated as follows:
[0173]
[0174] Where outdeg(v) represents the out-degree of the downstream reachable neighbor v of node u, and weight(u, v) represents the weight of the edge between node u and its neighbor v. If φ(v) = O, φ(u) = T, then weighl(u, v) = α, otherwise if φ(u) = O, then weight(u, v) - β.
[0175] (2) Effective infection distance
[0176] The effective infection distance is used to evaluate how many hops there are between two zombie nodes on the infection path. Since the weighted edges of HBIN represent the infection probability from one zombie node to another, the effective infection distance emphasizes the shortest path to infect two zombie nodes. In order to accurately describe the distance between two zombie nodes in the network, D(u, v) is formulated as follows:
[0177] D(u,v)=min{1-log2(P(u,v) * )} Formula (8)
[0178] Where P(u, v) * represents the probability that u selects its directly or indirectly reachable downstream neighbor, P(u, v) * The formula is as follows:
[0179] P(u,v) * =P(u,l1)×P(l1,l2)×…×P(l n-1 , l n )×P(l n ,v) Formula (9)
[0180] Where P(l i , l i+1 ) is l i Select its direct neighbor l i+1 The probability of is defined as follows:
[0181]
[0182] in Indicates that from l i Among the many direct neighbors, select l i+1 The average probability, weight(I i , I i+1 ) indicates that from l i To i+1 The probability of an infection event occurring.
[0183] Now, we can perform the proposed EIFS on DICN under the guidance of equations (4) and (5) to determine which node to start walking from and which node to walk to in a specific walk, respectively, where K and L determine the number of walks and the length of the walk. Note that a traversal does not stop until the length L is reached, but the node sequence with a length less than L must be extended by filling it with a special node "0", and if all nodes are sampled once as the starting node of the traversal, the node that is already the starting node of the traversal can be sampled again according to equation (4) until the K sequence is sampled.
[0184] 3.3.2 Bidirectional Gated Recurrent Unit
[0185] When sampling K sequences S, S={S1,S2,...,S K-1 , S K , S k ∈R L}, each of which consists of L nodes, representing an infection diffusion path. Next, after obtaining K sequence embeddings back, By iteratively processing each sequence with the node embedding described in 3.2, we apply Bi-GRU, a simple variant of Recurrent Neural Network (RNN), which is often used to encode the potential temporal and long-range association information in the mined sequence into each node in the sequence. This association information comes from the node currently being encoded and the nodes before or below it. Formally, we call the processing of the i-th node in a sequence the i-th step. The bi-GRU we apply to calculate the updated hidden state is expressed as follows:
[0186]
[0187] in Represents the i-th node x i The embedding vector in the kth sequence combines the hidden states of the previous node and the next node. is the concatenation operator, Represents GRU based on the hidden state of its previous node Compute Node x i The current hidden state of Refers to GRU based on the hidden state of the next node Compute Node x i The current hidden state of each GRU unit contains an update gate and a reset gate, where the reset gate effectively controls the hidden layer to discard any later or previously discovered irrelevant information, while the update gate controls how much information from previous or later hidden states to transmit. For example, each GRU unit calculates the updated hidden state vector of each input node as follows:
[0188]
[0189] in Represents the embedding vector of the i-th node in the k-th sequence of the combined previous node hidden state. The specific calculation process is as follows:
[0190]
[0191] where i∈{1, 2, 3, ..., L}, k∈{1, 2, 3, ..., K}, r i , represent the update and reset gates respectively, W r , W z , W h , U r , U z , and b r , b z , is a trainable parameter, σ(·) is an activation parameter, and ⊙ indicates an element-wise XNOR operator. In the iteration equation, For the hidden state from the previous The latent features are encoded in In From the next hidden state Encode the potential features.
[0192] Finally, we get the output of the sequence embedding module, denoted as It is represented as a set of K sequence embeddings, consisting of K×L node embeddings, which enrich the temporal interaction features of the spread from the previous or next node along the infection path in the time dimension, and its order is determined by the effective infection score function S Einf (·) Indirect determination, which helps to fully display the botnet propagation characteristics, including the latent structure in the spatial dimension, the semantic content of dynamic infection events between nodes in the temporal dimension, and the weights of different events in the heterogeneous dimension. However, for specific prediction tasks, it is necessary to further combine sequence embedding into the effective embedding of the entire DICN, and this mechanism will be described in the next section.
[0193] 3.4 Network Embedding
[0194] Since our goal is to generate effective low-dimensional representations of DICN, the main focus is to design an assembly method to further learn effective representations of the network by combining K sequence embeddings into a single network embedding. Figure 3 As shown in (c), we introduce an attention mechanism, where two types of attention are applied to different sequences and each node in each sequence. Note that in our application, the specific values of the total number of sequences K and the sequence length L are different from most existing works, such as DeepWalk, which use predefined static K and L when performing Rand Walk to samples, while we convert the fixed K and L into dynamic adjustable values. During the neural network training process, the size of K and L is continuously adjusted until the obtained K and L can best express the DICN network to obtain the best prediction effect. Since the attention mechanism is used to assemble sequences and nodes in sequences, and it requires two parameters: the assembly length (i.e., K and L) and the specific assigned weights, and no additional information can be obtained for determination, the weights assigned to different sequences and different nodes in the sequence must be sufficient and necessary conditions for K and L. We use geometric attention based on mini-batch partitioning, called attention mechanism one, i.e., AA1(·), to assemble different sequence embeddings; and use standard polynomial attention distribution, called attention mechanism two, i.e., AA2(·), to assemble different node embeddings in each sequence into sequence embeddings.
[0195] (1) Attention Mechanism 1
[0196] To determine the attention on different sequences, we first divide the sampled K sequences into fixed-size V B The "small batch" is divided into Assign attention weights to each sequence, using the following formula:
[0197]
[0198] Where AA1(k) represents the attention weight assigned to the kth sequence, p s represents the basic geometric probability of DICN learned during training, where K is also learned during training. Note that K and p s The mutual restriction relationship between them is expressed by the following formula:
[0199]
[0200] (2) Attention Mechanism 2
[0201] After assigning attention to individual sequences, the next key step is to assign attention to each node in the sequence. We adopt a standard multinomial distribution for attention. Therefore, when given the i-th node in a sequence, its attention weight is calculated by AA2(·):
[0202] AA2(i)=λ i Formula (16)
[0203] where AA2(i) is the attention weight assigned to the i-th node in the sequence, and λ is learned during training. i It follows a multinomial distribution, so the multinomial distribution {λ1,λ2,λ3,...,λ L} are applied to L nodes respectively. Note that L and λ i The mutual restriction relationship between them satisfies:
[0204]
[0205] The key attention of AA1(k) and AA2(·) is used as the assembly factor to obtain DICN A low-dimensional representation of . When applying attention on a sequence, the output is defined as follows:
[0206]
[0207] in Represents DICN Embedded.
[0208] Through the sequence embedding and network embedding modules, the overall low-dimensional representation of DICN is obtained The node-level and path-level features of the spatiotemporal and heterogeneous dimensions are fully embedded. However, considering that the future botnet propagation scale is closely related to the trend change of the overall scale of the historical network, it is necessary to further learn the network-level features in the time dimension, that is, the overall scale evolution pattern of the network, which exists in a series of continuous DICNs, and the termination development time of each DICN has the same interval ΔT. The scale evolution embedding module will be described in detail next.
[0209] 3.5 Scale Evolution Embedding
[0210] As mentioned above, we continue to explore the dynamics of the overall network-level evolution of a series of continuous DICNs evolving over time. Figure 3 As shown in (e), the scale evolution embedding is first performed in each given DICN. We apply LSTM units on the embeddings to capture relevant information from the evolution history of DICN, and then apply Masked Multi-Head Self-Attention on all processed embeddings to cleverly learn more discovered potential evolutionary features, outputting the final embedding for our prediction task.
[0211] (1) Long Short-Term Memory Network (LSTM)
[0212] Intuitively, the formation of the current scale state of DICN depends more on the past state, that is, the historical DICN Therefore, after obtaining a series of embeddings for a series of consecutive DICNs, it is expressed as In order to capture the correlation and overall changes between DICN states in historical time, we apply LSTM, which is a classic recurrent neural network (RNN) variant, similar to the GRU shown in 3.3.2. It is often used as a tool to capture the potential temporal and long-distance correlation information captured by the node embedding being encoded. Unlike GRU, LSTM units are more complex, with forget gates, input gates, storage units, and output gates. Usually, for a single The formula of the applied LSTM unit is as follows:
[0213]
[0214] Where T i ∈{T1, T2, T3, ..., T N}, Respectively represent the forget gate, input gate, storage unit and output gate, W f , W i , W c , W o , U f , U i , U c , and b f , b i , is a trainable parameter and σ(·) is the activation function.
[0215] We got The output of LSTM is recorded as Next, masked multi-head self-attention is introduced to further explore and model the potential scale evolution features, integrating all given DICNs into one representation.
[0216] (2) Masked Multi-Head Self-Attention Mechanism
[0217] As the last step of modeling network representation, the final output learned embedding will highly summarize the propagation and evolution characteristics of the botnet at the node level, path level, and network level, which is crucial for prediction tasks such as the estimation of the future botnet propagation scale. Therefore, we use the masked multi-head self-attention mechanism inspired by Transformer to integrate the embeddings of multiple consecutive DICNs generated by LSTM with the potential evolutionary patterns of the botnet passed from the previous state. First, we calculate the self-attention score matrix, which is usually used to determine how much the current encoding network cares about other input encodings, and has the advantages of fast processing speed, less information loss, and better interpretation. To calculate, we embed the DICN Mapping to different feature spaces to generate Query, Key and Value, the process is formulated as:
[0218]
[0219] in, Represented as G h Query, Key and Value, W Q , W K , is a trainable parameter. Then, we apply Scaled Dot-Product Attention to calculate G h The self-attention on , is expressed as follows:
[0220]
[0221] in Represents the output embedding with self-attention. Note that considering that the current scale of the botnet DICN only depends on the historical scale state, we introduce a mask matrix To control the discarding of later scale states and only receive information from historical scale states. If m≤n, set M mn =0, otherwise, M un =-∞, to eliminate the interference received by DICNu from the redundant state transmitted by the subsequent DICNu, thereby speeding up the processing speed.
[0222] When using the κ′ head multi-head mechanism, a set of Query, Key and Value weight matrices are maintained independently for each head, embedding the original G h Projected into different spaces, thus capturing and retaining more evolutionary features in different subspaces. h The multi-head attention formula on is:
[0223]
[0224] We use The final embedding of is represented as As the final learned embedding of a series of consecutive DICN sequences for downstream dynamic prediction tasks, it features the latent scale evolution among all historical DICNs.
[0225] 3.6 Dynamic Prediction
[0226] By applying (b) sequence embedding, (c) the network embedding module iteratively generates each and use (d) the scale evolution embedding module to embed multiple The series of embeddings of botnets are transformed into an overall embedding, producing a comprehensive embedding that contains the botnet propagation and evolution patterns. This embedding fully learns to encode node-level, path-level, and network-level features in spatiotemporal and heterogeneous dimensions. Considering the problem of predicting the size of botnets defined, i.e., estimating the size of botnets in the future, we finally obtain the embedding is fed to (e) a dynamic prediction module, such as Figure 3 As shown in (e), the module consists of an MLP (Multi Layer Perceptron) followed by a nonlinear activation layer, and the formula is:
[0227]
[0228] in Indicates that within the set forecast range After that, the predicted future botnet situation size is given, where σ(·) represents the nonlinear ReLU activation operation. Note that given the large size of DICN (consisting of millions of nodes), the predicted actual value of the future size, i.e., the number of nodes, is further converted to:
[0229]
[0230] The back propagation loss function is:
[0231]
[0232] in and They are The predicted value and groundtruth of the future scale, yes The groundtruth of the number of future nodes, is the L2 norm regularization of the learning parameters to prevent overfitting. We use the adaptive moment estimation (Adam) optimizer to minimize the loss function. Following this idea, we can get The estimated value of the future size of DICN after that can be deduced as the outbreak time
[0233] The pseudocode of our HintBot is illustrated in Algorithm 2, which achieves effective prediction by learning representations of multi-dimensional features of botnet propagation and evolution patterns.
[0234]
Claims
1. A method for predicting botnet situation based on neural network, characterized in that: The steps include: S1. Obtain basic zombie infection traffic data, use it to construct multiple dynamic infection cascade networks DICN, form a dynamic infection cascade network dataset, and divide the dataset into a training set, a validation set, and a test set; specifically, the following steps are included: S1.1, capture 2 months of basic zombie infection traffic as the basic data set; S1.2, using the basic data set of zombie infection traffic constructed in step S1.1, for each traffic, select the attack initiator IP address src_ip, the attacked host IP address dst_ip, the attacked host location dst_loc, the attacked host line type dst_iptype and the threat attack timestamp timestamp, and construct<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection; S1.3, divide the output of step S1.2 by timestamp<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection, forming multiple<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> The traffic data subsets are used to construct multiple dynamic infection cascade networks; the traffic data set from day 1 to day 2 is used to construct the first dynamic infection cascade network, the traffic data set from day 1 to day 4 is used to construct the second dynamic infection cascade network, the traffic data set from day 1 to day 6 is used to construct the third dynamic infection cascade network, and so on, a total of 30 dynamic infection cascade networks are output to construct 30 dynamic infection cascade networks.<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data subset; S1.4, using the 30 traffic data subsets divided according to timestamps output in step S1.3, a total of 30 dynamic infection cascade networks are constructed as DICN data sets; S1.5, divide the DICN data set output in step S1.4 into training set, validation set and test set according to a certain ratio; S2. Construct a botnet infection prediction framework; specifically, it includes the following sub-steps: S2.
1. For each input dynamic infection cascade network DICN, sequence embedding processing is performed to obtain K sequence embeddings of the DICN. Each sampling sequence embedding consists of L node sequences, and the K sequence embeddings contain K×L node embeddings in total. The node embedding of the i-th node in the k-th sampling sequence is expressed as S2.2, the K sampling sequence embeddings obtained in step S2.1 are combined using the attention mechanism to obtain the network embedding of the dynamic infection cascade network DICN; S2.3, the network embeddings of all DICNs obtained by iterative processing of steps S2.1 and S2.2 are input into the LSTM unit in parallel, and then processed using the masked multi-head self-attention mechanism, and the network embedding of the last DICN is selected as the input of the dynamic prediction module; S3, using the training set obtained in step S1 to train the botnet infection prediction framework obtained in step S2 until the set loss function converges, thereby obtaining a pre-trained botnet infection prediction framework; S4, using the validation set obtained in step S1 to iteratively validate the pre-trained botnet infection prediction framework, and selecting the botnet infection prediction framework with the best performance on the prediction set; S5, using the test set obtained in step S1 to test the botnet infection prediction framework obtained in step S4, and judging whether it meets the prediction requirements based on the test results and the evaluation index; if not, returning to step S3, continuing iterative training until the test results meet the prediction requirements, and outputting a botnet infection prediction framework that meets the requirements; S6. Predict the size of the botnet using the botnet infection prediction box that meets the prediction requirements generated in step S5.
2. The method for predicting a botnet situation based on a neural network as claimed in claim 1, characterized in that: In step S1.2, for multiple<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> If the src_ip and dst_ip are the same but the timestamps are different, the one with the earliest timestamp is retained.
3. The method for predicting a botnet situation based on a neural network as claimed in claim 1, characterized in that: In step S1.4, the construction steps of each dynamic infection cascade network DICN are as follows: S1.4.1 Select a directed edge that is not constructed in the current traffic data subset<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Correspondingly, a unique directed edge with a specific starting point and end point in the dynamic infection cascade network DICN is constructed; S1.4.2 Determine the starting point and starting point type of the directed edge: Set src_ip as the starting point of the directed edge and mark the starting point type as Bot (B); S1.4.3 Determine the endpoint and endpoint type of the directed edge: Take dst_ip as the endpoint of the directed edge. If the host represented by dst_ip is used as src_ip in a captured traffic data in the future, the endpoint type is marked as Bot (O), otherwise the endpoint type is marked as Target (T); S1.4.4 Calculate the edge weight of the directed edge: If the start and end points of the directed edges marked in steps S1.4.2 and S1.4.3 are of type Bot(B) and Target(T) respectively, then the edge weight is α, which is calculated using formula (1), i.e., α = α1·x1+α2·x2+b, where x1 and x2 are the numerical representations of dst_loc and dst_iptype respectively, α1 and α2 are the weight coefficients assigned to x1 and x2 respectively, and α1, α2 and b are pre-learned by NN-1; If the start and end points of the directed edges marked in steps S1.4.2 and S1.4.3 are of type Bot(B) and Bot(B) respectively, then the edge weight is β, using formula (2), that is, Calculate, where α is calculated using formula (1), N T and N I is the total number of targeted and infected devices in the botnet during the complete botnet outbreak cycle; S1.4.5 Mark the timestamp of the directed edge: Use timestamp as the timestamp of the directed edge; S1.4.6 If there are still directed edges that have not been constructed in the current traffic data subset<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> , then iteratively execute step S1.4.1 and its subsequent steps.
4. The method for predicting a botnet situation based on a neural network as claimed in claim 1, characterized in that: The specific execution steps of step S2.1 are: S2.1.
1. Apply the infection influence priority sampling strategy EIFS to each dynamic infection cascade network DICN, and obtain a total of K sequences in a certain order, each sequence consists of L nodes; S2.1.2, each node of each sequence sampled in step S2.1.1 is processed using a node embedding module. Specifically, the node embedding module is used to map the one-hot high-dimensional vector representation of the node to a vector embedding in its unified low-dimensional space; this step obtains a total of K×L node embeddings, each of which constitutes K sequence embeddings; S2.1.
3. The K sequence embeddings obtained in step S2.1.3 are further processed using a bidirectional gated recursive unit, i.e., the L nodes of each sequence are input into the bidirectional gated recursive unit in parallel, and each node in the sequence is given embedded infection flow information; this step outputs K sequence embeddings, each of which is composed of the L node embeddings that constitute the sequence.
5. The method for predicting a botnet situation based on a neural network as claimed in claim 1, characterized in that: The step S2.1.1 applies the infection influence priority sampling strategy EIFS to obtain a total of K sequences in a certain order, which specifically includes the following sub-steps: S2.1.1.1, using formula (6), that is Calculate the effective infection influence score of each node in each dynamic infection cascade network DICN input into this step; where v represents the downstream reachable neighbor of node u, W(·) is the weighted scoring function, and D(u, v) represents the effective infection distance between node u and each of its downstream reachable neighbor nodes v; Furthermore, the weight score calculation formula for each node u is: Where N out (u) is the set of direct out-degree neighbors of node u, outdeg(w) represents the out-degree of node w, and weight(u, w) refers to the edge weight of the directed edge from node u to node w; The calculation formula of the effective infection distance D(u, v) between node u and each of its downstream reachable neighbor nodes v is: Among them, from node l i To node l i+1 A directed edge is formed, and the path from node u to node v needs to pass through this directed edge. Represents the slave node l i Select neighbor node l from all direct out-degree neighbors i+1 The average probability, weight(l i , l i+1 ) represents the slave node l i To node l i+1 The edge weights of the directed edges of ; S2.1.1.2, initialization sampling step: set the initial values of the number of sampling sequences K and the length of the sampling sequence L, and set the starting node set to be sampled to all nodes in the dynamic infection cascade network DICN of the input step S2.1.1.1; S2.1.1.
3. Substitute the effective infection influence score of each node in the starting node set to be sampled into formula (4), that is, Calculate the probability of each node in the set of starting nodes to be sampled as the starting node of the current sampling sequence, select the node with the largest probability as the starting node of the current sampling sequence, and remove the node from the set of starting nodes to be sampled; where o is the smoothing factor, V c A set of nodes representing the dynamic infection cascade network DICN; S2.1.1.
4. For each current sampling sequence, when a sampled node u does not have a direct out-degree neighbor node, a node represented by a special symbol '0' is filled at the end of the current sampling sequence; otherwise, the effective infection influence score of the node calculated in step S2.1.1.1 is substituted into formula (5), that is, Calculate the sampling probability of each direct out-degree neighbor node v of u, select the node v with the largest sampling probability as the sampling node, and include it in the current sampling sequence; where o is the smoothing factor; S2.1.1.
5. Determine whether the length of the sampling sequence composed of sampling nodes outputted in step S2.1.1.4 satisfies L. If not, iterate step S2.1.1.4 until the length of the output sequence satisfies L. At this time, the sampling of one sequence is completed, and the number of sampling sequences is increased by 1. S2.1.1.
6. Determine whether K sequences have been sampled. If the number of sampled sequences is less than K, return to execute step S2.1.1.3, and execute subsequent steps in sequence until the number of sampled sequences is K. If the number of sampled sequences is less than K when the set of starting nodes to be sampled is an empty set, restore the set of starting nodes to be sampled to all nodes in the dynamic infection cascade network DICN, and return to execute S2.1.1.
3.
6. The method for predicting botnet situation based on neural network as claimed in claim 1, characterized in that: The execution steps of step S2.2 are: S2.2.
1. Use the attention mechanism 1, i.e. the geometric attention mechanism of small batch division, to assign attention weights to the K sampling sequences obtained in step S2.
1. Specifically: first, divide the K sampling sequences obtained in step S2.1 into a fixed size V B The "small batch" of A small batch, using the formula The attention weight assigned to each sequence is calculated, where AA1(k) represents the attention weight assigned to the kth sequence, and p s Learn during training; K and p s The mutual restriction relationship between S2.2.
2. Use the second attention mechanism, i.e., the standard polynomial distribution of attention, to assign attention weights to the L nodes in each sampling sequence. Specifically, when the i-th node in a given sampling sequence is used, the formula AA2(i) = λ i The attention assigned to each node in the sampled sequence is calculated, where AA2(i) is the attention weight assigned to the i-th node in the sampled sequence, and λ is learned during training. i ,λ i It follows a multinomial distribution, so the multinomial distribution {λ1,λ2,λ3,...,λ L } are applied to the L nodes in the sampling sequence respectively; L and λ i The mutual restriction relationship between S2.2.
3. Use the attention weights assigned to the K sampling sequences and the attention weights assigned to the L nodes calculated in steps S2.2.1 and S2.2.2 as assembly factors, and embed the K×L nodes of the K sampling sequences output in step S2.1 into the application formula The network embedding is composed of DICN, where is the node embedding of the i-th node in the k-th sampling sequence, Represents the current dynamic infection cascade network DICN.
7. A botnet situation prediction system based on neural network, characterized in that: Includes the following modules connected: The basic zombie infection traffic data set acquisition module is used to achieve the following functions: obtain basic zombie infection traffic data, and use it to build multiple dynamic infection cascade networks DICN, form a dynamic infection cascade network data set, and divide the data set into a training set, a verification set, and a test set; specifically, it includes the following processes: Step 1: Capture 2 months of basic zombie infection traffic as the basic data set; Step 2: Using the basic data set of zombie infection traffic constructed in step 1, for each traffic, select the attack initiator IP address src_ip, the attacked host IP address dst_ip, the attacked host location dst_loc, the attacked host line type dst_iptype and the threat attack timestamp timestamp to construct<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection; Step 3: Divide the output of step 2 by timestamp<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data collection, forming multiple<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> The traffic data subsets are used to construct multiple dynamic infection cascade networks; the traffic data set from day 1 to day 2 is used to construct the first dynamic infection cascade network, the traffic data set from day 1 to day 4 is used to construct the second dynamic infection cascade network, the traffic data set from day 1 to day 6 is used to construct the third dynamic infection cascade network, and so on, a total of 30 dynamic infection cascade networks are output to construct 30 dynamic infection cascade networks.<src_ip,dst_ip,dst_loc,dst_iptype,timestamp> Traffic data subset; Step 4: Use the 30 traffic data subsets divided according to timestamps output in step 3 to construct a total of 30 dynamic infection cascade networks as DICN data sets; Step 5: Divide the DICN data set output in step 4 into training set, validation set and test set according to a certain ratio; The botnet infection prediction framework builds modules to implement the following functions: (1) For each input dynamic infection cascade network DICN, sequence embedding processing is performed to obtain K sequence embeddings of the DICN. Each sampling sequence embedding consists of L node sequences, and the K sequence embeddings contain a total of K×L node embeddings. The node embedding of the i-th node in the k-th sampling sequence is expressed as (2) The K sampling sequences obtained in step (1) are embedded and combined using the attention mechanism to obtain the network embedding of the dynamic infection cascade network DICN; (3) The network embeddings of all DICNs obtained by iterative processing of steps (1) and (2) are input into the LSTM unit in parallel, and then processed using the masked multi-head self-attention mechanism, and the network embedding of the last DICN is selected as the input of the dynamic prediction module; The botnet infection prediction framework pre-training module is used to implement the following functions: train the botnet infection prediction framework using the training set until the set loss function converges to obtain a pre-trained botnet infection prediction framework; The botnet infection prediction framework training module is used to implement the following functions: iteratively verify the pre-trained botnet infection prediction framework using the validation set, and select the botnet infection prediction framework with the best performance on the prediction set; The final prediction framework training module is used to achieve the following functions: use the test set to test the botnet infection prediction framework, and judge whether it meets the prediction requirements based on the test results and evaluation indicators. If not, return to the botnet infection prediction framework pre-training module, continue iterative training until the test results meet the prediction requirements, and output a botnet infection prediction framework that meets the requirements; The testing module is used to predict the size of the botnet using a botnet infection prediction box that meets the prediction requirements.
