A detection and defense method for APT attacks

By integrating the fully connected neural network model and network traffic baseline with a PID-like APT risk index formula, the problem that the existing technology cannot deeply explore the characteristics of network traffic data is solved, and timely detection and defense of APT attacks are realized. Dynamically adjust the firewall strategy to cope with changes in the network security situation, improving protection performance and stability.

CN118890214BActive Publication Date: 2024-12-06QIAN XINGCHENG NETWORK SECURITY TECH (HUNAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411354087.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2024-12-06
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

The existing APT attack detection and defense methods cannot deeply explore the nonlinear and spatiotemporal characteristics of network traffic data, cannot promptly reflect changes in network security situations, and the weighted sum attack risk calculation method cannot reflect the current status of network traffic anomalies. , historical behavior and future trends.

Method used

Nested LSTM is used to integrate fully connected neural network model and network traffic baseline, combine the APT risk index formula of PID-like, and detect network traffic abnormalities in real time and dynamically adjust the firewall strategy to cope with changes in network security situation.

Benefits of technology

In-depth nonlinear and spatiotemporal feature mining of network traffic data is realized, the interpretability and protection performance of detection are improved, and the changes in network security situations can be responded in a timely manner, and the protection performance and stability are enhanced by dynamically adjusting the firewall strategy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890214B_ABST
    Figure CN118890214B_ABST
Patent Text Reader

Abstract

The present invention discloses a detection and defense method for APT attacks, the method comprising: a gateway records network traffic data in real time, a network server generates a network traffic baseline, the network server obtains the number of point-level network traffic anomalies according to the network traffic baseline, the network server uses a nested LSTM integrated fully connected neural network model to obtain the number of subsequence-level network traffic anomalies, the network server uses a PID-like APT risk index formula to calculate the APT risk index, and the gateway dynamically adjusts the firewall according to the APT risk index. The present invention belongs to the field of network security, and the above-mentioned technical means are used to achieve timely response to changes in network security situation and enhance protection performance over time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of network security, and specifically refers to a detection and defense method for APT attacks. Background Art

[0002] APT (Advanced Persistent Threat), also known as advanced persistent threat and multi-step network attack, is highly concealed, latent and persistent. It is often used by hackers to steal data from specific targets in a long-term, planned and organized manner. Although APT attacks are carried out by different means and methods, they will eventually be reflected in network traffic data. Its signs mainly include subsequence-level network traffic anomalies and point-level network traffic anomalies. Subsequence-level network traffic anomalies refer to the behavior of certain subsequences in network traffic data that are inconsistent with the overall traffic pattern. Point-level network traffic anomalies refer to the network traffic observed at a specific time point that is significantly different from the expected or normal pattern. However, the existing detection and defense methods for APT attacks have the problem of not mining the nonlinear characteristics and spatiotemporal characteristics of network traffic data in depth and being unable to respond to changes in network security situation in a timely manner. The mainstream time series anomaly detection method does not mine the nonlinear characteristics and spatiotemporal characteristics of network traffic data in depth. The weighted sum attack risk calculation method also cannot reflect the current state, historical behavior and future trend of network traffic anomalies, and cannot respond to changes in network security situation in a timely manner. Summary of the invention

[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a detection and defense method for APT attacks. In view of the technical problems that the mainstream time series anomaly detection method does not mine the nonlinear characteristics and spatiotemporal characteristics of network traffic data deeply enough, and the weighted sum attack risk calculation method cannot reflect the current state, historical behavior and future trends of network traffic anomalies, this scheme adopts a nested LSTM integrated fully connected neural network model and a network traffic baseline method to detect network traffic anomalies, deeply mines the nonlinear characteristics and spatiotemporal characteristics of network traffic data, and improves the overall interpretability of the method. Through the PID-like APT risk index formula, based on the current state, historical behavior and future trends of network traffic anomalies, timely response to changes in network security situation is achieved.

[0004] The technical solution adopted by the present invention is as follows: A detection and defense method for APT attacks provided by the present invention is applied to a network server system, wherein the network server system includes a gateway and a network server. The detection and defense method for APT attacks includes the following steps:

[0005] Step S1: The gateway records network traffic data in real time and transmits it to the network server;

[0006] Step S2: The network server calculates and generates a network traffic baseline based on past network traffic data;

[0007] Step S3: the network server identifies the network traffic data according to the network traffic baseline, and obtains the number of point-level network traffic anomalies;

[0008] Step S4: The network server uses a nested LSTM integrated fully connected neural network model to identify network traffic data and obtain the number of subsequence-level network traffic anomalies;

[0009] Step S5: The network server calculates the APT risk index using the PID-like APT risk index formula, and the network server transmits the APT risk index to the gateway;

[0010] Step S6: A firewall is preset in the gateway, and the gateway dynamically adjusts the firewall according to the APT risk index.

[0011] The nested LSTM integrated fully connected neural network model includes a first nested LSTM layer, a second nested LSTM layer, a splicing fusion layer, a first fully connected layer, a second fully connected layer and a third fully connected layer.

[0012] Furthermore, in step S2, the process of the network server calculating and generating a network traffic baseline based on past network traffic data includes the following steps:

[0013] Step S21: the network server splits the past network traffic data by day and then by minute. The network traffic data of one day is split into 1440 network traffic data segments, each of which is a set containing the network traffic value per second.

[0014] Step S22: the network server calculates the average value and standard deviation of the network traffic value per second in each network traffic data segment;

[0015] Step S23: The network server averages the mean value and standard deviation of the network traffic data segments corresponding to the same time point every day to generate the corresponding network traffic data segment baseline, and the formula is as follows:

[0016] ;

[0017] ;

[0018] f m =[ A m , S m ] ;

[0019] in, represents the day to which the network traffic data segment belongs, and m represents the day to which the network traffic data segment belongs. The number of minutes in the day, Representative Tiandi The average value of network traffic value per second in the network traffic data segment of the minute. Representative Tiandi The standard deviation of the network traffic value per second of the network traffic data segment of the minute, D represents the number of days of past network traffic data records, Representative The average value of network traffic value per second in the network traffic data segment of the minute. Representative The standard deviation of the network traffic values ​​per second for the minute-long network traffic data segment, The baseline of the network traffic data segment representing the mth minute;

[0020] Step S24: The network server aggregates the network traffic data segment baselines per minute into a network traffic baseline. The network traffic baseline formula is as follows:

[0021] F=[ f 1 , f 2 ,…, f 1440 ] ;

[0022] Where F represents the network traffic baseline.

[0023] Further, in step S3, the process of the network server identifying the network traffic data according to the network traffic baseline is as follows:

[0024] Step S31: The administrator sets the confidence level that no APT attack has occurred;

[0025] Step S32: The network server calculates a confidence interval of no APT attack according to the confidence that no APT attack has occurred. The calculation formula of the confidence interval of no APT attack is as follows:

[0026] [ A m -Z* S m 60 , A m +Z* S m 60 ] ;

[0027] Where Z is the Z score corresponding to the confidence level in the standard normal distribution quick lookup table;

[0028] Step S33: The network server compares the network traffic data with the confidence interval of no APT attack. If the network traffic data exceeds the confidence interval of no APT attack, the network server records a point-level network traffic anomaly, and also records the time point of the point-level network traffic anomaly and the amount by which the network traffic data exceeds the confidence interval of no APT attack at that time point.

[0029] Further, in step S4, the process of the network server using the nested LSTM integrated fully connected neural network model to identify network traffic data includes the following steps:

[0030] Step S41: the network server downloads and preprocesses the KDD CUP 99 data set to generate a preprocessed KDD CUP99 data set;

[0031] Step S42: The network server constructs a nested LSTM integrated fully connected neural network model and uses the preprocessed KDD CUP 99 data set to train the nested LSTM integrated fully connected neural network model;

[0032] Step S43: the network server performs first-order difference processing on the network traffic data in ten-minute segments and inputs the processed data into the first nested LSTM layer, and inputs the baseline of the network traffic data segments of the corresponding time segment into the splicing and fusion layer;

[0033] Step S44: whether there is a subsequence-level network traffic anomaly in the network traffic data output by the nested LSTM integrated fully connected neural network model;

[0034] Step S45: The network server obtains the number of subsequence-level network traffic anomalies based on the output of the nested LSTM integrated fully connected neural network model.

[0035] Further, in step S5, the process of the network server using the PID-like APT risk index formula to calculate the APT risk index includes the following steps:

[0036] Step S51: The network server uses the Bayesian optimization method to set the proportional term, integral term and differential term of the APT risk index of the point-level network traffic anomaly and the APT risk index of the single subsequence-level network traffic anomaly;

[0037] Step S52: The APT risk index is calculated every time a subsequence-level network traffic anomaly or a point-level network traffic anomaly occurs on the network server. The APT risk index formula of the PID class is as follows:

[0038] ;

[0039] in, Represents the APT risk index, Represents the APT risk index of a single subsequence-level network traffic anomaly, Represents the number of subsequence-level network traffic anomalies in the past hour. The amount by which the network traffic data representing the most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. The network traffic data representing the second most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. The network traffic data representing the third most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. Represents the time point of the most recent point-level network traffic anomaly. The time point representing the third most recent point-level network traffic anomaly. It is the sum of the excess of all point-level network traffic anomalies in the past hour over the confidence interval of no APT attack. It is the proportional item of the APT risk index of point-level network traffic anomaly. It is the integral item of the APT risk index of point-level network traffic anomaly. It is the differential item of the APT risk index of point-level network traffic anomaly.

[0040] Further, in step S6, the gateway dynamically adjusts the firewall according to the APT risk index, including the following steps:

[0041] Step S61: The administrator formulates a firewall whitelist according to the needs of the company's daily business operations and collects known malicious IP addresses to formulate a firewall blacklist;

[0042] Step S62: When the APT risk index exceeds 100, the gateway will query online one by one the geographical location and affiliated organization of the IP outside the whitelist involved in the most recent point-level network traffic anomaly and subsequence-level network traffic anomaly. When the geographical location and affiliated organization of the queried IP correspond to the geographical location and affiliated organization of the IP in the firewall's blacklist, the queried IP will be added to the firewall's blacklist;

[0043] Step S63: When the APT risk index exceeds 200, the gateway only allows IPs in the firewall's whitelist to access the network server.

[0044] The beneficial effects achieved by the present invention using the above scheme are as follows:

[0045] (1) By adopting a nested LSTM integrated fully connected neural network model and a network baseline to detect subsequence-level and point-level network traffic anomalies respectively, and using a PID-like APT risk index to respond to changes in the network security situation in a timely manner and dynamically adjust the firewall policy, we can deeply mine the nonlinear characteristics and spatiotemporal characteristics of network traffic data to detect APT attacks, and the overall protection performance of the solution is enhanced over time.

[0046] (2) The PID-like APT risk index formula is based on the current status, historical behavior, and future trends of network traffic anomalies, enabling timely responses to changes in the network security situation.

[0047] (3) The concatenation and fusion layer of the nested LSTM integrated fully connected neural network model integrates the network traffic data features extracted by the nested LSTM layer with the network traffic baseline, which improves the generalization performance of the model, deeply mines the nonlinear characteristics and spatiotemporal characteristics of the network traffic data, and performs first-order difference on the network traffic data to reduce the irregular fluctuations and noise, making the model more robust. The method of detecting point-level network traffic anomalies based on the network traffic baseline improves the overall interpretability.

[0048] (4) The gateway dynamically adjusts the firewall according to the APT risk index, allowing the firewall to adapt to the current network security situation at any time, and automatically expands the firewall blacklist, making the overall solution more stable.

[0049] (5) The Bayesian optimization method is used to set the proportional, integral and differential terms of the APT risk index of point-level network traffic anomalies and the APT risk index of single subsequence-level network traffic anomalies. Compared with manual setting, it takes into account the costs of false positives and false negatives, can reduce false negatives and false positives, and is more explainable. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 This is a schematic diagram of the model of the nested LSTM integrated fully connected neural network model proposed in the present invention.

[0051] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION

[0052] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0053] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the examples given are only used to explain the present invention, and are not used to limit the scope of the present invention.

[0054] Embodiment 1, the present invention provides a method for detecting and defending against APT attacks, which is applied to a network server system, wherein the network server system includes a gateway and a network server, and the method for detecting and defending against APT attacks includes the following steps:

[0055] Step S1: The gateway records network traffic data in real time and transmits it to the network server;

[0056] Step S2: The network server calculates and generates a network traffic baseline based on past network traffic data;

[0057] Step S3: the network server identifies the network traffic data according to the network traffic baseline, and obtains the number of point-level network traffic anomalies;

[0058] Step S4: The network server uses a nested LSTM integrated fully connected neural network model to identify network traffic data and obtain the number of subsequence-level network traffic anomalies;

[0059] Step S5: The network server calculates the APT risk index using the PID-like APT risk index formula, and the network server transmits the APT risk index to the gateway;

[0060] Step S6: A firewall is preset in the gateway, and the gateway dynamically adjusts the firewall according to the APT risk index.

[0061] Embodiment 2: This embodiment is based on the above embodiment. In step S2, the process of the network server calculating and generating a network traffic baseline based on past network traffic data includes the following steps:

[0062] Step S21: the network server splits the past network traffic data by day and then by minute. The network traffic data of one day is split into 1440 network traffic data segments, each of which is a set containing the network traffic value per second.

[0063] Step S22: the network server calculates the average value and standard deviation of the network traffic value per second in each network traffic data segment;

[0064] Step S23: The network server averages the mean value and standard deviation of the network traffic data segments corresponding to the same time point every day to generate the corresponding network traffic data segment baseline, and the formula is as follows:

[0065] ;

[0066] ;

[0067] f m =[ A m , S m ] ;

[0068] in, represents the day to which the network traffic data segment belongs, and m represents the day to which the network traffic data segment belongs. The number of minutes in the day, Representative Tiandi The average value of network traffic value per second in the network traffic data segment of the minute. Representative Tiandi The standard deviation of the network traffic value per second of the network traffic data segment of the minute, D represents the number of days of past network traffic data records, Representative The average value of network traffic value per second in the network traffic data segment of the minute. Representative The standard deviation of the network traffic values ​​per second for the minute-long network traffic data segment, represents the network traffic data segment baseline of the mth minute. In this embodiment, D is 100;

[0069] Step S24: The network server aggregates the network traffic data segment baselines per minute into a network traffic baseline. The network traffic baseline formula is as follows:

[0070] F=[ f 1 , f 2 ,…, f 1440 ] ;

[0071] Where F represents the network traffic baseline.

[0072] Embodiment 3: This embodiment is based on embodiment 2. In step S3, the process of the network server identifying network traffic data according to the network traffic baseline is as follows:

[0073] Step S31: The administrator sets the confidence level that no APT attack has occurred to 0.95;

[0074] Step S32: The network server calculates a confidence interval of no APT attack according to the confidence that no APT attack has occurred. The calculation formula of the confidence interval of no APT attack is as follows:

[0075] [ A m -Z* S m 60 , A m +Z* S m 60 ] ;

[0076] Wherein, Z is the Z score corresponding to the confidence level in the standard normal distribution quick lookup table. In this embodiment, the Z corresponding to the confidence level of 0.95 is 1.96. The calculation formula for the confidence interval of no APT attack is: [ A m -1.96* S m 60 , A m +1.96* S m 60 ] In this example, the time is 10:36 am, and the network traffic baseline corresponding to this time point is [100,50] , the confidence interval of no APT attack is [87.35,112.65] ;

[0077] Step S33: The network server compares the network traffic data with the confidence interval of no APT attack. In this embodiment, the network traffic at this time point is 120. The network server records a network traffic anomaly at 10:36 am, and the excess is 7.35.

[0078] Example 4, see Figure 1 This embodiment is based on the third embodiment. In step S4, the process of the network server using the nested LSTM integrated fully connected neural network model to identify network traffic data includes the following steps:

[0079] Step S41: the network server downloads and preprocesses the KDD CUP 99 data set to generate a preprocessed KDD CUP99 data set;

[0080] Step S42: The network server constructs a nested LSTM integrated fully connected neural network model and uses the preprocessed KDD CUP 99 data set to train the nested LSTM integrated fully connected neural network model;

[0081] Step S43: the network server performs first-order difference processing on the network traffic data in ten-minute segments and inputs the processed data into the first nested LSTM layer, and inputs the baseline of the network traffic data segments of the corresponding time segment into the splicing and fusion layer;

[0082] Step S44: There is a subsequence-level network traffic anomaly in the network traffic data output by the nested LSTM integrated fully connected neural network model;

[0083] Step S45: The network server obtains the number of subsequence-level network traffic anomalies based on the output of the nested LSTM integrated fully connected neural network model.

[0084] Embodiment 5: This embodiment is based on embodiment 4. In step S41, the process of preprocessing the KDD CUP 99 data set includes the following steps:

[0085] Step S411: Arrange the duration column in the KDD CUP 99 data set to generate a network traffic time point column, arrange the src_bytes column to generate a network traffic column corresponding to each time point, and arrange the label column to generate a "normal / attack" label column to construct a network traffic data set;

[0086] Step S412: Calculate and generate a network traffic baseline of a network traffic data set;

[0087] Step S413: performing first-order difference processing on the network flow column of the network flow data set;

[0088] Step S414: perform data enhancement by concatenating the network traffic data set and the network traffic baseline to generate a preprocessed KDD CUP 99 data set.

[0089] Embodiment 6, based on Embodiment 5, in step S42, the process of constructing a nested LSTM integrated fully connected neural network model and using the preprocessed KDD CUP 99 data set to train the nested LSTM integrated fully connected neural network model includes the following steps:

[0090] Step S421: Download the nested LSTM layer file from GitHub and import it;

[0091] Step S422: adding a first nested LSTM layer and a second nested LSTM layer by using a functional API, wherein the nested LSTM layers mine the nonlinear characteristics and spatiotemporal characteristics of the network traffic data;

[0092] Step S423: Add a concatenation fusion layer using a functional API to concatenate the features output by the nested LSTM layer with the network traffic baseline for the corresponding time period;

[0093] Step S424: using a functional API to add a first fully connected layer, a second fully connected layer, and a third fully connected layer, wherein the fully connected layer mines the relationship between the network traffic baseline and the features output by the nested LSTM layer;

[0094] Step S425: divide the preprocessed KDD CUP 99 data set into a training set and a validation set in a ratio of 8:2, specify the optimizer as adam, the loss function as binary cross entropy, and call the model.fit method to perform model training.

[0095] Embodiment 7, based on Embodiment 6, in step S5, the process of the network server using the PID-like APT risk index formula to calculate the APT risk index includes the following steps:

[0096] Step S51: The network server uses the Bayesian optimization method to set the proportional term, integral term and differential term of the APT risk index of the point-level network traffic anomaly and the APT risk index of the single subsequence-level network traffic anomaly;

[0097] Step S52: The APT risk index is calculated every time a subsequence-level network traffic anomaly or a point-level network traffic anomaly occurs on the network server. The APT risk index formula of the PID class is as follows:

[0098] ;

[0099] in, Represents the APT risk index, Represents the APT risk index of a single subsequence-level network traffic anomaly, Represents the number of subsequence-level network traffic anomalies in the past hour. The amount by which the network traffic data representing the most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. The network traffic data representing the second most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. The network traffic data representing the third most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. Represents the time point of the most recent point-level network traffic anomaly. The time point representing the third most recent point-level network traffic anomaly. It is the sum of the excess of all point-level network traffic anomalies in the past hour over the confidence interval of no APT attack. It is the proportional item of the APT risk index of point-level network traffic anomaly. It is the integral item of the APT risk index of point-level network traffic anomaly. is the differential item of the APT risk index of point-level network traffic anomaly. In this embodiment, is 30, is 3, is 1, is 1.5, is 25, is 10, is 5, is 3, is 10, It is 11:01, is 10:56, so is 205.

[0100] Embodiment 8, based on embodiment 7, in step S51, the network server uses the Bayesian optimization method to set the proportional term, integral term and differential term of the APT risk index of the point-level network traffic anomaly and the APT risk index of the single subsequence-level network traffic anomaly, including the following steps:

[0101] Step S511: randomly initializing the proportional term, integral term and differential term of the APT risk index of the point-level network traffic anomaly and the APT risk index of the single subsequence-level network traffic anomaly;

[0102] Step S512: using the nested LSTM integrated fully connected neural network model to generate subsequence-level network traffic anomaly records for the preprocessed KDD CUP 99 dataset, and using the preprocessed KDD CUP 99 dataset to identify network traffic data according to the network traffic baseline to generate point-level network traffic anomaly records;

[0103] Step S513: splicing the preprocessed KDD CUP 99 data set with the subsequence-level network traffic anomaly records and the point-level network traffic anomaly records according to corresponding time points to generate a Bayesian optimization data set;

[0104] Step S514: define a total cost formula, the total cost formula is calculated as follows:

[0105] ;

[0106] in, is the total cost, is the cost of missing a single APT attack. is the cost of a single APT attack false positive. is the frequency of underreporting, is the frequency of false positives;

[0107] In this embodiment, the cost of false positives obtained from the feedback is 200, and the cost of missed positives is 2000. The total cost formula is: ;

[0108] Step S515: define an optimization function, define the internal model to be optimized as the PID-like APT risk index formula, define the data set of the PID-like APT risk index formula as the Bayesian optimization data set, define the objective function as the total cost formula, and define the parameter combination to be optimized as the proportional term, integral term and differential term of the APT risk index of the point-level network traffic anomaly and the APT risk index of the single subsequence-level network traffic anomaly;

[0109] Step S516: import the bayesian-optimization library, specify the bayesian-optimization function to process the optimization function, and find the optimal parameter combination by minimizing the objective function.

[0110] Embodiment 9: This embodiment is based on embodiment 8. In step S6, the gateway dynamically adjusts the firewall according to the APT risk index, including the following steps:

[0111] Step S61: The administrator formulates a whitelist of the firewall according to the needs of the company's daily business operations, and downloads the IP blacklist of USTC to formulate a blacklist of the firewall;

[0112] Step S62: When the APT risk index exceeds 100, the gateway queries online one by one the geographical location and affiliated organization of the IP outside the white list involved in the most recent point-level network traffic anomaly and subsequence-level network traffic anomaly. When the geographical location and affiliated organization of the queried IP correspond to the geographical location and affiliated organization of the IP in the firewall's blacklist, the queried IP is added to the firewall's blacklist. In this embodiment, the geographical location and affiliated organization of the queried IP correspond to the geographical location and affiliated organization of the IP in the firewall's blacklist, and the queried IP is added to the firewall's blacklist.

[0113] Step S63: When the APT risk index exceeds 200, the gateway only allows IPs in the firewall's whitelist to access the network server.

[0114] Embodiment 10. This embodiment is based on embodiment 9. This embodiment runs in the Windows operating system environment. The experiment relies on the Anaconda3 environment and uses TensorFlow as the model framework. For the data preprocessing stage, the Pandas library is used in combination with the Numpy tool to complete the data preprocessing work and convert the original data into a matrix format. The gateway uses Ruigu Zhilian X100 and the network server uses Huawei 5288-V5.

[0115] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.

Claims

1. A detection and defense method for APT attacks, applied to a network server system, wherein the network server system includes a gateway and a network server, It is characterized in that The detection and defense method for APT attacks includes the following steps: Step S1: The gateway records network traffic data in real time and transmits it to the network server; Step S2: The network server calculates and generates a network traffic baseline based on past network traffic data; Step S3: the network server identifies network traffic data according to the network traffic baseline, and obtains the number of point-level network traffic anomalies, wherein the point-level network traffic anomaly refers to the network traffic observed at a specific time point being significantly different from an expected or normal pattern; Step S4: The network server uses a nested LSTM integrated fully connected neural network model to identify network traffic data and obtain the number of subsequence-level network traffic anomalies; Step S5: The network server calculates the APT risk index using the PID-like APT risk index formula, and the network server transmits the APT risk index to the gateway; Step S6: A firewall is preset in the gateway, and the gateway dynamically adjusts the firewall according to the APT risk index; In step S3, the network server identifies network traffic data according to the network traffic baseline as follows: Step S31: The administrator sets the confidence level that no APT attack has occurred; Step S32: the network server calculates a confidence interval of no APT attack according to the confidence that no APT attack has occurred; Step S33: The network server compares the network traffic data with the confidence interval of no APT attack. If the network traffic data exceeds the confidence interval of no APT attack, the network server records a point-level network traffic anomaly, and records the time point of the point-level network traffic anomaly and the amount by which the network traffic data exceeds the confidence interval of no APT attack at that time point. In step S5, the process of the network server using the PID-like APT risk index formula to calculate the APT risk index includes the following steps: Step S51: The network server uses the Bayesian optimization method to set the proportional term, integral term and differential term of the APT risk index of the point-level network traffic anomaly and the APT risk index of the single subsequence-level network traffic anomaly; Step S52: The APT risk index is calculated every time a subsequence-level network traffic anomaly or a point-level network traffic anomaly occurs on the network server. The APT risk index formula of the PID class is as follows: ; in, Represents the APT risk index, Represents the APT risk index of a single subsequence-level network traffic anomaly, Represents the number of subsequence-level network traffic anomalies in the past hour. The amount by which the network traffic data representing the most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. The network traffic data representing the second most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. The network traffic data representing the third most recent point-level network traffic anomaly exceeds the confidence interval for no APT attack. Represents the time point of the most recent point-level network traffic anomaly. The time point representing the third most recent point-level network traffic anomaly. It is the sum of the excess of all network traffic data with point-level network traffic anomalies in the past hour over the confidence interval of no APT attack. P is the proportional term of the APT risk index of point-level network traffic anomalies. I is the integral term of the APT risk index of point-level network traffic anomalies. D is the differential term of the APT risk index of point-level network traffic anomalies.

2. A method for detecting and defending against APT attacks according to claim 1, It is characterized in that In step S2, the process of the network server calculating and generating a network traffic baseline based on past network traffic data includes the following steps: Step S21: the network server splits the past network traffic data by day and then by minute. The network traffic data of one day is split into 1440 network traffic data segments, each of which is a set containing the network traffic value per second. Step S22: the network server calculates the average value and standard deviation of the network traffic value per second in each network traffic data segment; Step S23: The network server averages the mean value and standard deviation of the network traffic data segments corresponding to the same time point every day to generate the corresponding network traffic data segment baseline, and the formula is as follows: ; ; ; in, represents the day to which the network traffic data segment belongs, and m represents the day to which the network traffic data segment belongs. The number of minutes in the day, Representative Tiandi The average value of network traffic value per second in the network traffic data segment of the minute. Representative Tiandi The standard deviation of the network traffic values ​​per second for the minute-long network traffic data segment, Represents the number of days of past network traffic data records, Representative The average value of network traffic value per second in the network traffic data segment of the minute. Representative The standard deviation of the network traffic values ​​per second for the minute-long network traffic data segment, The baseline of the network traffic data segment representing the mth minute; Step S24: The network server aggregates the network traffic data segment baselines every minute into a network traffic baseline. The network traffic baseline formula is as follows: ; Where F represents the network traffic baseline.

3. A method for detecting and defending against APT attacks according to claim 2, It is characterized in that In step S32, the calculation formula of the confidence interval that no APT attack has occurred is as follows: ; Where Z is the confidence level's corresponding Z score from the standard normal distribution quick lookup table.

4. A method for detecting and defending against APT attacks according to claim 3, It is characterized in that The nested LSTM integrated fully connected neural network model includes a first nested LSTM layer, a second nested LSTM layer, a splicing fusion layer, a first fully connected layer, a second fully connected layer and a third fully connected layer.

5. A method for detecting and defending against APT attacks according to claim 4, It is characterized in that In step S4, the process of the network server using the nested LSTM integrated fully connected neural network model to identify network traffic data includes the following steps: Step S41: the network server downloads and preprocesses the KDD CUP 99 data set to generate a preprocessed KDD CUP 99 data set; Step S42: The network server constructs a nested LSTM integrated fully connected neural network model and uses the preprocessed KDDCUP 99 data set to train the nested LSTM integrated fully connected neural network model; Step S43: the network server performs first-order difference processing on the network traffic data in ten-minute segments and inputs the processed data into the first nested LSTM layer, and inputs the baseline of the network traffic data segments of the corresponding time segment into the splicing and fusion layer; Step S44: whether there is a subsequence-level network traffic anomaly in the network traffic data output by the nested LSTM integrated fully connected neural network model; Step S45: The network server obtains the number of subsequence-level network traffic anomalies based on the output of the nested LSTM integrated fully connected neural network model.