Malicious host detection method and system based on graph neural network
By building a host communication graph, performing sample balance processing and node feature enhancement, combined with graph neural network technology, the problem of imbalanced data quantity and unused implicit information in malicious host detection is solved, and efficient malicious host detection is achieved.
Patent Information
- Application Number
- CN202411166542.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-11-29
Smart Images

Figure CN119051939A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method and system for effectively detecting the presence of malicious behavior hosts in a network, and belongs to the cross-technical field of combining graph neural networks with network security. Background Art
[0002] With the rapid development of the Internet, people's demand for online Internet services continues to increase. In order to meet the growing demand for online Internet services, network service operators have established large-scale networks and data centers to significantly improve the coverage and quality of network services. In the huge Internet architecture system, the host plays a core role as a physical carrier for storing and processing data and providing application services. Whether it is personal information, corporate data or online services, they all rely on the stable operation of the host. Therefore, the importance of host security to Internet security cannot be ignored. Once the host is attacked, on the one hand, it may cause the loss and damage of critical data, and on the other hand, it may spread rapidly through network connections and affect more network devices. In order to protect the security of the host, practitioners in the field of network security have proposed many methods to detect the security status of the host.
[0003] In order to protect the security of hosts in the network, network security practitioners have proposed many detection schemes, which are collectively referred to as host intrusion detection systems (HIDS). In HIDS research, according to the technology used in the detection method, it can be divided into rule-based and feature-based detection methods, machine learning-based detection methods, and deep learning-based detection methods. Among them, the rule-based and feature-based methods were developed the earliest and are the most widely used, but the effect is usually not ideal and is easy to be bypassed; there are many related studies on machine learning-based methods, and the common detection idea is to form a baseline to describe the normal state of the host system, and use the difference between the real-time state and the baseline as an indicator for judging abnormalities; the deep learning-based method is relatively new and is in an emerging development stage. Relevant researchers have proposed many novel methods.
[0004] Among the above methods, the detection method based on deep learning uses the powerful representation and learning capabilities of deep neural networks to automatically extract features and identify complex patterns from large amounts of data. In the field of malicious host detection, commonly used deep learning technologies include convolutional neural networks (CNN), recurrent neural networks (RNN), long short-term memory networks (LSTM), autoencoders, and graph neural networks (GNN). CNN is good at processing structured data, RNN and LSTM can effectively capture the time dependency of sequence data, autoencoders can identify abnormal behaviors through reconstruction errors, and GNN can use graph structured data to analyze the relationship between hosts and network topology. Among them, GNN technology has a natural fit with the graph topology structure of host network communication, and shows great potential in the malicious host detection task. Therefore, its application in the field of malicious host detection has also attracted more and more attention.
[0005] There are many research applications of graph neural network technology in the field of malicious host detection, but there are still some problems that have not been solved. For example, the data collection and processing time span used in detection is long, and the granularity of the overall data in the time dimension is difficult to accurately locate the time of network attacks; the number of normal information and abnormal information in network traffic data is very different, which makes it difficult for the detection model to learn the features of a few categories; it is difficult to make accurate detections relying solely on explicit information, and existing detection methods lack the mining and utilization of high-value implicit information. Therefore, this method designs a host communication graph construction algorithm and a graph neural network node classification algorithm and combines them to solve the above difficulties and improve the accuracy of malicious host detection. Summary of the invention
[0006] The purpose of the present invention is to propose a malicious host detection scheme based on a relational edge graph neural network. By constructing a host communication graph, performing sample balancing processing and node feature enhancement based on a subgraph structure, and finally performing node classification based on graph neural network technology, effective malicious host detection in the network can be achieved. The problem of imbalance in the number of normal and malicious samples in the detection data can be solved, and the problem of high-value implicit information not being fully utilized can be solved.
[0007] The present invention adopts the following technical solutions to achieve the above-mentioned purpose:
[0008] A malicious host detection method based on graph neural network includes the following steps:
[0009] (1) Slice network traffic data into short time windows;
[0010] (2) Aggregate and remove duplicate traffic with the same source, destination, and protocol within a short time window;
[0011] (3) constructing a host communication graph based on the communication relationships between communication endpoints contained in the deduplicated traffic data within each short time window;
[0012] (4) Perform sample balancing based on the subgraph structure of the host communication graph, and undersample and oversample the minority malicious samples;
[0013] (5) Obtain subgraph topology information of the host communication graph and enhance node features based on the subgraph topology information;
[0014] (6) Aggregate the features of each node and its neighboring nodes through the host state convolution layer;
[0015] (7) Aggregate edge features through the communication behavior convolution layer and convolutionally learn each communication behavior of the host;
[0016] (8) Concatenate the node features output by the host status convolution layer and the edge features output by the communication behavior convolution layer, input the concatenated features into the fully connected layer for nonlinear transformation, and output the judgment result of whether it is a malicious host;
[0017] (9) Use the training data with real labels to train the fully connected layer, calculate the binary cross entropy loss function, and optimize the parameters of the fully connected layer with the goal of minimizing the loss value of the binary cross entropy loss function. After the training is completed, it is used to formally detect malicious hosts.
[0018] Furthermore, the step of slicing the network traffic data into short-time windows in step (1) includes: sorting the network traffic data by timestamp, calculating the total time span of the network traffic data, and dividing the total time span into multiple short-time windows according to the required number of time windows; initializing an empty list for each short-time window, and storing the network traffic data belonging to the short-time window into the corresponding empty list according to the timestamp information, thereby realizing short-time window slicing processing.
[0019] Furthermore, in step (3), the communication endpoints include a source IP:Port pair and a destination IP:Port pair, each serving as a node in the host communication graph, and the communication relationship between the communication endpoints serves as an edge between the nodes in the host communication graph; the edge types include five communication characteristics, namely, duration, the number of packets transmitted in the forward direction, the number of packets transmitted in the reverse direction, the number of bits transmitted in the forward direction, and the number of bits transmitted in the reverse direction, and a type characteristic of whether it is malicious behavior.
[0020] Furthermore, the step of performing sample balancing processing based on the subgraph structure of the host communication graph in step (4) includes: dividing the connected subgraphs in the host communication graph into a subgraph set G0 consisting of all normal nodes and a subgraph set G1 in which malicious nodes account for more than 50%; when undersampling, grouping the subgraphs in set G0 according to the number of nodes, directly removing single-node subgraphs, and randomly deleting multi-node subgraphs at a ratio of 50%; when oversampling, sorting the subgraphs in set G1 in descending order according to the proportion of malicious nodes and cyclically replicating them in sequence until the ratio of malicious nodes to normal nodes reaches a preset value.
[0021] Furthermore, in step (5), node feature enhancement based on subgraph topology information includes adding eight node features: degree centrality, betweenness centrality, closeness centrality, weighted out-degree, weighted in-degree, center, radius and size.
[0022] Furthermore, in step (6), the host state convolution layer is composed of multiple layers of GCN layers and ReLU layers arranged alternately, where the ReLU layer performs a nonlinear transformation on each input feature, converting negative values to zero and keeping positive values unchanged; the GCN layer traverses each node and performs weighted aggregation of first-order neighbor features, expressed as:
[0023]
[0024] Among them, H (l) is the node feature matrix of the lth layer, W (l) is the weight matrix learned in layer l, is the adjacency matrix with self-loops added, is the degree matrix used to normalize the adjacency matrix, and σ is the activation function.
[0025] Furthermore, in step (7), the communication behavior convolution layer is composed of multiple layers of ECN layers and ReLU layers arranged alternately, where the ReLU layer is used to perform nonlinear transformation on each input feature; the ECN layer performs edge feature convolution aggregation for multiple edge types, and the expression is:
[0026]
[0027] in, is the feature of edge e at level l-1, is the weight matrix for edge type r, is the set of all outgoing edges of type r from node v, where R is the set of edge types, c v is the normalization coefficient of node v, and σ is the activation function.
[0028] Furthermore, in step (8), the step of inputting the concatenated features into the fully connected layer for nonlinear transformation includes: first inputting the concatenated features into the first fully connected layer for linear transformation, then inputting the values generated by the linear transformation into the second fully connected layer for nonlinear transformation, and outputting the probability of whether it is a malicious host.
[0029] Furthermore, the expression of the binary cross entropy loss function in step (9) is:
[0030]
[0031] Among them, L BCE is the binary cross entropy loss function, N is the number of samples in the training data set; y i is the true label of the i-th sample, which is 0 or 1; p i is the probability of predicting that the i-th sample is a normal host.
[0032] A malicious host detection system based on graph neural network includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0033] Compared with the prior art, the present invention has the following positive effects:
[0034] (1) The present invention uses time window slicing technology to slice data, so that the data in each slice can accurately describe the network status in a shorter period of time, solving the problem that the time span of data collection and processing is long and it is difficult to accurately locate the time of network attacks.
[0035] (2) The present invention adopts an innovative node sample balancing technology to undersample and oversample the detected traffic data to balance the number of normal and abnormal samples in the data, retaining the original topological structure information and preventing the learning of erroneous topological structure information. It can solve the problem that the huge difference in the number of normal and abnormal information in the detection data makes it difficult to learn the features of minority categories during detection.
[0036] (3) The present invention performs feature enhancement on the graph structure, mines the information of the topological structure dimension hidden in the data, and designs a new graph neural network model to realize the utilization of high-value implicit information, which can solve the problem that existing detection methods lack the mining and utilization of high-value implicit information.
[0037] (4) The present invention combines the node attribute information, edge attribute information and topological information of graph data. It can not only learn the attribute information of the node itself, but also learn the characteristic information in the traffic and the information in the topological structure by aggregating the attribute information of adjacent edges to the central node.
[0038] (5) The performance of the present invention in terms of overall accuracy, precision, recall rate and F1 value is better than that of existing graph neural network methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is an overall flow chart of the malicious host detection method based on graph neural network in an embodiment of the present invention.
[0040] Figure 2 It is a flow chart of constructing a host communication graph in an embodiment of the present invention.
[0041] Figure 3 It is a flowchart of graph neural network model detection in an embodiment of the present invention.
[0042] Figure 4 It is a sample distribution pie chart of the UNSW-NB15 dataset and the TON-IOT dataset used in the experiment of the present invention. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention and to make the objects, features and advantages of the present invention more obvious and understandable, the technical core of the present invention is further described in detail below in conjunction with the accompanying drawings.
[0044] The embodiment of the present invention specifically proposes a malicious host detection method based on graph neural network. The overall idea of the method is to construct network traffic data into a graph structure to capture the topology information and communication information in the data, and then combine the graph neural network technology to establish a model for node classification, thereby detecting attack behaviors in network traffic data.
[0045] The overall flow chart of this method is as follows Figure 1 As shown, the specific processing steps include the following two parts:
[0046] 1. Construct a host communication graph based on network traffic, such as Figure 2 shown.
[0047] First, the network traffic data is preprocessed, including short-time window slicing and edge aggregation deduplication, to ensure that the graph can accurately and real-time reflect the network status, and then the host communication graph is constructed for the preprocessed data.
[0048] 1) Short time window slicing: By sorting the network traffic data L by timestamp, including IP address, port number, protocol type, packet size, etc., ensure the correct timing. Calculate the total time span of the data set T = [t start ,t end ], determine the required number of time windows n = [(t end -t start ) / W], dividing the total time span T into n time windows Wn For each window W i Initialize an empty list L i , store the flow data of the window, and put the timestamp in W i The records in L i Finally, the network traffic data set {L1, L2, ..., L n Through short-time window slicing processing, it is ensured that the constructed host communication graph can reflect the network status in real time and accurately.
[0049] 2) Edge aggregation and deduplication: In an active network environment, hosts communicate frequently, and even within a short time window slice, a large number of repeated network flows will be generated. These repeated flows will form redundant edges when constructing the graph, increase the computational complexity and interfere with the learning effect of the graph neural network. Therefore, this method adopts an edge aggregation and deduplication algorithm. First, the data is grouped according to the application layer protocol type. Each group contains traffic records of the same service type and flow direction, and aggregation and deduplication are performed. Duplicate edges are defined as flows with the same source node, destination node, and edge type within a short time window, which corresponds to network flow records with exactly the same source IP:Port pair, destination IP:Port pair, and protocol type.
[0050] 3) Graph structure construction: A host communication graph is constructed based on the network traffic data in each short time window, where each IP:Port pair is a node and the communication between hosts is an edge. Connections between nodes are established based on the source IP:Port pair and destination IP:Port pair of the traffic record, and the edge type is set according to the communication protocol.
[0051] Through the above steps, the basic host communication graph is obtained, but the current host communication graph still has some problems, such as unbalanced node samples and too few node features. Therefore, this method optimizes the host communication graph through two steps: node sample balance and node feature enhancement.
[0052] 4) Node sample balance: In the detection of malicious hosts in the intranet, sample imbalance is one of the most common challenges. Usually, the number of normal samples far exceeds the number of malicious samples, which affects the learning effect of the model. Therefore, this method adopts a subgraph-based sampling method, which divides the connected subgraphs in the graph into a subgraph set G0 with all normal nodes and a subgraph set G1 with malicious nodes accounting for more than 50% according to the node labels. In the undersampling stage, the subgraphs of G0 are grouped according to the number of nodes, the single-node subgraphs are directly removed, and the multi-node subgraphs are randomly deleted at a set ratio of 50%. In the oversampling stage, the subgraphs of G1 are sorted in descending order according to the proportion of malicious nodes and copied in a loop until the ratio of malicious nodes to normal nodes reaches the preset target. Unlike the balancing method of adding and deleting nodes, the subgraph-based sampling method does not change the topological structure of the subgraph, ensuring that the model learns the real network communication topology and improves detection accuracy and reliability.
[0053] 5) Node feature enhancement: In the process of constructing the host communication graph, the node only contains two basic topological features, out-degree and in-degree, which can only preliminarily describe the connection status of the node in the network. Therefore, in order to supplement the insufficiency of node features, the present invention further mines more in-depth topological information from the subgraph topology of the host communication graph, including eight complex node features, namely degree centrality, betweenness centrality, closeness centrality, weighted out-degree, weighted in-degree, center, radius and size, to more comprehensively characterize the communication topological status information of the host.
[0054] 2. Malicious host detection based on graph neural network, such as Figure 3 shown.
[0055] This method uses a graph neural network model based on edge types to classify nodes in the host communication graph to detect malicious hosts in the network. The model consists of a host state convolution layer, a communication behavior convolution layer, and a fully connected layer, which are used for node feature convolution, edge feature convolution, and malicious host prediction, respectively.
[0056] 1) Node feature convolution based on host state convolution layer: In the node classification task, the host state convolution layer updates the representation of the node by aggregating information from the node's neighbors. A series of topological features are defined for each node in the host communication graph, such as communication frequency, network centrality, and network size. These features are aggregated with the features of first-order neighbor nodes through the host state convolution layer network to form a richer feature representation, enhance the model's ability to understand the local network structure, capture complex interaction patterns, and improve the accuracy of malicious behavior detection.
[0057] The host state convolutional layer network consists of multiple GCN layers and ReLU layers arranged alternately. The specific number of layers can be adjusted according to demand. The GCN layer traverses each node and performs weighted aggregation of first-order neighbor features. The expression is as follows:
[0058]
[0059] Among them, H (l) is the node feature matrix of the lth layer, W (l) is the weight matrix learned in layer l, is the adjacency matrix with self-loops added, is the corresponding degree matrix, and σ is the activation function. In this formula, the adjacency matrix Add self-loops to ensure that each node is connected to itself, and the degree matrix Used to normalize the adjacency matrix. This formula uses the inverse value of the square root of the degree matrix to normalize the adjacency matrix to the left and right, ensuring the fairness of weight distribution during feature propagation, so that the features of each node can reasonably integrate the features of itself and its neighboring nodes. After the linear transformation, the activation function σ is used to combine the features of each node with the features of its neighboring nodes. The updated features contain the comprehensive information of itself and its neighbors.
[0060] The ReLU layer performs a nonlinear transformation on each input feature, converting negative values to zero and keeping positive values unchanged. Its expression is as follows:
[0061] ReLU(x)=max(0,x)
[0062] The ReLU layer introduces nonlinear factors, enabling the model to learn more complex feature relationships and alleviate the gradient vanishing problem, thereby improving the accuracy and robustness of malicious host detection.
[0063] 2) Edge feature convolution based on the communication behavior convolution layer: In the constructed host communication graph, five communication features are defined for each edge, including duration, number of packets transmitted in the forward direction, number of packets transmitted in the reverse direction, number of bits transmitted in the forward direction, and number of bits transmitted in the reverse direction, as well as a type feature of whether it is a malicious behavior, to describe the communication behavior initiated by the host within a specific time window. The communication behavior convolution layer network enhances the model's ability to understand the host's communication behavior and improves the malicious host detection performance by weighted aggregation of edge features.
[0064] The communication behavior convolutional layer network consists of multiple layers of ECN layers and ReLU layers arranged alternately. The ECN layer performs edge feature convolution for various edge types, and its operation can be expressed as the following expression:
[0065]
[0066] in, is the feature of edge e at level l-1, is the weight matrix for edge type r, is the set of all outgoing edges of type r from node v, where R is the set of edge types, cv is the normalized coefficient of node v. For each edge, its feature is expressed as The ECN layer selects the corresponding weight matrix according to the edge type r Adjust the weights of edge features. Then, for each node v, the ECN layer calculates the set of all outgoing edges of type r. Perform weighted cumulative aggregation, that is, In order to ensure the consistency of the eigenvalue range, the node out-degree c is used v The reciprocal of is used as the normalization coefficient to normalize the aggregated features to ensure that the values of nodes with different numbers of connections are balanced after feature aggregation.
[0067] The ReLU layer is the same as the host state convolution layer network. The communication behavior convolution layer network also uses the ReLU layer to perform nonlinear transformation on each input feature, allowing the model to learn more complex feature relationships and alleviate the problem of gradient disappearance.
[0068] 3) Predict malicious hosts based on the fully connected layer: In the application scenario of detecting malicious hosts in the intranet of the present invention, the output of the fully connected layer represents the probability that the host has malicious behavior. The input of the fully connected layer is composed of the vector splicing of the host state convolution layer and the communication behavior convolution layer. These two vectors represent the embedded representations of the node features and edge features obtained through the convolution layer respectively. The spliced vectors are processed by two layers of fully connected layers in sequence. The first fully connected layer performs a linear transformation on the input spliced vector x and calculates z=Wx+b, where W is the weight matrix and b is the bias, transforming a multidimensional vector into a numerical value. The second fully connected layer performs a nonlinear transformation on the output z of the previous layer to generate the final output result. In the binary classification task of malicious host detection, the Sigmoid function σ is used for nonlinear transformation, and the expression is as follows:
[0069]
[0070] Among them, z is the input of the second fully connected layer, and σ(z) is the output of the Sigmoid function, which is a value between 0 and 1, indicating the probability value. This allows the output result to be directly used to indicate the probability that the host is a malicious host. In this method, when this probability value exceeds a preset threshold (e.g., 50%), the corresponding host is identified as a malicious host.
[0071] The present invention uses the binary cross entropy loss function (BCE) to evaluate the performance of the fully connected layer model. The binary cross entropy loss function is suitable for evaluating the difference between two probability distributions, especially when the prediction result is a binary classification probability, and its expression is as follows:
[0072]
[0073] Where N is the number of samples, y i is the true label (0 or 1) of the i-th sample, p i is the probability that the fully connected layer model predicts that the i-th sample is a positive class. For each sample, if the true label y i is 1, then the loss is -log(p i ); if the true label y i is 0, then the loss is -log(1-p i ), the log base value is unlimited. By averaging the losses of all samples, the overall binary cross entropy loss is obtained. The goal of learning the fully connected layer model is to minimize this loss value and try to accurately predict the label of each node.
[0074] Experimental test and result comparison:
[0075] The present invention conducts experiments on four network traffic datasets, namely the UNSW-NB15 dataset, the TON-IOT dataset, and the corresponding enhanced datasets NF-UNSW-NB15 and NF-TON-IOT datasets. The sample distributions of the UNSW-NB15 dataset and the TON-IOT dataset are as follows: Figure 4 shown.
[0076] The experimental indicators use overall accuracy, precision, recall and F1 value to evaluate the performance of the model. At the same time, time indicators and F1 drop rate indicators are added in the ablation experiment to intuitively reflect the impact of partial functional smiles on the model's time and detection performance. In the experiment, for all graph neural network models and all data sets, appropriate sampling ratios are used. The model is trained on 80% of the data in the data set, and the remaining 20% of the data is used for testing and performance evaluation.
[0077] In terms of feature selection, node features include ten features: out-degree, in-degree, weighted out-degree, weighted in-degree, degree centrality, betweenness centrality, closeness centrality, center, radius, and size. Edge features include a protocol / service type feature and five statistical features: duration, number of forward bits, number of reverse bits, number of forward packets, and number of reverse packets.
[0078] The dataset used in this experiment contains two types of labels: normal / malicious labels, which identify whether the node has ever exhibited malicious behavior. Label "0" indicates that the node is a normal host, while label "1" indicates that the node is an abnormal host that has experienced malicious behavior.
[0079] In order to verify the effectiveness of the technical solution of the present invention (i.e., RE-GCN model), we first designed an ablation experiment to prove the feasibility and necessity of the method, and then designed a comparative experiment to prove the effectiveness of the method. The comparative experiment used commonly used graph neural network models and other graph neural network malicious host detection methods for comparison, namely: GraphSAGE, RGCN, GAT, and multi-layer GCN, E-GraphSAGE model.
[0080] 1) Detection method ablation experiment
[0081] This experiment conducted ablation experiments on the enhanced features and two convolutional layers of the graph neural network on four datasets. The experimental results are shown in Table 1.
[0082] Table 1 Ablation experiment of node enhancement features and RE-GCN model ablation experiment
[0083]
[0084] By analyzing the experimental results in the above table, two conclusions can be drawn:
[0085] (1) In the node enhancement feature ablation experiment, the enhanced features significantly improved the accuracy, precision and F1 score of the model in the malicious host detection task. On the UNSW-NB15 dataset, the accuracy and F1 score of the model containing enhanced features reached 90.08% and 88.53%, respectively, which are 24.10% and 18.10% higher than those of the model without enhanced features. Although the enhanced features increase the running time of the model, this increase in time cost is reasonable and necessary in scenarios with high detection accuracy requirements.
[0086] (2) In the RE-GCN model ablation experiment, the communication state convolutional layer network and the communication behavior relationship convolutional layer network have different effects on the model performance. In the UNSW-NB15 dataset, the effects of the two are similar, while in the TON-IOT dataset, the ablation of the communication behavior relationship convolutional layer network has a greater impact on the performance, which is manifested in a significant decrease in accuracy and F1 score. The decrease in F1 score is mainly due to a significant decrease in precision and an increase in recall, which indicates that the model is more likely to misreport normal hosts as malicious hosts when key modules are missing. Overall, the complete RE-GCN model design is of great significance in actual network security protection, and can effectively balance precision and recall, improving overall detection performance.
[0087] 2) Comparative experiment of detection methods
[0088] This experiment compares the performance of this method with five other malicious host detection methods on four data sets. The experimental results are shown in Table 2.
[0089] Table 2 Malicious host detection performance comparison experiment
[0090]
[0091] By analyzing the experimental results in the above table, we can draw the following conclusions:
[0092] (1) The RE-GCN model performs well in all datasets, proving that the model that considers multi-dimensional information of host topology and communication dimensions for association analysis is effective in malicious host detection tasks.
[0093] (2) The learning effect of the GraphSAGE model on the UNSW-NB15 model is very poor, especially the recall rate is 2.53%. This is because the GraphSAGE model does not convolve all neighbor nodes during convolution, but learns the aggregation strategy of neighbor nodes during convolution by probabilistically selecting neighbor nodes. The graph structure of the UNSW-NB15 dataset contains a large number of point-to-point subgraphs. Due to the special convolution algorithm of the GraphSAGE model, the model's strategy of aggregating neighbor nodes will be omitted during convolution, resulting in the model tending to predict all results as normal, resulting in a large number of false negatives.
[0094] (3) The RGCN model has similar effects to the RE-GCN model in most data sets. In a few cases, some indicators are better than the RE-GCN model. This is because both models assign specific weights based on edge types, allowing the model to learn to focus on more important communication behaviors. However, the RGCN model cannot directly apply weights to communication information. It needs to go through additional steps to convert communication features into host feature descriptions. In this process, the already small number of malicious communications will be submerged in a large number of normal communication behaviors, smoothing out the characteristics of malicious communication behaviors, resulting in performance that is inferior to the RE-GCN model in most cases.
[0095] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Appropriate modifications or equivalent substitutions of the technical solutions of the present invention made by ordinary technicians in the field should all be included in the protection scope of the present invention. The protection scope of the present invention shall be based on what is defined in the claims.
Claims
1. A malicious host detection method based on graph neural network, characterized in that: The following steps are involved: (1) Slice network traffic data into short time windows; (2) Aggregate and remove duplicate traffic with the same source, destination, and protocol within a short time window; (3) constructing a host communication graph based on the communication relationships between communication endpoints contained in the deduplicated traffic data within each short time window; (4) Perform sample balancing based on the subgraph structure of the host communication graph, and undersample and oversample the minority malicious samples; (5) Obtain subgraph topology information of the host communication graph and enhance node features based on the subgraph topology information; (6) Aggregate the features of each node and its neighboring nodes through the host state convolution layer; (7) Aggregate edge features through the communication behavior convolution layer and convolutionally learn each communication behavior of the host; (8) Concatenate the node features output by the host status convolution layer and the edge features output by the communication behavior convolution layer, input the concatenated features into the fully connected layer for nonlinear transformation, and output the judgment result of whether it is a malicious host; (9) Use the training data with real labels to train the fully connected layer, calculate the binary cross entropy loss function, and optimize the parameters of the fully connected layer with the goal of minimizing the loss value of the binary cross entropy loss function. After the training is completed, it is used to formally detect malicious hosts.
2. The malicious host detection method according to claim 1, characterized in that: The step of slicing the network traffic data into short time windows in step (1) includes: sorting the network traffic data by timestamp, calculating the total time span of the network traffic data, and dividing the total time span into multiple short time windows according to the required number of time windows; initializing an empty list for each short time window, and storing the network traffic data belonging to the short time window into the corresponding empty list according to the timestamp information, thereby realizing short time window slicing processing.
3. The malicious host detection method according to claim 1, characterized in that: In step (3), the communication endpoints include a source IP:Port pair and a destination IP:Port pair, each serving as a node in the host communication graph, and the communication relationship between the communication endpoints serves as an edge between the nodes in the host communication graph; the edge type includes five communication characteristics, namely, duration, number of packets transmitted in the forward direction, number of packets transmitted in the reverse direction, number of bits transmitted in the forward direction, and number of bits transmitted in the reverse direction, and a type characteristic of whether it is malicious behavior.
4. The malicious host detection method according to claim 1, characterized in that: The step of performing sample balancing based on the subgraph structure of the host communication graph in step (4) includes: dividing the connected subgraphs in the host communication graph into a subgraph set G0 consisting of all normal nodes and a subgraph set G1 in which malicious nodes account for more than 50%; when undersampling, grouping the subgraphs in set G0 according to the number of nodes, directly removing single-node subgraphs, and randomly deleting multi-node subgraphs at a ratio of 50%; when oversampling, sorting the subgraphs in set G1 in descending order according to the proportion of malicious nodes and cyclically replicating them in sequence until the ratio of malicious nodes to normal nodes reaches a preset value.
5. The malicious host detection method according to claim 1, characterized in that: In step (5), node feature enhancement based on subgraph topology information includes adding eight node features: degree centrality, betweenness centrality, closeness centrality, weighted out-degree, weighted in-degree, center, radius and size.
6. The malicious host detection method according to claim 1, characterized in that: In step (6), the host state convolution layer is composed of multiple layers of GCN layers and ReLU layers arranged alternately. The ReLU layer performs a nonlinear transformation on each input feature, converting negative values to zero and keeping positive values unchanged. The GCN layer traverses each node and performs weighted aggregation of first-order neighbor features, expressed as: Among them, H (l) is the node feature matrix of the lth layer, W (l) is the weight matrix learned in layer l, is the adjacency matrix with self-loops added, is the degree matrix used to normalize the adjacency matrix, and σ is the activation function.
7. The malicious host detection method according to claim 1, characterized in that: In step (7), the communication behavior convolution layer is composed of multiple layers of ECN layers and ReLU layers arranged alternately, where the ReLU layer is used to perform nonlinear transformation on each input feature; the ECN layer performs edge feature convolution aggregation for multiple edge types, and the expression is: in, is the feature of edge e at level l-1, is the weight matrix for edge type r, is the set of all outgoing edges of type r from node v, where R is the set of edge types, c v is the normalization coefficient of node v, and σ is the activation function.
8. The malicious host detection method according to claim 1, characterized in that: The step of inputting the concatenated features into the fully connected layer for nonlinear transformation in step (8) includes: first inputting the concatenated features into the first fully connected layer for linear transformation, then inputting the values generated by the linear transformation into the second fully connected layer for nonlinear transformation, and outputting the probability of whether it is a malicious host.
9. The malicious host detection method according to claim 1, characterized in that: The expression of the binary cross entropy loss function in step (9) is: Among them, L BCE is the binary cross entropy loss function, N is the number of samples in the training data set; y i is the true label of the i-th sample, which is 0 or 1; p i is the probability of predicting that the i-th sample is a normal host.
10. A malicious host detection system based on graph neural network, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the malicious host detection method according to any one of claims 1 to 9 when executing the computer program.
Citation Information
Cited By
Cloud-edge collaborative industrial scene risk discovery and evaluation method, system and related device
CN121690667A
