Malicious traffic detection method and terminal

By preprocessing network traffic and constructing interaction graphs, using interactive information extraction models and bidirectional long-short-term memory networks, the problem that malicious traffic detection methods in the existing technology cannot effectively capture the interaction relationship of data packets is solved, and malicious traffic detection is improved. accuracy and robustness.

CN118784301AActive Publication Date: 2024-10-15STATE GRID FUJIAN ELECTRIC POWER RES INST +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410878831.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-15
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

Existing malicious traffic detection methods based on machine learning and deep learning only focus on the timing characteristics of data packets within network flows and fail to effectively capture the complex interactive relationships between data packets, resulting in insufficient detection accuracy.

Method used

A malicious traffic detection method is used to preprocess network traffic, extract packet interaction relationship sequences and packet-level feature sequences, build multiple in-flow interaction graphs with time series relationships, and use interaction information extraction models, including graph volumes The cumulative layer, ReLu layer, Dropout layer and global pooling layer extract the graph-level representation feature sequence, and combine the bidirectional long short-term memory network and the multi-layer perceptron for detection.

Benefits of technology

It improves the accuracy and robustness of malicious traffic detection, effectively extracts interaction information between data packets, and accurately extracts timing information in network traffic data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784301A_ABST
    Figure CN118784301A_ABST
Patent Text Reader

Abstract

The invention discloses a malicious traffic detection method and a terminal, and the method comprises the steps: carrying out the preprocessing of network traffic, obtaining a data package interaction relation sequence and a package-level feature sequence, constructing a plurality of intra-flow interaction diagrams with a time sequence relation according to the data package interaction relation sequence, based on the multiple intra-flow interaction graphs and the packet level feature sequences, an interaction information extraction model is used for extracting interaction information to obtain a graph level representation feature sequence, the graph level representation feature sequence is input into a malicious flow detection model for detection to obtain a detection result, and the interaction information extraction model comprises multiple feature extraction units; each feature extraction unit comprises a plurality of graph convolution layers, a ReLu layer, a Dropout layer and a global pooling layer, the robustness of the model is improved, interaction information between data packets can be effectively extracted, the malicious traffic detection model comprises a bidirectional long-short-term memory network and a multi-layer sensor, time sequence information in network traffic data can be accurately extracted, and the malicious traffic detection efficiency is improved. Therefore, the malicious traffic detection accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network security technology, and in particular to a malicious traffic detection method and terminal. Background Art

[0002] With the rapid development of network technology and the continuous expansion of network scale, not only has the explosive growth of various business traffic, but also the types and quantity of malicious traffic have continued to grow. These endless malicious traffic has caused many extremely serious consequences, making people pay more and more attention to the security construction of cyberspace. In recent years, due to the continuous development of the types of malicious traffic and network attack technology, the traditional malicious traffic detection methods based on rules and signatures can no longer meet the needs of the actual environment. The methods based on machine learning and deep learning, relying on the powerful feature extraction capabilities of neural networks, avoid the problem of insufficient expression capabilities of manually designed features, and gradually become the mainstream of industry research. However, the existing malicious traffic detection models constructed based on machine learning and deep learning methods only focus on the timing characteristics between packets within the network flow, and do not pay more attention to the complex relationship between packets.

[0003] The Chinese patent document with publication number CN202011184585.9 discloses a graph neural network construction method and an abnormal traffic detection method based on a graph neural network. It provides a method that relies on the correlation and temporal characteristics in the original traffic data to convert it into graph structure data and use a graph neural network to detect abnormal traffic. Specifically, it includes: using the temporal correlation of the traffic message, constructing a recurrent neural network model, updating the feature vectors of each field of the traffic message, and in order to obtain the relevant features between the fields inside the traffic message segment, converting the streaming data into graph data through a graph construction method, and then constructing a deep graph neural network model to perform abnormal traffic detection and classification tasks. However, the characteristic values ​​of each field in a data message extracted in this method will be affected by different network environments, causing the maximum / minimum value to fluctuate, which brings difficulties to the subsequent normalization operation. At the same time, this method only considers the front-end relationship between data packets. This method ignores the richer interactive relationship between data packets, resulting in a lack of detection accuracy.

[0004] Therefore, how to provide a malicious traffic detection method that can solve the above problems is an issue that technical personnel in this field urgently need to solve. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a malicious traffic detection method and a terminal, which can improve the accuracy of malicious traffic detection.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A malicious traffic detection method comprises the following steps:

[0008] Collecting network traffic and preprocessing the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence;

[0009] Constructing a plurality of intra-flow interaction graphs having a time sequence relationship according to the data packet interaction relationship sequence;

[0010] Extracting interaction information using an interaction information extraction model based on the multiple intra-flow interaction graphs and the packet-level feature sequences to obtain a graph-level representation feature sequence, wherein the interaction information extraction model includes multiple feature extraction units, each of which includes multiple graph convolutional layers, ReLu layers, Dropout layers, and a global pooling layer;

[0011] The graph-level representation feature sequence is input into a malicious traffic detection model for detection to obtain a detection result. The malicious traffic detection model includes a bidirectional long short-term memory network and a multi-layer perceptron.

[0012] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0013] A malicious traffic detection terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0014] Collecting network traffic and preprocessing the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence;

[0015] Constructing a plurality of intra-flow interaction graphs having a time sequence relationship according to the data packet interaction relationship sequence;

[0016] Extracting interaction information using an interaction information extraction model based on the multiple intra-flow interaction graphs and the packet-level feature sequences to obtain a graph-level representation feature sequence, wherein the interaction information extraction model includes multiple feature extraction units, each of which includes multiple graph convolutional layers, ReLu layers, Dropout layers, and a global pooling layer;

[0017] The graph-level representation feature sequence is input into a malicious traffic detection model for detection to obtain a detection result. The malicious traffic detection model includes a bidirectional long short-term memory network and a multi-layer perceptron.

[0018] The beneficial effects of the present invention are: preprocessing network traffic to obtain data packet interaction relationship sequences and packet-level feature sequences, constructing multiple intra-flow interaction graphs with time series relationships based on the data packet interaction relationship sequences, using an interaction information extraction model to extract interaction information based on the multiple intra-flow interaction graphs and packet-level feature sequences to obtain a graph-level representation feature sequence, inputting the graph-level representation feature sequence into a malicious traffic detection model for detection to obtain a detection result, wherein the interaction information extraction model includes multiple feature extraction units, each feature extraction unit includes multiple graph convolution layers, ReLu layers, Dropout layers, and a global pooling layer, which improves the robustness of the model and can effectively extract interaction information between data packets, and the malicious traffic detection model includes a bidirectional long short-term memory network and a multi-layer perceptron, which can accurately extract time series information in network traffic data, thereby improving the accuracy of malicious traffic detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flowchart of a malicious traffic detection method according to an embodiment of the present invention;

[0020] Figure 2 A schematic diagram of the structure of a malicious traffic detection terminal according to an embodiment of the present invention;

[0021] Figure 3 A schematic diagram of a process of constructing an intra-flow interaction graph in a malicious traffic detection method according to an embodiment of the present invention;

[0022] Figure 4 A structural diagram of an interactive information extraction model in a malicious traffic detection method according to an embodiment of the present invention;

[0023] Figure 5 It is a structural diagram of a malicious traffic detection model in a malicious traffic detection method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0025] Please refer to Figure 1 , a malicious traffic detection method, comprising the steps of:

[0026] Collecting network traffic and preprocessing the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence;

[0027] Constructing a plurality of intra-flow interaction graphs having a time sequence relationship according to the data packet interaction relationship sequence;

[0028] Extracting interaction information using an interaction information extraction model based on the multiple intra-flow interaction graphs and the packet-level feature sequences to obtain a graph-level representation feature sequence, wherein the interaction information extraction model includes multiple feature extraction units, each of which includes multiple graph convolutional layers, ReLu layers, Dropout layers, and a global pooling layer;

[0029] The graph-level representation feature sequence is input into a malicious traffic detection model for detection to obtain a detection result. The malicious traffic detection model includes a bidirectional long short-term memory network and a multi-layer perceptron.

[0030] From the above description, it can be seen that the beneficial effects of the present invention are: preprocessing the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence, constructing multiple intra-flow interaction graphs with a time series relationship based on the data packet interaction relationship sequence, using an interaction information extraction model to extract interaction information based on the multiple intra-flow interaction graphs and packet-level feature sequences, and obtaining a graph-level representation feature sequence, and inputting the graph-level representation feature sequence into a malicious traffic detection model for detection to obtain a detection result, wherein the interaction information extraction model includes multiple feature extraction units, each feature extraction unit includes multiple graph convolution layers, ReLu layers, Dropout layers, and global pooling layers, which improves the robustness of the model and can effectively extract interaction information between data packets. The malicious traffic detection model includes a bidirectional long short-term memory network and a multi-layer perceptron, which can accurately extract timing information in network traffic data, thereby improving the accuracy of malicious traffic detection.

[0031] Furthermore, the preprocessing of the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence includes:

[0032] Segmenting the network traffic according to the five-tuple information to obtain a plurality of initial network flows, each of which includes a plurality of data packets;

[0033] Segmenting the multiple data packets in each of the network flows based on a preset flow duration threshold and a preset data packet interval time threshold to obtain multiple segmented network flows;

[0034] Removing retransmission packets and useless packets from the divided multiple network flows to obtain multiple filtered network flows, and sorting the data packets in the filtered multiple network flows to obtain a data packet sequence;

[0035] A data packet interaction relationship sequence is extracted from the data packet sequence, and the data packet sequence is processed to obtain a packet-level feature sequence.

[0036] From the above description, it can be seen that the network traffic is segmented according to the five-tuple information, and then the multiple data packets in each network flow are split for a second time based on the preset flow duration threshold and the preset data packet interval time threshold, and then the retransmitted packets and useless packets in the segmented multiple network flows are removed, thereby improving the quality of the data to be processed and ensuring the efficiency of subsequent detection.

[0037] Further, extracting a data packet interaction relationship sequence from the data packet sequence includes:

[0038] Determining the relationship between the data packets in the data packet sequence according to the transmission directions between adjacent data packets in the filtered multiple network flows;

[0039] A data packet interaction relationship sequence is generated according to the relationship between the data packets.

[0040] From the above description, it can be seen that the relationship between data packets in the data packet sequence is determined according to the transmission direction between adjacent data packets in the screened multiple network flows, so as to generate a data packet interaction relationship sequence, extract the interaction relationship between the data packets, and help identify malicious traffic.

[0041] Further, the determining the relationship between the data packets in the data packet sequence according to the transmission directions between adjacent data packets in the screened multiple network flows includes:

[0042] If the transmission directions of adjacent data packets in the filtered multiple network flows are in the same direction, determining that there is a continuation relationship between the adjacent data packets in the data packet sequence;

[0043] If there are adjacent data packets in the filtered multiple network flows whose transmission directions are opposite, it is determined that there is a response relationship between the adjacent data packets in the data packet sequence.

[0044] From the above description, it can be seen that when the transmission directions between adjacent data packets are in the same direction, it is determined that there is a continuation relationship between adjacent data packets in the data packet sequence. When the transmission directions between adjacent data packets are in the opposite direction, it is determined that there is a response relationship between adjacent data packets in the data packet sequence. Determining the interaction relationship between data packets is simpler and more effective.

[0045] Further, the processing of the data packet sequence to obtain a packet-level feature sequence includes:

[0046] If the length of the data packet sequence exceeds a preset network flow length threshold, the data packet sequence is trimmed until the length reaches the preset network flow length threshold to obtain a packet-level feature sequence;

[0047] If the length of the data packet sequence is lower than the preset network flow length threshold, the data packet sequence is padded until the length reaches the preset network flow length threshold to obtain a packet-level feature sequence.

[0048] From the above description, it can be seen that the data packet sequence is trimmed and padded based on the preset network flow length threshold and the length of the data packet sequence to obtain a packet-level feature sequence, which contains the feature information in the data packet, so as to facilitate subsequent accurate malicious traffic detection.

[0049] Furthermore, constructing a plurality of intra-flow interaction graphs having a time sequence relationship according to the data packet interaction relationship sequence includes:

[0050] Nodes and edge relationships are generated according to the data packet interaction relationship sequence and a preset edge rule, and a plurality of intra-flow interaction graphs with a time sequence relationship are obtained according to the nodes and the edge relationships.

[0051] From the above description, it can be seen that nodes and edge relationships are generated according to the preset edge rules based on the data packet interaction relationship sequence, and multiple intra-flow interaction graphs with time-series relationships are obtained based on the nodes and edge relationships. The intra-flow interaction graph can fully reflect the interaction relationship between data packets within a network flow, which can better represent a network flow, and this interaction relationship is less disturbed, ensuring the accuracy of malicious traffic detection.

[0052] Furthermore, extracting the interaction information using an interaction information extraction model based on the multiple intra-flow interaction graphs and the packet-level feature sequence to obtain a graph-level representation feature sequence includes:

[0053] Extracting a set of adjacency relationship matrices from the multiple in-stream interaction graphs, and extracting a set of node feature matrices from the packet-level feature sequences according to the multiple in-stream interaction graphs;

[0054] The adjacency relationship matrix set and the node feature matrix set are input into an interactive information extraction model to extract interactive information, and a graph-level representation feature sequence is output.

[0055] From the above description, it can be seen that after extracting a set of adjacency relationship matrices from multiple in-flow interaction graphs and extracting a set of node feature matrices from the packet-level feature sequence based on the multiple in-flow interaction graphs, the adjacency relationship matrix set and the node feature matrix set are input into the interaction information extraction model to extract the interaction information, and the graph-level representation feature sequence is output. The graph-level representation feature sequence reflects the interaction information contained in each in-flow interaction graph, which can effectively improve the accuracy of subsequent detection.

[0056] Further, extracting a set of adjacency relationship matrices from the multiple in-stream interaction graphs, and extracting a set of node feature matrices from the packet-level feature sequences according to the multiple in-stream interaction graphs includes:

[0057] Convert each of the intra-flow interaction graphs into an isomorphic graph, and extract an adjacency relationship matrix from each of the isomorphic graphs to obtain an adjacency relationship matrix set;

[0058] According to the node information in each of the intra-flow interaction graphs, data packet features that match the node information are extracted from the packet-level feature sequence, and a node feature matrix corresponding to each intra-flow interaction graph is constructed according to the data packet features to obtain a node feature matrix set.

[0059] From the above description, it can be seen that the intra-flow interaction graph is a kind of graph structure data. The nodes in the graph represent different data packets in a network flow. Each intra-flow interaction graph is converted into an isomorphic graph to meet the input requirements of the subsequent interaction information extraction model and ensure the accuracy of interaction information extraction.

[0060] Furthermore, the feature extraction unit comprises:

[0061]

[0062]

[0063] In the formula, f(X, A) represents the feature extraction unit, ReLu() represents the activation function, represents the degree matrix, represents the intermediate matrix, A represents the input adjacency matrix, I N Indicates, Dropout() indicates the Dropout layer, X indicates the input node feature matrix, W (0) and W (1) They represent the learnable parameters in different graph convolutional layers in the model.

[0064] From the above description, it can be seen that the feature extraction unit is composed of multiple graph convolutional layers, ReLu layers, Dropout layers and global pooling layers, which can effectively extract data features of network traffic to improve the reliability of malicious traffic detection.

[0065] Please refer to Figure 2 Another embodiment of the present invention provides a malicious traffic detection terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements each step of the above-mentioned malicious traffic detection method when executing the computer program.

[0066] The malicious traffic detection method and terminal of the present invention can be applied to scenarios where network traffic needs to be detected, and are described below through specific implementation methods:

[0067] Please refer to Figure 1 , Figure 3-Figure 5, Embodiment 1 of the present invention is:

[0068] A malicious traffic detection method comprises the following steps:

[0069] S1. Collect network traffic and pre-process the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence, specifically including S11-S14:

[0070] S11. Segment the network traffic according to the five-tuple information to obtain multiple initial network flows, each of which includes multiple data packets.

[0071] Specifically, the network traffic with the same five-tuple information is divided into one network flow, and multiple initial network flows are obtained.

[0072] The five-tuple information includes the source IP address, the destination IP address, the source port number, the destination port number and the transport layer protocol number.

[0073] S12: Segment the multiple data packets in each of the network flows based on a preset flow duration threshold and a preset data packet interval time threshold to obtain multiple segmented network flows.

[0074] The preset flow duration threshold is the time interval between the first and last data packets in the network flow, and the preset data packet interval time threshold is the interval between the sending times of two adjacent data packets in the network flow.

[0075] Specifically, the data packets in the initial multiple network flows are traversed. For the traversed data packets, the sending time interval between the current data packet and the first data packet of the corresponding network flow is compared to see whether it is greater than the preset flow duration threshold and the sending time interval between the current data packet and the previous data packet is compared to see whether it is greater than the preset data packet interval time threshold. If it is greater than any of the thresholds, the network flow is segmented until the traversal is completed to obtain multiple segmented network flows. Since the preset flow duration threshold compares the sending time interval between the first data packet and the last data packet, after each segmentation, the sending time information of the first data packet needs to be updated to the sending time of the current data packet before performing subsequent traversal operations.

[0076] In a real network environment, the two communicating parties may communicate more than once, and there may be no correlation between multiple communications. When the network traffic is segmented only by the five-tuple information, multiple communication processes will be divided into the same network flow, which will interfere with the detection of malicious traffic. Therefore, it is necessary to further segment it, that is, to segment multiple data packets in each network flow based on the preset flow duration threshold and the preset data packet interval time threshold. For example, in daily life, the same website may be visited multiple times in the same day, but the content of each visit is different. If it is segmented only by the identification information of the two communicating parties, these multiple access processes will be divided together, which is obviously unreasonable. Therefore, it can be further segmented in combination with the time threshold to separate the multiple access processes and increase rationality.

[0077] S13, removing retransmitted packets and useless packets from the divided multiple network flows to obtain multiple filtered network flows, and sorting the data packets in the filtered multiple network flows to obtain a data packet sequence.

[0078] S14, extracting a data packet interaction relationship sequence from the data packet sequence, and processing the data packet sequence to obtain a packet-level feature sequence, specifically including S141-S144:

[0079] S141. Determine the relationship between the data packets in the data packet sequence according to the transmission directions between adjacent data packets in the screened multiple network flows.

[0080] Specifically, if the transmission directions of adjacent data packets in the filtered multiple network flows are in the same direction, it is determined that there is a continuation relationship between the adjacent data packets in the data packet sequence; if the transmission directions of adjacent data packets in the filtered multiple network flows are in opposite directions, it is determined that there is a response relationship between the adjacent data packets in the data packet sequence. The transmission direction of the data packet and the adjacent data packets is obtained by traversing the IP address information of each data packet.

[0081] S142: Generate a data packet interaction relationship sequence according to the relationship between the data packets.

[0082] S143. If the length of the data packet sequence exceeds a preset network flow length threshold, the data packet sequence is trimmed until the length reaches the preset network flow length threshold to obtain a packet-level feature sequence.

[0083] The preset network flow length threshold is the number of data packets in a network flow.

[0084] S144. If the length of the data packet sequence is lower than the preset network flow length threshold, the data packet sequence is padded until the length reaches the preset network flow length threshold to obtain a packet-level feature sequence.

[0085] The filling of the data packet sequence includes: adding an empty data packet to the data packet sequence, wherein the empty data packet is a data packet in which all fields are zero.

[0086] S2. Construct multiple intra-flow interaction graphs with a time sequence relationship according to the data packet interaction relationship sequence.

[0087] Specifically, Figure 3 As shown, nodes and edge relationships are generated according to the data packet interaction relationship sequence according to preset edge rules, and multiple intra-flow interaction graphs with time sequence relationships are obtained according to the nodes and the edge relationships.

[0088] Wherein, the step of obtaining multiple intra-stream interaction graphs with a time sequence relationship according to the nodes and the edge relationships includes: taking each process of adding the nodes and the edge relationships to the graph as an iteration, retaining the intra-stream interaction graph generated in each iteration, and obtaining multiple intra-stream interaction graphs with a time sequence relationship. The intra-stream interaction graph includes nodes and edges, each node represents a data packet, and the edges include response edges and continuation edges.

[0089] The preset edge rules include direct addition rules, response edge addition rules, and continuation edge addition and response continuation rules. The direct addition rule is: when the node in the initial in-stream interaction graph is empty or the data packet represented by the current node is a fill data packet, the node is directly added to the in-stream interaction graph, and no edge relationship is added. The response edge addition rule is: when the current data packet and the previous data packet in the data packet interaction sequence are in a response relationship, an edge of the response relationship is added. The continuation edge addition and response continuation rules are: when the current data packet and the previous data packet in the data packet interaction sequence are in a continuation relationship, a node and a corresponding continuation edge are first added to the graph. If the response continuation occurs, the response edge in the graph will disconnect from the previous node and point to the current node instead.

[0090] S3, extracting interaction information using an interaction information extraction model based on the multiple intra-flow interaction graphs and the packet-level feature sequence to obtain a graph-level representation feature sequence, specifically including:

[0091] S31, extracting an adjacency relationship matrix set from the multiple in-stream interaction graphs, and extracting a node feature matrix set from the packet-level feature sequence according to the multiple in-stream interaction graphs, specifically including S311-S312:

[0092] S311 , converting each of the intra-flow interaction graphs into an isomorphic graph, and extracting an adjacency relationship matrix from each of the isomorphic graphs to obtain an adjacency relationship matrix set.

[0093] Specifically, the two different edges in each of the intra-flow interaction graphs are unified as adjacency relationships to obtain an isomorphic graph, and the adjacency relationships between the nodes are extracted from each of the isomorphic graphs to construct an adjacency relationship matrix to obtain an adjacency relationship matrix set. When there is an adjacency relationship between two nodes, the element value of the corresponding position in the adjacency relationship matrix is ​​1, and when there is no adjacency relationship between the two nodes, the element value of the corresponding position in the adjacency relationship matrix is ​​0.

[0094] S312. According to the node information in each of the intra-flow interaction graphs, data packet features that match the node information are extracted from the packet-level feature sequence, and a node feature matrix corresponding to each intra-flow interaction graph is constructed according to the data packet features to obtain a node feature matrix set.

[0095] The node feature matrix corresponding to each intra-flow interaction graph is constructed according to the data packet features to obtain a node feature matrix set, specifically:

[0096] The MAC address and IP address information in the data packet features are anonymized, and the first M bytes of data of each data packet feature after anonymization are extracted and normalized as node features, so as to construct a node feature matrix corresponding to each intra-flow interaction graph and obtain a node feature matrix set. The IP address information includes the source IP address and the destination IP address.

[0097] S32, input the adjacency relationship matrix set and the node feature matrix set into the interactive information extraction model to extract interactive information, and output a graph-level representation feature sequence, such as Figure 4 shown.

[0098] The interactive information extraction model includes a plurality of feature extraction units, each of which includes a plurality of graph convolution (GCN) layers, a ReLu layer, a Dropout layer, and a global pooling layer, and the feature extraction unit includes:

[0099]

[0100]

[0101] In the formula, f(X, A) represents the feature extraction unit, ReLu() represents the activation function, represents the degree matrix, represents the intermediate matrix, A represents the input adjacency matrix, I Nrepresents the identity matrix, Dropout() represents the Dropout layer, X represents the input node feature matrix, W (0) and W (1) They represent the learnable parameters in different graph convolutional layers in the model.

[0102] The graph convolution layer is used to aggregate the features of nodes in the graph and their neighboring nodes, capturing the interactive information within the network flow.

[0103] The ReLu layer is used to increase the representation capability of the interactive information extraction model and improve the nonlinear fitting capability of the interactive information extraction model.

[0104] The Dropout layer is used to randomly discard a portion of neurons during training and retain all neurons during testing.

[0105] The global pooling layer is used to extract graph-level feature representations to obtain feature representation vectors of the in-stream interaction graph, that is, graph-level representation feature sequences.

[0106] S4. Input the graph-level representation feature sequence into a malicious traffic detection model for detection to obtain a detection result. The malicious traffic detection model includes a bidirectional long short-term memory network (LSTM) and a multi-layer perceptron (MLP), such as Figure 5 shown.

[0107] Among them, in the malicious traffic detection model, the multi-layer bidirectional long short-term memory network is used as a temporal relationship extraction layer, and the multi-layer perceptron is used as a classification layer.

[0108] The single-layer bidirectional long short-term memory network is:

[0109]

[0110] In the formula, represents the forward hidden state, represents the backward hidden state, h n represents the hidden state generated by the nth iteration of the nth LSTM unit, v n represents the nth feature vector input to the malicious traffic detection model, h2 represents the hidden state generated by the second iteration of the second LSTM unit, and v2 represents the second feature vector input to the malicious traffic detection model.

[0111] Contains contextual information that aggregates graph-level representation feature sequences from front to back, Contains contextual information that aggregates the graph-level representation feature sequence from back to front. and The concatenation is used as the compressed representation vector of the entire input sequence. A multi-layer bidirectional long short-term memory network is stacked in the temporal relationship extraction layer, and the extracted compressed representation vector is expressed as:

[0112]

[0113] Where z represents the extracted compressed representation vector, J represents the number of layers of the bidirectional long short-term memory network, represents the forward hidden state of the i-th layer, represents the backward hidden state of the i-th layer.

[0114] In an optional implementation, the learnable parameters in the interactive information extraction model and the malicious traffic detection model are optimized by calculating the loss between the detection result and the true result through the cross entropy loss function.

[0115] Please refer to Figure 2 , Embodiment 2 of the present invention is:

[0116] A malicious traffic detection terminal comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the malicious traffic detection method in the first embodiment is implemented.

[0117] In summary, the present invention provides a malicious traffic detection method and terminal, which preprocesses network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence, constructs multiple intra-flow interaction graphs with a time sequence relationship according to the data packet interaction relationship sequence, extracts interaction information based on the multiple intra-flow interaction graphs and the packet-level feature sequence using an interaction information extraction model to obtain a graph-level representation feature sequence, and inputs the graph-level representation feature sequence into a malicious traffic detection model for detection to obtain a detection result, wherein the interaction information extraction model includes multiple feature extraction units, each feature extraction unit includes multiple graph convolution layers, ReLu layers, Dropout layers, and a global pooling layer, which improves the robustness of the model and can effectively extract interaction information between data packets, and the malicious traffic detection model includes a bidirectional long short-term memory network and a multi-layer perceptron, which can accurately extract time sequence information in network traffic data. Thereby improving the accuracy of malicious traffic detection; in addition, extracting an adjacency relationship matrix set from multiple intra-flow interaction graphs, and extracting a node feature matrix set from a packet-level feature sequence based on the multiple intra-flow interaction graphs, the adjacency relationship matrix set and the node feature matrix set are input into the interaction information extraction model to extract interaction information, and output a graph-level representation feature sequence. The graph-level representation feature sequence reflects the interaction information contained in each intra-flow interaction graph, which can effectively improve the accuracy of subsequent detection; at the same time, generating nodes and edge relationships according to the data packet interaction relationship sequence according to the preset edge rules, and obtaining multiple intra-flow interaction graphs with time series relationships based on the nodes and edge relationships. The intra-flow interaction graph can fully reflect the interaction relationship between data packets within a network flow, which can better represent a network flow, and this interaction relationship is less disturbed, thereby ensuring the accuracy of malicious traffic detection.

[0118] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A malicious traffic detection method, characterized in that: Includes steps: Collecting network traffic and preprocessing the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence; Constructing a plurality of intra-flow interaction graphs having a time sequence relationship according to the data packet interaction relationship sequence; Extracting interaction information using an interaction information extraction model based on the multiple intra-flow interaction graphs and the packet-level feature sequences to obtain a graph-level representation feature sequence, wherein the interaction information extraction model includes multiple feature extraction units, each of which includes multiple graph convolutional layers, ReLu layers, Dropout layers, and a global pooling layer; The graph-level representation feature sequence is input into a malicious traffic detection model for detection to obtain a detection result. The malicious traffic detection model includes a bidirectional long short-term memory network and a multi-layer perceptron.

2. A malicious traffic detection method according to claim 1, characterized in that: The preprocessing of the network traffic to obtain a data packet interaction relationship sequence and a packet-level feature sequence comprises: Segmenting the network traffic according to the five-tuple information to obtain a plurality of initial network flows, each of which includes a plurality of data packets; Segmenting the multiple data packets in each of the network flows based on a preset flow duration threshold and a preset data packet interval time threshold to obtain multiple segmented network flows; Removing retransmission packets and useless packets from the divided multiple network flows to obtain multiple filtered network flows, and sorting the data packets in the filtered multiple network flows to obtain a data packet sequence; A data packet interaction relationship sequence is extracted from the data packet sequence, and the data packet sequence is processed to obtain a packet-level feature sequence.

3. A malicious traffic detection method according to claim 2, characterized in that: The step of extracting a data packet interaction relationship sequence from the data packet sequence comprises: Determining the relationship between the data packets in the data packet sequence according to the transmission directions between adjacent data packets in the filtered multiple network flows; A data packet interaction relationship sequence is generated according to the relationship between the data packets.

4. A malicious traffic detection method according to claim 3, characterized in that: Determining the relationship between data packets in the data packet sequence according to the transmission directions between adjacent data packets in the filtered multiple network flows comprises: If the transmission directions of adjacent data packets in the filtered multiple network flows are in the same direction, determining that there is a continuation relationship between the adjacent data packets in the data packet sequence; If there are adjacent data packets in the filtered multiple network flows whose transmission directions are opposite, it is determined that there is a response relationship between the adjacent data packets in the data packet sequence.

5. A malicious traffic detection method according to claim 2, characterized in that: The processing of the data packet sequence to obtain a packet-level feature sequence comprises: If the length of the data packet sequence exceeds a preset network flow length threshold, the data packet sequence is trimmed until the length reaches the preset network flow length threshold to obtain a packet-level feature sequence; If the length of the data packet sequence is lower than the preset network flow length threshold, the data packet sequence is padded until the length reaches the preset network flow length threshold to obtain a packet-level feature sequence.

6. A malicious traffic detection method according to claim 1, characterized in that: The step of constructing a plurality of intra-flow interaction graphs having a time sequence relationship according to the data packet interaction relationship sequence comprises: Nodes and edge relationships are generated according to the data packet interaction relationship sequence and a preset edge rule, and a plurality of intra-flow interaction graphs with a time sequence relationship are obtained according to the nodes and the edge relationships.

7. A malicious traffic detection method according to claim 1, characterized in that: The extracting interaction information using an interaction information extraction model based on the multiple intra-flow interaction graphs and the packet-level feature sequence to obtain a graph-level representation feature sequence comprises: Extracting a set of adjacency relationship matrices from the multiple in-stream interaction graphs, and extracting a set of node feature matrices from the packet-level feature sequences according to the multiple in-stream interaction graphs; The adjacency relationship matrix set and the node feature matrix set are input into an interactive information extraction model to extract interactive information, and a graph-level representation feature sequence is output.

8. A malicious traffic detection method according to claim 7, characterized in that: The step of extracting a set of adjacency relationship matrices from the multiple in-stream interaction graphs, and extracting a set of node feature matrices from the packet-level feature sequences according to the multiple in-stream interaction graphs includes: Convert each of the intra-flow interaction graphs into an isomorphic graph, and extract an adjacency relationship matrix from each of the isomorphic graphs to obtain an adjacency relationship matrix set; According to the node information in each of the intra-flow interaction graphs, data packet features that match the node information are extracted from the packet-level feature sequence, and a node feature matrix corresponding to each intra-flow interaction graph is constructed according to the data packet features to obtain a node feature matrix set.

9. A malicious traffic detection method according to claim 1, characterized in that: The feature extraction unit comprises: In the formula, f(X,A) represents the feature extraction unit, ReLu() represents the activation function, represents the degree matrix, represents the intermediate matrix, A represents the input adjacency matrix, I N Indicates, Dropout() indicates the Dropout layer, X indicates the input node feature matrix, W (0) and W (1) They represent the learnable parameters in different graph convolutional layers in the model.

10. A malicious traffic detection terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, each step of a malicious traffic detection method as described in any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Malicious encryption traffic analysis feature extraction method based on data packet timing sequence

    CN109474598A

  • Communication network traffic prediction method and system, storage medium and computer equipment

    CN114422381A

  • Hidden malicious traffic detection method and device based on traffic interaction diagram

    CN114710322A

  • Concealed malicious traffic detection method fusing statistical features and graph structure features

    CN116132095A

  • Network of tensor time series

    US20220284277A1