Network data packet sample generation method and system based on generative adversarial network
By generating abnormal network packet samples through a system based on a generative adversarial network, the problem of lack of samples and overfitting in the training of network traffic anomaly detection algorithms in the existing technology is solved, and the generalization performance and adaptability of the detection algorithm are improved.
Patent Information
- Application Number
- CN202410651484.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-08-30
AI Technical Summary
Existing network traffic anomaly detection algorithms require a large number of labeled network data packet samples during training, especially abnormal data packets, and the samples in the actual network environment lack labeling and the proportion of abnormal data packets is small, resulting in poor generalization performance and easy Overfitting occurs.
Design a system based on generative adversarial network, including packet sample library, traffic sample feature extractor, noise generator, traffic feature sample generator, abnormal traffic discriminator and training controller, and generate new abnormal traffic features through iterative training Sample, used to generate abnormal network packet samples.
The abnormal traffic packet samples generated by the generative adversarial network can be used to train the network traffic anomaly detection algorithm, which improves the generalization performance of the algorithm, reduces the possibility of over-fitting, and enhances the adaptability to the actual network environment.
Smart Images

Figure CN118573431A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security, and in particular relates to a method and system for generating network data packet samples based on a generative adversarial network. Background Art
[0002] Network traffic anomaly detection is an important means of discovering network attacks. With the development of artificial intelligence technology, both machine learning algorithms and deep learning algorithms have been widely used in the field of network traffic anomaly detection and have become a hot topic in current research. In order to train the network anomaly traffic detection algorithm, a large number of network data packets are needed as samples to train and test the algorithm, such as some public network data packet data sets. However, the generalization performance of the algorithm trained only with public data sets is not good, and it is easy to overfit. Therefore, when training the algorithm, it is often necessary to use data packets collected in the actual network environment as samples for training. However, the samples in the actual network environment lack annotations, and the proportion of abnormal data packets in the actual network is small, which is not conducive to the training of the network traffic anomaly detection algorithm.
[0003] Generative Adversarial Networks (GANs) are a deep learning architecture that trains two neural networks to compete with each other to generate more realistic new data from a given training dataset. GANs work by training two different networks and pitting them against each other. One network generates new data by taking input data samples and modifying them as much as possible, and the other network tries to predict whether the generated data output belongs to the original dataset. The system iteratively generates newer and improved versions of the fake data values until the prediction network can no longer distinguish between the fake data values and the original data values.
[0004] The characteristics of generative adversarial networks can be applied to the generation of data packet samples in the training of network traffic anomaly detection algorithms, especially the generation of abnormal data packets. How to design a generative adversarial network so that it can be applied to the generation of network data packet samples is a problem that needs to be solved. Summary of the invention
[0005] 1. Technical issues to be resolved
[0006] The technical problem to be solved by the present invention is: how to design a network data packet sample generation method and system based on a generative adversarial network to automatically generate abnormal network data packet samples according to input sample data for training a network traffic anomaly detection algorithm.
[0007] (II) Technical solution
[0008] In order to solve the above technical problems, the present invention provides a network data packet sample generation system based on a generative adversarial network, comprising:
[0009] A data packet sample library, used to store abnormal network traffic data packet samples, each abnormal network traffic data packet sample includes a group of all data packets constituting an abnormal traffic session;
[0010] A traffic sample feature extractor is used to extract traffic features from abnormal network traffic data packet samples. Traffic features are features extracted from abnormal traffic sessions, and each abnormal traffic session sample constitutes a feature vector.
[0011] A noise generator is used to generate flow characteristic value noise, where the flow characteristic value noise is a vector with the same dimension as the characteristic vector;
[0012] A flow feature sample generator, used to generate new abnormal flow feature samples using the abnormal flow feature samples and flow feature value noise in the flow feature;
[0013] The abnormal traffic discriminator is used to detect the new abnormal traffic feature samples generated by the traffic feature sample generator, identify the samples as abnormal traffic or normal traffic, and feed back the detection results to the traffic feature sample generator for generating new abnormal traffic feature samples;
[0014] A training controller is used to control the iteration of continuous generation and discrimination between the flow feature sample generator and the abnormal flow discriminator. When the training reaches a balanced state, that is, when all samples generated by the flow feature sample generator are identified as abnormal flow by the abnormal flow discriminator, the training ends.
[0015] The abnormal traffic data packet sample generator is used to generate abnormal network traffic data packet samples at the end of training using the samples generated by the traffic feature sample generator that has completed training.
[0016] Preferably, the data packet sample library consists of sample files and sample indexes, wherein the sample indexes mark the common properties of the samples, including the number of data packets, five-tuples, duration, and abnormal classification of the data packet samples, and store the paths of the sample files. The sample files are stored in the Pcap file format, and each file stores all the data packets in a sample.
[0017] Preferably, the traffic sample feature extractor is capable of reading the Pcap file of each sample in the data packet sample library. The traffic sample feature extractor can extract the session and protocol information in the Pcap file according to the feature requirements of the traffic feature sample generator to form a feature vector of the traffic sample. The feature value corresponding to the feature vector is the data packet statistical value. The data packet statistical value includes the minimum and average value of the data packet payload bytes, the data packet payload byte rate, the standard deviation and maximum value of the data packet header bytes, the minimum and standard deviation of the data packet interval, and the number of data packets with TCP flag bits.
[0018] Preferably, the noise generator is implemented using a random vector generator, and each dimension in the generated vector is a random number between 0 and 1.
[0019] Preferably, the traffic feature sample generator is a neural network. The traffic feature sample generator inputs abnormal traffic feature samples from the traffic sample feature extractor and inputs traffic feature value noise from the noise generator. The abnormal traffic feature samples and the traffic feature value noise are transformed through several layers to generate adversarial samples of the traffic features as new abnormal traffic feature samples.
[0020] Preferably, the abnormal traffic discriminator is composed of an abnormal traffic detection model. If a Botnet data packet is to be generated, a Botnet detection model based on SVM is selected as the abnormal traffic discriminator; the traffic feature sample generator adjusts parameters according to the feedback of the abnormal traffic discriminator, and iteratively generates samples for detection by the abnormal traffic discriminator; the trained traffic feature sample generator again inputs the abnormal traffic feature samples in the traffic features extracted from the samples in the data packet sample library and the traffic feature value noise generated by the noise generator to generate new abnormal traffic feature samples, and then inputs the new abnormal traffic feature samples into the abnormal traffic sample data packet generator; the abnormal traffic sample data packet generator generates abnormal network traffic data packet samples according to the statistical value distribution of the new abnormal traffic feature samples.
[0021] Preferably, the traffic feature sample generator uses a Concatenate layer to connect feature vectors, uses two Linear layers to perform nonlinear transformation, uses a Sigmoid function in the activation layer, and finally outputs a 23-dimensional new abnormal traffic feature sample.
[0022] Preferably, the abnormal traffic discriminator is a Patator attack malicious traffic detection algorithm model based on random forest, which can output a test parameter, and the test parameter is a floating point number between 0 and 1. When the absolute value of the difference between the output detection parameter and 1 is less than a preset threshold, the training is completed.
[0023] Preferably, the abnormal traffic data packet sample generator is specifically used to generate abnormal network traffic data packet samples that meet the statistical value characteristics by means of random numbers based on the statistical value distribution.
[0024] The present invention also provides a method for generating network data packet samples based on a generative adversarial network implemented based on the system.
[0025] (III) Beneficial effects
[0026] The present invention adopts a method for generating network traffic data packet samples by generative adversarial network training, generates new feature samples by a traffic feature sample generator, and discriminates the generated samples by an abnormal traffic discriminator, and iteratively trains the traffic feature sample generator by feeding back the discrimination results, so that the traffic feature sample generator can generate abnormal traffic feature samples, and then generate abnormal traffic data packet samples. The generated abnormal traffic data packet samples can be used for the training of abnormal traffic detection engines. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of the basic framework of a network data packet sample generation system based on a generative adversarial network according to the present invention;
[0028] Figure 2 This is a flow chart of a method for generating network data packet samples based on a generative adversarial network according to the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0030] The present invention discloses a network data packet sample generation system based on a generative adversarial network, which can realize the generation of network data packet samples for machine learning and deep learning training. The system consists of a data packet sample library, a traffic sample feature extractor, a noise generator, a traffic feature sample generator, an abnormal traffic discriminator, a training controller and an abnormal traffic data packet sample generator. Figure 1 shown.
[0031] The data packet sample library stores data packet samples. Specifically, the data packet sample library stores abnormal network traffic data packet samples. Each abnormal network traffic data packet sample is a group of all data packets that constitute an abnormal traffic session. The data packet sample library consists of sample files and sample indexes, where the sample index marks the common attributes of the sample, such as the number of packets, five-tuple, duration, and abnormal classification of the data packet sample, and stores the path of the data packet sample file. The data packet sample file is stored in the Pcap file format, and each file stores all the data packets in a sample.
[0032] A traffic sample feature extractor is used to extract traffic features from abnormal network traffic data packet samples. Traffic features are features extracted based on traffic sessions, and each traffic session sample constitutes a feature vector. The traffic sample feature extractor reads the Pcap file of each sample in the data packet sample library. The traffic sample feature extractor can extract the session and protocol information in the Pcap file according to the feature requirements of the traffic feature sample generator to form a feature vector of the traffic sample. The feature value corresponding to the feature vector is the data packet statistical value, such as the minimum and average value of the data packet payload bytes, the data packet payload byte rate, the standard deviation and maximum value of the data packet header bytes, the minimum and standard deviation of the data packet interval, and the number of data packets with TCP flags.
[0033] A noise generator is used to generate flow characteristic value noise, which is a vector with the same dimension as the characteristic vector. The noise generator is implemented by a random vector generator, and each dimension in the generated vector is a random number between 0 and 1.
[0034] A generative model is used as a flow feature sample generator, and the abnormal flow feature samples and flow feature value noise in the flow feature are used to generate new abnormal flow feature samples. The flow feature sample generator is a neural network, but is not limited to using a specific neural network. The flow feature sample generator inputs abnormal flow feature samples from the flow sample feature extractor and inputs flow feature value noise from the noise generator. The abnormal flow feature samples and flow feature value noise are transformed through several layers to generate adversarial samples of the flow feature as new abnormal flow feature samples.
[0035] An abnormal traffic detection engine is used as an abnormal traffic discriminator to detect the new abnormal traffic feature samples generated by the traffic feature sample generator, identify the samples as abnormal traffic or normal traffic, and feed back the detection results to the traffic feature sample generator for generating new abnormal traffic feature samples. The abnormal traffic discriminator is composed of an abnormal traffic detection model. If different types of abnormal data packets need to be generated, the abnormal traffic detection model can be selected as the abnormal traffic discriminator. For example, if a Botnet data packet is to be generated, a Botnet detection model based on SVM can be selected as the abnormal traffic discriminator. The abnormal traffic discriminator detects the samples generated by the traffic feature sample generator and feeds back the detection results to the traffic feature sample generator. The traffic feature sample generator iteratively generates samples based on feedback adjustment parameters for detection by the abnormal traffic discriminator until the abnormal traffic discriminator detects all samples generated by the traffic feature sample generator as abnormal, and the training of the traffic feature sample generator is completed.
[0036] A training controller is used to control the continuous generation and discrimination iterations between the traffic feature sample generator and the abnormal traffic discriminator. When the training reaches a balance, that is, all samples generated by the traffic feature sample generator are identified as abnormal traffic by the abnormal traffic discriminator, the training ends.
[0037] An abnormal traffic data packet sample generator is used. When the training is finished, the sample generated by the traffic feature sample generator that has completed the training is used to generate abnormal network traffic data packet samples. The traffic feature sample generator that has completed the training again inputs the abnormal traffic feature samples in the traffic features extracted from the samples in the data packet sample library and the traffic feature value noise generated by the noise generator to generate new abnormal traffic feature samples, and then inputs the new abnormal traffic feature samples into the abnormal traffic sample data packet generator. The abnormal traffic sample data packet generator generates abnormal network traffic data packet samples according to the statistical distribution in the new abnormal traffic feature samples.
[0038] Through the above system, the traffic feature sample generator generates new feature samples according to abnormal traffic features and noise, which are tested by the abnormal traffic discriminator and the test results are fed back to the traffic feature sample generator. This process is iterated repeatedly until the generated samples identified by the abnormal traffic discriminator are all "abnormal", indicating that the traffic feature sample generator has been trained. At this time, the samples generated by the traffic feature sample generator are input into the abnormal traffic data packet sample generator to generate abnormal traffic data packet samples.
[0039] Taking the generation of brute force cracking traffic samples as an example, the steps of a network data packet sample generation method based on a generative adversarial network of the present invention are as follows: Figure 2 As shown, the following steps are included:
[0040] 1) Use the Bruteforce attack samples in the CSE-CIC-IDS2018onAWS sample library to build a data packet sample library;
[0041] 2) The traffic sample feature extractor reads the Pcap packets in the sample library through a script and extracts feature values. The feature values are as follows: minimum value of forward data packet payload bytes, average value of forward data packet payload bytes, minimum value of reverse data packet payload bytes, reverse data packet payload byte rate, standard deviation of forward data packet header bytes, maximum value of reverse data packet header bytes, standard deviation of reverse data packet header bytes, minimum value of packet interval time, standard deviation of packet interval time, minimum value of reverse packet interval time, number of packets with SYN flag, number of packets with ECE flag, number of packets with CWR flag, number of packets with FIN flag, number of packets with RST flag, number of packets with PSH flag, number of packets with ACK flag, number of packets with URG flag, number of packets with URG flag in the forward direction, number of packets with URG flag in the reverse direction, number of bytes sent in the reverse flow initialization window, average bulk transmission rate of the forward data flow, average bulk transmission rate of the reverse data flow;
[0042] 3) The noise generator generates a noise vector with a dimension of 10, and the value of each component is a random number between (0 and 1);
[0043] 4) Input the eigenvalue samples and random noise vectors into the traffic feature sample generator. The traffic feature sample generator uses a Concatenate layer to connect the eigenvectors, two Linear layers for nonlinear transformation, and the activation layer uses the Sigmoid function. Finally, it outputs a 23-dimensional new abnormal traffic feature sample.
[0044] 5) Input the generated new abnormal traffic feature sample into the Patator attack malicious traffic detection algorithm model based on random forest for detection, and output the test parameter, which is a floating point number between 0 and 1;
[0045] 6) Input the parameters output from step 5 into the traffic feature sample generator to continue generating feature samples, and repeat steps 4 to 6 until the absolute value of the difference between the detection parameter output from step 5 and 1 is less than the preset threshold value, and the training is completed (since the detection parameter is a floating point number between 0 and 1, the closer it is to 1, the more accurate the detection is. Therefore, iterating repeatedly until the absolute value of the difference between the detection parameter and 1 is less than the preset threshold value indicates that the abnormal traffic discriminator detects all samples generated by the traffic feature sample generator as abnormal, and the training is completed);
[0046] 7) The characteristic samples generated by the traffic characteristic sample generator are input into the abnormal traffic sample data packet generator. Since the traffic characteristic samples are statistical values of the traffic data, a random number method is used to generate abnormal network traffic data packet samples that meet the statistical value characteristics based on the statistical value distribution.
[0047] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A network data packet sample generation system based on generative adversarial networks, It is characterized in that include: A data packet sample library, used to store abnormal network traffic data packet samples, each abnormal network traffic data packet sample includes a group of all data packets constituting an abnormal traffic session; A traffic sample feature extractor is used to extract traffic features from abnormal network traffic data packet samples. Traffic features are features extracted from abnormal traffic sessions, and each abnormal traffic session sample constitutes a feature vector. A noise generator is used to generate flow characteristic value noise, where the flow characteristic value noise is a vector with the same dimension as the characteristic vector; A flow feature sample generator, used to generate new abnormal flow feature samples using the abnormal flow feature samples and flow feature value noise in the flow feature; The abnormal traffic discriminator is used to detect the new abnormal traffic feature samples generated by the traffic feature sample generator, identify the samples as abnormal traffic or normal traffic, and feed back the detection results to the traffic feature sample generator for generating new abnormal traffic feature samples; A training controller is used to control the iteration of continuous generation and discrimination between the flow feature sample generator and the abnormal flow discriminator. When the training reaches a balanced state, that is, when all samples generated by the flow feature sample generator are identified as abnormal flow by the abnormal flow discriminator, the training ends. The abnormal traffic data packet sample generator is used to generate abnormal network traffic data packet samples at the end of training using the samples generated by the traffic feature sample generator that has completed training.
2. The system according to claim 1, It is characterized in that The data packet sample library consists of sample files and sample indexes, wherein the sample indexes mark the common properties of the samples, including the number of data packets, five-tuples, duration, and abnormal classification of the data packet samples, and store the paths of the sample files. The sample files are stored in the Pcap file format, and each file stores all the data packets in a sample.
3. The system according to claim 1, It is characterized in that The traffic sample feature extractor can read the Pcap file of each sample in the data packet sample library. The traffic sample feature extractor can extract the session and protocol information in the Pcap file according to the feature requirements of the traffic feature sample generator to form a feature vector of the traffic sample. The feature value corresponding to the feature vector is the data packet statistical value. The data packet statistical value includes the minimum and average value of the data packet payload bytes, the data packet payload byte rate, the standard deviation and maximum value of the data packet header bytes, the minimum and standard deviation of the data packet interval, and the number of data packets with TCP flag bits.
4. The system according to claim 1, It is characterized in that The noise generator is implemented by a random vector generator, and each dimension in the generated vector is a random number between 0 and 1.
5. The system according to claim 1, It is characterized in that The traffic feature sample generator is a neural network. The traffic feature sample generator inputs abnormal traffic feature samples from the traffic sample feature extractor and inputs traffic feature value noise from the noise generator. The abnormal traffic feature samples and the traffic feature value noise are transformed through several layers to generate adversarial samples of traffic features as new abnormal traffic feature samples.
6. The system of claim 1, It is characterized in that The abnormal traffic discriminator is composed of an abnormal traffic detection model. If a Botnet data packet is to be generated, a Botnet detection model based on SVM is selected as the abnormal traffic discriminator; The traffic feature sample generator adjusts parameters according to the feedback from the abnormal traffic discriminator and iteratively generates samples for detection by the abnormal traffic discriminator; the trained traffic feature sample generator again inputs the abnormal traffic feature samples in the traffic features extracted from the samples in the data packet sample library and the traffic feature value noise generated by the noise generator to generate new abnormal traffic feature samples, and then inputs the new abnormal traffic feature samples into the abnormal traffic sample data packet generator; the abnormal traffic sample data packet generator generates abnormal network traffic data packet samples according to the statistical value distribution of the new abnormal traffic feature samples.
7. The system of claim 1, It is characterized in that The traffic feature sample generator uses a Concatenate layer to connect feature vectors, uses two Linear layers for nonlinear transformation, uses a Sigmoid function in the activation layer, and finally outputs a 23-dimensional new abnormal traffic feature sample.
8. The system of claim 1, It is characterized in that The abnormal traffic discriminator is a Patator attack malicious traffic detection algorithm model based on random forest, which can output a test parameter, and the test parameter is a floating point number between 0 and 1. When the absolute value of the difference between the output detection parameter and 1 is less than a preset threshold, the training is completed.
9. The system according to claim 6, It is characterized in that The abnormal traffic data packet sample generator is specifically used to generate abnormal network traffic data packet samples that meet the statistical value characteristics by using random numbers based on the statistical value distribution.
10. A method for generating network data packet samples based on a generative adversarial network implemented by the system as described in any one of claims 1 to 9.
