A method and system for detecting encryption adversarial attacks based on incremental learning

Through the use of incremental learning and data enhancement technology in encrypted flow categories, the problem of data imbalance and difficulty in model update have been solved, and efficient and accurate encrypted confrontation detection is achieved.

CN118972104BActive Publication Date: 2025-01-28CHINA ACADEMY OF INFORMATION & COMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410979108.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2025-01-28
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

The existing encrypted traffic classification methods face the problems of data imbalance and difficulty in model update, resulting in reduced recognition ability of malicious traffic and low model update efficiency.

Method used

Adopt an incremental learning method, extract the characteristics of encrypted traffic through CicflowMeter, and use the VAE and GAN models to enhance data to generate diverse training samples. Then, use the adaptive learning rate and adaptive threshold to build the original model retention set and new sample retention set, and gradually update the SVM model to adapt to new encrypted flows.

Benefits of technology

This method can alleviate the problem of data scarcity and imbalance, improve the adaptability and robustness of the model, so that it can quickly update and adapt to new encrypted traffic in a dynamic network environment, improve the accuracy and efficiency of encrypted confrontation detection detection Essence

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972104B_ABST
    Figure CN118972104B_ABST
Patent Text Reader

Abstract

The present invention proposes an encryption adversarial attack detection method and system based on incremental learning. The method includes: extracting encrypted traffic feature data; performing data enhancement on the encrypted traffic features based on the VAE model and the GAN model to obtain the original training set; using the original training set to perform initial training on the SVM to obtain the initial training SVM; constructing the original model retention set and the newly added sample retention set through incremental samples; using the original model retention set and the newly added sample retention set to train the initial training SVM to obtain the incremental training SVM; using the incremental training SVM to perform encryption adversarial attack detection, and repeating the previous step. The scheme proposed in the present invention can generate diversified training samples through data enhancement technology, alleviating the problems of data scarcity and data imbalance. The incremental learning strategy is adopted so that the model can be quickly updated when new encrypted traffic appears, without the need to retrain the entire model, thereby improving classification efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of Internet and artificial intelligence, and in particular relates to an encryption adversarial attack detection method and system based on incremental learning. Background Art

[0002] With the rapid development and popularization of Internet technology, the types and amount of network traffic have exploded. In particular, the widespread use of encrypted traffic has brought unprecedented challenges to the field of network security. Encrypted traffic protects user privacy and data security through encryption protocols, which makes traditional plaintext-based traffic classification methods (such as deep packet inspection) increasingly inapplicable. At the same time, encrypted traffic also provides cover for malicious actors, increasing the difficulty of detecting and classifying malicious traffic. The privacy protection characteristics of encrypted traffic have brought new challenges to network security and traffic management.

[0003] Existing encrypted traffic classification methods mainly rely on statistical features and machine learning algorithms, and classification is achieved by analyzing the traffic characteristics of encrypted traffic, such as packet size, packet time interval, traffic direction, etc. However, with the continuous development of encryption technology, traditional classification methods based on static features have gradually become ineffective and cannot adapt to the dynamically changing network environment.

[0004] Existing technology and its shortcomings

[0005] At present, traditional encrypted traffic classification methods mainly rely on feature extraction and machine learning techniques. These methods identify the type of encrypted traffic by analyzing the statistical characteristics and behavior patterns of the traffic. However, with the continuous advancement of encryption technology and the increasing complexity of malicious traffic, traditional methods face the following major problems:

[0006] Data imbalance: In actual network environments, the ratio of normal traffic to malicious traffic is seriously unbalanced. Normal traffic usually accounts for the vast majority, while malicious traffic accounts for only a small part. This data imbalance problem will affect the performance of the classifier, reducing its ability to identify the minority class (i.e. malicious traffic).

[0007] Difficulty in model updating: As time goes by and the network environment changes, new types of encrypted traffic continue to emerge, and existing classification models need to be constantly updated to maintain their effectiveness. However, traditional batch learning methods require retraining the entire model, which is time-consuming and consumes huge computing resources. Summary of the invention

[0008] In order to solve the above technical problems, the present invention proposes a technical solution of an encryption adversarial attack detection method based on incremental learning to solve the above technical problems.

[0009] The first aspect of the present invention discloses an encryption adversarial attack detection method based on incremental learning, the method comprising:

[0010] Step S1, using CICFlowMeter to extract encrypted traffic feature data; based on the VAE model and the GAN model, data enhancement is performed on the encrypted traffic feature to obtain the original training set;

[0011] Step S2, using the original training set to perform initial training on the SVM to obtain an initial training SVM;

[0012] Step S3, constructing an original model retention set and a newly added sample retention set through incremental samples; using the original model retention set and the newly added sample retention set to train the initial training SVM to obtain an incremental training SVM;

[0013] Step S4: Apply the incremental training SVM to perform encryption adversarial attack detection, and repeat step S3.

[0014] According to the method of the first aspect of the present invention, in step S1, the encrypted traffic characteristic data includes:

[0015] Packet length characteristics, packet quantity characteristics, packet time characteristics, flag bit characteristics, congestion window characteristics, flow duration and download-upload ratio characteristics.

[0016] According to the method of the first aspect of the present invention, in step S1, data enhancement is performed on the encrypted traffic features based on the VAE model and the GAN model to obtain the original training set including:

[0017] Using the encrypted traffic feature data to train a VAE model;

[0018] Use the trained VAE model to sample from the latent space and generate fake encrypted traffic data through the decoder;

[0019] Using the forged encrypted traffic data and encrypted traffic feature data to train the GAN model;

[0020] The trained VAE and GAN models are combined to perform data enhancement on the encrypted traffic features to obtain the original training set.

[0021] According to the method of the first aspect of the present invention, in step S3, constructing the original model retention set through incremental samples includes:

[0022] Calculate the adaptive learning rate based on the classification accuracy;

[0023] Calculating an adaptive threshold of the original model retention set according to the adaptive learning rate;

[0024] When samples that do not meet the KKT condition appear in the incremental samples, the original model retention set is constructed according to the adaptive threshold of the original model retention set.

[0025] According to the method of the first aspect of the present invention, in step S3, calculating the adaptive learning rate by classification accuracy includes:

[0026] If the current classification accuracy is higher than the previous classification accuracy, increase the learning rate, that is ;

[0027] If the classification accuracy of this time is lower than that of the previous classification, reduce the learning rate, that is, ;

[0028] in, is the learning rate for this time; is the last learning rate; is the first preset parameter, and ; is the second preset parameter, and .

[0029] According to the method of the first aspect of the present invention, in step S3, calculating the adaptive threshold of the original model retention set according to the adaptive learning rate includes:

[0030]

[0031] in, Adaptive threshold for the retained set of the original model; is the learning rate for this time; is the value of the geometric distance of the samples from the original training set to the hyperplane at the 1 / 3 position, is the minimum distance between the positive sample in the original training set and the hyperplane set, is the value of the geometric distance between the negative sample and the hyperplane in the original training set at the 2 / 3 position, It is the maximum value of the distance between the negative samples in the original training set and the hyperplane set.

[0032] According to the method of the first aspect of the present invention, in step S3, constructing the original model retention set according to the adaptive threshold of the original model retention set includes:

[0033] The samples whose geometric distance from the hyperplane is less than or equal to the adaptive threshold of the original model retention set are retained from the non-support vectors of the original model, and added to the original model retention set to construct the original model retention set; the original model is the initial training SVM.

[0034] A second aspect of the present invention discloses an encryption adversarial attack detection system based on incremental learning, the system comprising:

[0035] The first processing module is configured to extract encrypted traffic feature data using CICFlowMeter; perform data enhancement on the encrypted traffic feature based on the VAE model and the GAN model to obtain an original training set;

[0036] The second processing module is configured to perform initial training on the SVM using the original training set to obtain an initial training SVM;

[0037] The third processing module is configured to construct an original model retention set and a newly added sample retention set through incremental samples; use the original model retention set and the newly added sample retention set to train the initial training SVM to obtain an incremental training SVM;

[0038] The fourth processing module is configured to apply the incremental training SVM to perform encryption adversarial attack detection and repeat the third processing module.

[0039] The third aspect of the present invention discloses an electronic device. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in any one of the encryption counterattack detection methods based on incremental learning in the first aspect of the present disclosure are implemented.

[0040] The fourth aspect of the present invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any one of the encryption adversarial attack detection methods based on incremental learning in the first aspect of the present disclosure are implemented.

[0041] In summary, the scheme proposed in the present invention can generate diversified training samples through data enhancement technology, alleviating the problems of data scarcity and data imbalance. At the same time, the incremental learning strategy is adopted, so that the model can be quickly updated when new encrypted traffic appears, without the need to retrain the entire model, thereby improving the classification efficiency and accuracy. It is of great significance to ensure network security. This method can not only improve the accuracy of classification, but also maintain high adaptability and robustness in a dynamically changing network environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A flowchart of an encryption adversarial attack detection method based on incremental learning according to an embodiment of the present invention;

[0044] Figure 2 A structural diagram of an encryption adversarial attack detection system based on incremental learning according to an embodiment of the present invention;

[0045] Figure 3 The figure is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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, not all of 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.

[0047] The first aspect of the present invention discloses an encryption adversarial attack detection method based on incremental learning. Figure 1 FIG. 1 is a flow chart of an encryption adversarial attack detection method based on incremental learning according to an embodiment of the present invention. Figure 1 As shown, the method includes:

[0048] Step S1, using CICFlowMeter to extract encrypted traffic feature data; based on the VAE model and the GAN model, data enhancement is performed on the encrypted traffic feature to obtain the original training set;

[0049] Step S2, using the original training set to perform initial training on the SVM to obtain an initial training SVM;

[0050] Step S3, constructing an original model retention set and a newly added sample retention set through incremental samples; using the original model retention set and the newly added sample retention set to train the initial training SVM to obtain an incremental training SVM;

[0051] Step S4: Apply the incremental training SVM to perform encryption adversarial attack detection, and repeat step S3.

[0052] In step S1, CICFlowMeter is used to extract encrypted traffic feature data; the encrypted traffic feature data is enhanced based on the VAE model and the GAN model to obtain the original training set.

[0053] In some embodiments, in step S1, the encrypted traffic characteristic data includes:

[0054] Packet length characteristics, packet quantity characteristics, packet time characteristics, flag bit characteristics, congestion window characteristics, flow duration and download-upload ratio characteristics.

[0055] The encrypted traffic features are enhanced based on the VAE model and the GAN model, and the original training set obtained includes:

[0056] Use the encrypted traffic feature data to train the VAE model so that it learns the feature distribution of the encrypted traffic data to achieve a feature enhancement effect;

[0057] Use the trained VAE model to sample from the latent space and generate fake encrypted traffic data through the decoder;

[0058] The forged encrypted traffic data and encrypted traffic feature data are used to train the GAN model; the generator is responsible for generating data samples from random noise or latent space, and the discriminator distinguishes between real samples and generated samples;

[0059] The trained VAE and GAN models are combined to perform data enhancement on the encrypted traffic features to obtain the original training set.

[0060] VAE is used to learn the latent distribution of data and generate new samples from the latent space. These generated samples are used to enhance the original dataset as part of training GAN. The generator in GAN is responsible for generating realistic data, while the discriminator evaluates the authenticity of the data generated by the generator.

[0061] Specifically, encrypted traffic detection uses flows as detection objects and extracts features for each one. CICFlowMeter is used to extract 74-dimensional encrypted traffic features, as shown in Table 1.

[0062] Table 1

[0063]

[0064] Use VAE for feature enhancement and GAN network for data enhancement. Both variational autoencoders (VAE) and generative adversarial networks (GAN) are powerful tools for generating models. But they have different concepts and structures. VAE aims to learn the potential distribution of data through encoders and decoders and generate samples similar to the original data. It focuses on learning the probability distribution of data and trains the model by maximizing the similarity between generated data and real data. GAN directly improves the fidelity of generated samples through adversarial training. The generated samples are more visually realistic, but the training process is more complicated. The combination of the two can generate higher quality samples while ensuring the characteristics of the data.

[0065] The advantage of VAE is that it can preserve data distribution very well. Similarly, the data generated by VAE can effectively preserve the characteristics of data continuity.

[0066] As a generative model, VAE includes four stages: data sampling, encoding, parameterized training, and decoding. In the sampling stage, real samples are randomly sampled from the original data set, and these samples will be used as training data for VAE. In the encoding stage, the encoder maps the real samples to distribution parameters (mean and variance) in the latent space. In the reparameterization stage, a latent vector is generated by sampling random noise from a normal distribution and reparameterizing it using the mean and variance output by the encoder. In the decoding stage, the decoder maps the latent vector back to the data space to generate fake samples similar to the original data. After training is completed, the decoder can generate fake samples similar to the original data by sampling random vectors from the latent space. These fake samples can be used together with the original data to enhance the dataset.

[0067] The formula of the GAN network is expressed as: GAN = (G, D) where G represents the generator and D represents the discriminator. The generator is a neural network that generates fake data to train the discriminator. The generator generates samples using a noise vector of random length. If the input is a set of one-dimensional features, the generator learns the distribution of the entire set of features instead of learning each feature separately. The generator maps the input feature vector to an output data sample that conforms to the distribution of the real data. The main goal of the generator in the present invention is to produce realistic encrypted traffic samples that are sufficiently similar to the original samples. The discriminator is a neural network that is used to distinguish between real data and fake data generated by the generator. The discriminator is trained using data from two different sources. Real encrypted traffic data samples are used as positive samples during training, and the generator's fake samples are used as negative samples. The generator G transmits the output samples it generates to the discriminator D for training. The discriminator in the present invention distinguishes between real encrypted traffic samples from the data set and synthetic encrypted traffic samples created by the generator. The goal of the generator is to minimize the output of the discriminator, while the goal of the discriminator is to maximize it. The following describes the basic structure of the GAN network. GAN can be used to perform data augmentation on datasets containing one-dimensional feature data. For example, the CICFlowMeter tool extracts encrypted traffic features. First, the neural network structure and parameters of the generator and discriminator are designed and initialized. The generator is responsible for generating fake samples and can generate one-dimensional data from noise vectors. This is achieved using 1D convolutional layers. The discriminator is responsible for distinguishing between true and false samples, and is also implemented using 1D convolutional layers. Next, the generator G samples from the noise distribution to generate encrypted traffic fake samples that are similar to the distribution of real data. The noise is a vector sampled from the normal distribution of malicious samples. Then, real samples are sampled from the real dataset and input into the discriminator D together with the generated fake samples. The discriminator D classifies the input samples, calculates the classification loss of real samples and fake samples, and updates the parameters of the discriminator D so that it can distinguish between real and fake samples more accurately. Then, using the fake samples generated by the generator G as input, the discriminator D classifies them and calculates the loss of the generator G, that is, the probability that the fake samples are judged as real samples. The parameters of the generator G are updated to enable the generator to generate more realistic fake samples, thereby deceiving the discriminator D. Training is performed alternately between the discriminator D and the generator G. Through multiple iterations, the samples generated by the generator G will become more and more realistic, and the classification ability of the discriminator D will continue to improve. During the training process, the generator G continuously generates new fake samples. These fake samples together with real samples form an enhanced dataset, which increases the diversity of the data, alleviates the problems of data scarcity and data imbalance, and thus improves the model performance of downstream tasks.

[0068] By combining VAE and GAN, not only the feature importance of data-generated samples is guaranteed, but also the quality of generated samples is guaranteed.

[0069] In step S2, the original training set is used to perform initial training on the SVM to obtain an initial training SVM.

[0070] Specifically, the original training set is the data set used when initially training the SVM model, which contains all previously processed samples.

[0071] Incremental samples are new data sets that continue to arrive after model training, and include new samples received after model training.

[0072] The newly added samples are a subset of the new samples that have just arrived in each training batch and are selected to be included in the model training. They are selected based on the current screening threshold and the distribution of incremental samples.

[0073] Determine the incremental learning tasks, that is, divide the newly added samples into different training batches, and gradually input some encrypted traffic samples for training, where the number of incremental tasks is the number of total categories.

[0074] Use SGDClassifier to initially train the SVM and evaluate its performance to obtain the initially trained SVM.

[0075] In step S3, an original model retention set and a newly added sample retention set are constructed by using incremental samples; the original model retention set and the newly added sample retention set are used to train the initial training SVM to obtain an incremental training SVM.

[0076] When performing incremental learning of adaptive SVM, on the one hand, the original model retention set needs to be constructed, and on the other hand, the retention set of newly added samples needs to be constructed. In the previous adaptive SVM incremental learning algorithm, the algorithm mainly uses the similarity of the spatial distribution of incremental samples and newly added samples as the adjustment coefficient, sets different screening thresholds for the original training set and incremental sample set, and determines the boundary vector based on the geometric distance from the sample to the hyperplane. Assuming the sample set , then the sample point To the hyperplane The geometric distance The definition is as follows:

[0077]

[0078] in, It is The feature vector of the samples, It is The labels of samples, is the normal vector of the hyperplane and b is the intercept of the hyperplane.

[0079] When building the original model holdout set, the previous The stability of the classifier is mainly maintained based on the similarity of feature space distribution. Now consider adjusting the learning rate based on the historical information of the previous model to optimize the convergence and stability of the training process.

[0080] In some embodiments, in step S3, constructing the original model retention set through incremental samples includes:

[0081] Calculate the adaptive learning rate based on the classification accuracy;

[0082] Calculating an adaptive threshold of the original model retention set according to the adaptive learning rate;

[0083] When samples that do not meet the KKT condition appear in the incremental samples, the original model retention set is constructed according to the adaptive threshold of the original model retention set.

[0084] Calculating the adaptive learning rate by classification accuracy includes:

[0085] If the current classification accuracy is higher than the previous classification accuracy, increase the learning rate, that is ;

[0086] If the classification accuracy of this time is lower than that of the previous classification, reduce the learning rate, that is, ;

[0087] in, is the learning rate for this time; is the last learning rate; is the first preset parameter, and ; is the second preset parameter, and .

[0088] Calculating the adaptive threshold of the original model retention set according to the adaptive learning rate includes:

[0089]

[0090] in, Adaptive threshold for the retained set of the original model; is the learning rate for this time; is the value of the geometric distance of the samples from the original training set to the hyperplane at the 1 / 3 position, is the minimum distance between the positive sample in the original training set and the hyperplane set, is the value of the geometric distance between the negative sample and the hyperplane in the original training set at the 2 / 3 position, It is the maximum value of the distance between the negative samples in the original training set and the hyperplane set.

[0091] The constructing the original model retention set according to the adaptive threshold of the original model retention set comprises:

[0092] The samples whose geometric distance from the hyperplane is less than or equal to the adaptive threshold of the original model retention set are retained from the non-support vectors of the original model, and added to the original model retention set to construct the original model retention set; therefore, the better the last classification effect, the more samples will be retained from the original model. The original model is the initial training SVM.

[0093] Specifically, incremental learning strategy: The incremental learning strategy enables the model to quickly update and adapt when new attack forms appear, without the need to retrain the entire model. This strategy can effectively improve the real-time and adaptability of the model and keep the model updated synchronously with malicious behaviors.

[0094] Adaptability: The model has good adaptability and can be dynamically adjusted and optimized according to different network environments and attack scenarios. By monitoring network traffic and attack behaviors in real time, the model can adjust parameters and update rules in a timely manner to maintain efficient attack detection performance.

[0095] The self-adaptive incremental support vector machine (SD-ISVM) algorithm is used to adjust the learning rate based on the historical information of the previous model, with the similarity of the spatial distribution of incremental samples and newly added samples as the adjustment coefficient to optimize the convergence and stability of the training process. Different screening thresholds are set for the original training set and the incremental sample set. In each training batch, the algorithm dynamically adjusts the screening threshold by comparing the distribution of newly added samples with the original training set to ensure that the model can effectively absorb new information. The boundary vector is also determined based on the geometric distance from the sample to the hyperplane to better describe the distribution characteristics of the data and further improve the adaptability and generalization ability of the model.

[0096] Use the partial_fit method of SGDClassifier to incrementally update the model.

[0097] After each incremental update, the updated model performance is evaluated.

[0098] Based on the evaluation results, model parameters such as learning rate and regularization parameters are dynamically adjusted to improve adaptability. The purpose of adjusting parameters is to ensure that the model can better adapt to changes in new data while maintaining stable performance.

[0099] When constructing the new sample retention set, we still retain the original construction method. Considering that the new samples are participating in SVM training for the first time, compared with the construction of the original model sample retention set, the construction of the new sample retention set uses the average of the difference between the samples in the set close to the hyperplane 3 / 4 and the samples in the corresponding set closest to the hyperplane to calculate When there are samples that do not meet the KKT condition in the incremental samples, the samples that meet the KKT condition and whose hyperplane geometric distance is less than or equal to the threshold are retained in the incremental sample set. That is, the more samples that meet the KKT condition in the incremental samples, the fewer samples need to be retained. When the number of samples that meet the KKT condition is small, it means that the new model classification hyperplane deflection is larger, and more samples are retained.

[0100] In step S4, the incremental training SVM is applied to perform encryption adversarial attack detection, and step S3 is repeated.

[0101] Specifically, by continuously receiving new data and repeating the process of preprocessing, incremental updating, performance evaluation, and parameter adjustment, the model is ensured to remain efficient and accurate in a dynamic environment, effectively cope with the classification tasks of encrypted traffic scenarios in a dynamic data environment, and always maintain optimal performance.

[0102] By introducing the adaptive learning rate, the accuracy and efficiency of the adaptive SVM incremental learning algorithm are improved, and the sample redundancy and the loss of classification knowledge are effectively reduced, thereby improving the performance and training speed of the classifier.

[0103] In summary, the scheme proposed in the present invention can generate diversified training samples through data enhancement technology, alleviating the problems of data scarcity and data imbalance. At the same time, the incremental learning strategy is adopted, so that the model can be quickly updated when new encrypted traffic appears, without the need to retrain the entire model, thereby improving the classification efficiency and accuracy. It is of great significance to ensure network security. This method can not only improve the accuracy of classification, but also maintain high adaptability and robustness in a dynamically changing network environment.

[0104] The second aspect of the present invention discloses an encryption adversarial attack detection system based on incremental learning. Figure 2 is a structural diagram of an encryption anti-attack detection system based on incremental learning according to an embodiment of the present invention; Figure 2 As shown, the system comprises:

[0105] The first processing module 101 is configured to extract encrypted traffic feature data using CICFlowMeter; perform data enhancement on the encrypted traffic feature based on the VAE model and the GAN model to obtain an original training set;

[0106] The second processing module 102 is configured to perform initial training on the SVM using the original training set to obtain an initial training SVM;

[0107] The third processing module 103 is configured to construct an original model retention set and a newly added sample retention set through incremental samples; use the original model retention set and the newly added sample retention set to train the initial training SVM to obtain an incremental training SVM;

[0108] The fourth processing module 104 is configured to apply the incremental training SVM to perform encryption adversarial attack detection and repeat the third processing module 103.

[0109] According to the system of the second aspect of the present invention, the first processing module 101 is specifically configured as follows: the encrypted traffic feature data includes:

[0110] Packet length characteristics, packet quantity characteristics, packet time characteristics, flag bit characteristics, congestion window characteristics, flow duration and download-upload ratio characteristics.

[0111] The encrypted traffic features are enhanced based on the VAE model and the GAN model, and the original training set obtained includes:

[0112] Use the encrypted traffic feature data to train the VAE model so that it learns the feature distribution of the encrypted traffic data to achieve a feature enhancement effect;

[0113] Use the trained VAE model to sample from the latent space and generate fake encrypted traffic data through the decoder;

[0114] The forged encrypted traffic data and encrypted traffic feature data are used to train the GAN model; the generator is responsible for generating data samples from random noise or latent space, and the discriminator distinguishes between real samples and generated samples;

[0115] The trained VAE and GAN models are combined to perform data enhancement on the encrypted traffic features to obtain the original training set.

[0116] VAE is used to learn the latent distribution of data and generate new samples from the latent space. These generated samples are used to enhance the original dataset as part of training GAN. The generator in GAN is responsible for generating realistic data, while the discriminator evaluates the authenticity of the data generated by the generator.

[0117] Specifically, encrypted traffic detection uses flows as detection objects and extracts features for each one. CICFlowMeter is used to extract 74-dimensional encrypted traffic features, as shown in Table 1.

[0118] Use VAE for feature enhancement and GAN network for data enhancement. Both variational autoencoders (VAE) and generative adversarial networks (GAN) are powerful tools for generating models. But they have different concepts and structures. VAE aims to learn the potential distribution of data through encoders and decoders and generate samples similar to the original data. It focuses on learning the probability distribution of data and trains the model by maximizing the similarity between generated data and real data. GAN directly improves the fidelity of generated samples through adversarial training. The generated samples are more visually realistic, but the training process is more complicated. The combination of the two can generate higher quality samples while ensuring the characteristics of the data.

[0119] The advantage of VAE is that it can preserve data distribution very well. Similarly, the data generated by VAE can effectively preserve the characteristics of data continuity.

[0120] As a generative model, VAE includes four stages: data sampling, encoding, parameterized training, and decoding. In the sampling stage, real samples are randomly sampled from the original data set, and these samples will be used as training data for VAE. In the encoding stage, the encoder maps the real samples to distribution parameters (mean and variance) in the latent space. In the reparameterization stage, a latent vector is generated by sampling random noise from a normal distribution and reparameterizing it using the mean and variance output by the encoder. In the decoding stage, the decoder maps the latent vector back to the data space to generate fake samples similar to the original data. After training is completed, the decoder can generate fake samples similar to the original data by sampling random vectors from the latent space. These fake samples can be used together with the original data to enhance the dataset.

[0121] The formula of the GAN network is expressed as: GAN = (G, D) where G represents the generator and D represents the discriminator. The generator is a neural network that generates fake data to train the discriminator. The generator generates samples using a noise vector of random length. If the input is a set of one-dimensional features, the generator learns the distribution of the entire set of features instead of learning each feature separately. The generator maps the input feature vector to an output data sample that conforms to the distribution of the real data. The main goal of the generator in the present invention is to produce realistic encrypted traffic samples that are sufficiently similar to the original samples. The discriminator is a neural network that is used to distinguish between real data and fake data generated by the generator. The discriminator is trained using data from two different sources. Real encrypted traffic data samples are used as positive samples during training, and the generator's fake samples are used as negative samples. The generator G transmits the output samples it generates to the discriminator D for training. The discriminator in the present invention distinguishes between real encrypted traffic samples from the data set and synthetic encrypted traffic samples created by the generator. The goal of the generator is to minimize the output of the discriminator, while the goal of the discriminator is to maximize it. The following describes the basic structure of the GAN network. GAN can be used to perform data augmentation on datasets containing one-dimensional feature data. For example, the CICFlowMeter tool extracts encrypted traffic features. First, the neural network structure and parameters of the generator and discriminator are designed and initialized. The generator is responsible for generating fake samples and can generate one-dimensional data from noise vectors. This is achieved using 1D convolutional layers. The discriminator is responsible for distinguishing between true and false samples, and is also implemented using 1D convolutional layers. Next, the generator G samples from the noise distribution to generate encrypted traffic fake samples that are similar to the distribution of real data. The noise is a vector sampled from the normal distribution of malicious samples. Then, real samples are sampled from the real dataset and input into the discriminator D together with the generated fake samples. The discriminator D classifies the input samples, calculates the classification loss of real samples and fake samples, and updates the parameters of the discriminator D so that it can distinguish between real and fake samples more accurately. Then, using the fake samples generated by the generator G as input, the discriminator D classifies them and calculates the loss of the generator G, that is, the probability that the fake samples are judged as real samples. The parameters of the generator G are updated to enable the generator to generate more realistic fake samples, thereby deceiving the discriminator D. Training is performed alternately between the discriminator D and the generator G. Through multiple iterations, the samples generated by the generator G will become more and more realistic, and the classification ability of the discriminator D will continue to improve. During the training process, the generator G continuously generates new fake samples. These fake samples together with real samples form an enhanced dataset, which increases the diversity of the data, alleviates the problems of data scarcity and data imbalance, and thus improves the model performance of downstream tasks.

[0122] By combining VAE and GAN, not only the feature importance of data-generated samples is guaranteed, but also the quality of generated samples is guaranteed.

[0123] According to the system of the second aspect of the present invention, the second processing module 102 is specifically configured as follows: the original training set is a data set used when initially training the SVM model, and includes all previously processed samples.

[0124] Incremental samples are new data sets that continue to arrive after model training, and include new samples received after model training.

[0125] The newly added samples are a subset of the new samples that have just arrived in each training batch and are selected to be included in the model training. They are selected based on the current screening threshold and the distribution of incremental samples.

[0126] Determine the incremental learning tasks, that is, divide the newly added samples into different training batches, and gradually input some encrypted traffic samples for training, where the number of incremental tasks is the number of total categories.

[0127] Use SGDClassifier to initially train the SVM and evaluate its performance to obtain the initially trained SVM.

[0128] According to the system of the second aspect of the present invention, the third processing module 103 is specifically configured to, when performing incremental learning of the adaptive SVM, construct the original model retention set on the one hand, and construct the retention set of the newly added samples on the other hand. In the previous adaptive SVM incremental learning algorithm, the algorithm mainly uses the similarity of the spatial distribution of the incremental samples and the newly added samples as the adjustment coefficient, sets different screening thresholds for the original training set and the incremental sample set, and determines the boundary vector based on the geometric distance from the sample to the hyperplane. Assuming that the sample set , then the sample point To the hyperplane The geometric distance The definition is as follows:

[0129]

[0130] in, It is The feature vector of the samples, It is The labels of samples, is the normal vector of the hyperplane and b is the intercept of the hyperplane.

[0131] When building the original model holdout set, the previous The stability of the classifier is mainly maintained based on the similarity of feature space distribution. Now consider adjusting the learning rate based on the historical information of the previous model to optimize the convergence and stability of the training process.

[0132] In some embodiments, constructing the original model retention set through incremental samples includes:

[0133] Calculate the adaptive learning rate based on the classification accuracy;

[0134] Calculating an adaptive threshold of the original model retention set according to the adaptive learning rate;

[0135] When samples that do not meet the KKT condition appear in the incremental samples, the original model retention set is constructed according to the adaptive threshold of the original model retention set.

[0136] Calculating the adaptive learning rate by classification accuracy includes:

[0137] If the current classification accuracy is higher than the previous classification accuracy, increase the learning rate, that is ;

[0138] If the classification accuracy of this time is lower than that of the previous classification, reduce the learning rate, that is, ;

[0139] in, is the learning rate for this time; is the last learning rate; is the first preset parameter, and ; is the second preset parameter, and .

[0140] Calculating the adaptive threshold of the original model retention set according to the adaptive learning rate includes:

[0141]

[0142] in, Adaptive threshold for the retained set of the original model; is the learning rate for this time; is the value of the geometric distance of the samples from the original training set to the hyperplane at the 1 / 3 position, is the minimum distance between the positive sample in the original training set and the hyperplane set, is the value of the geometric distance between the negative sample and the hyperplane in the original training set at the 2 / 3 position, It is the maximum value of the distance between the negative samples in the original training set and the hyperplane set.

[0143] The constructing the original model retention set according to the adaptive threshold of the original model retention set comprises:

[0144] The samples whose geometric distance from the hyperplane is less than or equal to the adaptive threshold of the original model retention set are retained from the non-support vectors of the original model, and added to the original model retention set to construct the original model retention set; therefore, the better the last classification effect, the more samples will be retained from the original model. The original model is the initial training SVM.

[0145] Specifically, incremental learning strategy: The incremental learning strategy enables the model to quickly update and adapt when new attack forms appear, without the need to retrain the entire model. This strategy can effectively improve the real-time and adaptability of the model and keep the model updated synchronously with malicious behaviors.

[0146] Adaptability: The model has good adaptability and can be dynamically adjusted and optimized according to different network environments and attack scenarios. By monitoring network traffic and attack behaviors in real time, the model can adjust parameters and update rules in a timely manner to maintain efficient attack detection performance.

[0147] The self-adaptive incremental support vector machine (SD-ISVM) algorithm is used to adjust the learning rate based on the historical information of the previous model, with the similarity of the spatial distribution of incremental samples and newly added samples as the adjustment coefficient to optimize the convergence and stability of the training process. Different screening thresholds are set for the original training set and the incremental sample set. In each training batch, the algorithm dynamically adjusts the screening threshold by comparing the distribution of newly added samples with the original training set to ensure that the model can effectively absorb new information. The boundary vector is also determined based on the geometric distance from the sample to the hyperplane to better describe the distribution characteristics of the data and further improve the adaptability and generalization ability of the model.

[0148] Use the partial_fit method of SGDClassifier to incrementally update the model.

[0149] After each incremental update, the updated model performance is evaluated.

[0150] Based on the evaluation results, model parameters such as learning rate and regularization parameters are dynamically adjusted to improve adaptability. The purpose of adjusting parameters is to ensure that the model can better adapt to changes in new data while maintaining stable performance.

[0151] When constructing the new sample retention set, we still retain the original construction method. Considering that the new samples are participating in SVM training for the first time, compared with the construction of the original model sample retention set, the construction of the new sample retention set uses the average of the difference between the samples in the set close to the hyperplane 3 / 4 and the samples in the corresponding set closest to the hyperplane to calculate When there are samples that do not meet the KKT condition in the incremental samples, the samples that meet the KKT condition and whose hyperplane geometric distance is less than or equal to the threshold are retained in the incremental sample set. That is, the more samples that meet the KKT condition in the incremental samples, the fewer samples need to be retained. When the number of samples that meet the KKT condition is small, it means that the new model classification hyperplane deflection is larger, and more samples are retained.

[0152] According to the system of the second aspect of the present invention, the fourth processing module 104 is specifically configured to ensure that the model remains efficient and accurate in a dynamic environment by continuously receiving new data and repeating the processes of preprocessing, incremental updating, performance evaluation, and parameter adjustment, effectively responding to classification tasks in encrypted traffic scenarios in dynamic data environments, and always maintaining optimal performance.

[0153] By introducing the adaptive learning rate, the accuracy and efficiency of the adaptive SVM incremental learning algorithm are improved, and the sample redundancy and the loss of classification knowledge are effectively reduced, thereby improving the performance and training speed of the classifier.

[0154] The third aspect of the present invention discloses an electronic device. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any one of the encryption counterattack detection methods based on incremental learning in the first aspect of the present invention are implemented.

[0155] Figure 3 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 3 As shown, the electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0156] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a structural diagram of the part related to the technical solution of the present disclosure, and does not constitute a limitation on the electronic device to which the technical solution of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0157] The fourth aspect of the present invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any one of the steps in the encryption counterattack detection method based on incremental learning disclosed in the first aspect of the present invention are implemented.

[0158] Please note that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. The above embodiments only express several implementation methods of the present application, and their descriptions are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present application, several variations and improvements can be made, which all belong to the scope of protection of the present application. Therefore, the scope of protection of the patent in this application shall be based on the attached claims.

Claims

1. A method for detecting encryption adversarial attacks based on incremental learning, characterized in that: The method comprises: Step S1, using CICFlowMeter to extract encrypted traffic feature data; based on the VAE model and the GAN model, data enhancement is performed on the encrypted traffic feature to obtain the original training set; Step S2, using the original training set to perform initial training on the SVM to obtain an initial training SVM; Step S3, constructing an original model retention set and a newly added sample retention set through incremental samples; using the original model retention set and the newly added sample retention set to train the initial training SVM to obtain an incremental training SVM; The incremental samples are new data sets that continue to arrive after model training, including new samples received after model training; the newly added samples are a subset of new samples that arrive in each training batch and are selected to be added to the model training. The incremental learning tasks are determined based on the current screening threshold and the distribution of the incremental samples. The newly added samples are divided into different training batches, and some encrypted traffic samples are gradually input for training, where the number of incremental tasks is the number of total categories; The construction of the newly added sample retention set is calculated by using the average of the difference between the samples in the set close to the hyperplane 3 / 4 and the samples in the corresponding set closest to the hyperplane ; When there are samples that do not meet the KKT condition in the incremental samples, the incremental samples that meet the KKT condition and whose hyperplane geometric distance is less than or equal to the threshold are retained The more samples that meet the KKT condition in the incremental samples, the fewer samples need to be retained. When the number of samples that meet the KKT condition is small, the larger the deflection of the new model classification hyperplane is, the more samples are retained. Step S4: Apply the incremental training SVM to perform encryption adversarial attack detection, and repeat step S3.

2. According to claim 1, the encryption counterattack detection method based on incremental learning is characterized in that: In the step S1, the encrypted traffic characteristic data includes: Packet length characteristics, packet quantity characteristics, packet time characteristics, flag bit characteristics, congestion window characteristics, flow duration and download-upload ratio characteristics.

3. The encryption adversarial attack detection method based on incremental learning according to claim 1 is characterized in that: In the step S1, the encrypted traffic features are data enhanced based on the VAE model and the GAN model, and the original training set obtained includes: Using the encrypted traffic feature data to train a VAE model; Use the trained VAE model to sample from the latent space and generate fake encrypted traffic data through the decoder; Using the forged encrypted traffic data and encrypted traffic feature data to train the GAN model; The trained VAE and GAN models are combined to perform data enhancement on the encrypted traffic features to obtain the original training set.

4. The encryption adversarial attack detection method based on incremental learning according to claim 1 is characterized in that: In step S3, constructing the original model retention set through incremental samples includes: Calculate the adaptive learning rate based on the classification accuracy; Calculating an adaptive threshold of the original model retention set according to the adaptive learning rate; When samples that do not meet the KKT condition appear in the incremental samples, the original model retention set is constructed according to the adaptive threshold of the original model retention set.

5. The encryption counterattack detection method based on incremental learning according to claim 4 is characterized in that: In step S3, calculating the adaptive learning rate by classification accuracy includes: If the current classification accuracy is higher than the previous classification accuracy, increase the learning rate, that is ; If the classification accuracy of this time is lower than that of the previous classification, reduce the learning rate, that is, ; in, is the learning rate for this time; is the last learning rate; is the first preset parameter, and ; is the second preset parameter, and .

6. The encryption counterattack detection method based on incremental learning according to claim 4 is characterized in that: In step S3, calculating the adaptive threshold of the original model retention set according to the adaptive learning rate includes: in, Adaptive threshold for the retained set of the original model; is the learning rate for this time; is the value of the geometric distance of the samples from the original training set to the hyperplane at the 1 / 3 position, is the minimum distance between the positive sample in the original training set and the hyperplane set, is the value of the geometric distance between the negative sample and the hyperplane in the original training set at the 2 / 3 position, It is the maximum value of the distance between the negative samples in the original training set and the hyperplane set.

7. The encryption counterattack detection method based on incremental learning according to claim 4 is characterized in that: In the step S3, constructing the original model retention set according to the adaptive threshold of the original model retention set includes: The samples whose geometric distance from the hyperplane is less than or equal to the adaptive threshold of the original model retention set are retained from the non-support vectors of the original model, and added to the original model retention set to construct the original model retention set; the original model is the initial training SVM.

8. A system for detecting encryption adversarial attacks based on incremental learning, characterized in that: The system comprises: The first processing module is configured to extract encrypted traffic feature data using CICFlowMeter; perform data enhancement on the encrypted traffic feature based on the VAE model and the GAN model to obtain an original training set; The second processing module is configured to perform initial training on the SVM using the original training set to obtain an initial training SVM; The third processing module is configured to construct an original model retention set and a newly added sample retention set through incremental samples; use the original model retention set and the newly added sample retention set to train the initial training SVM to obtain an incremental training SVM; The incremental samples are new data sets that continue to arrive after model training, including new samples received after model training; the newly added samples are a subset of new samples that arrive in each training batch and are selected to be added to the model training. The incremental learning tasks are determined based on the current screening threshold and the distribution of the incremental samples. The newly added samples are divided into different training batches, and some encrypted traffic samples are gradually input for training, where the number of incremental tasks is the number of total categories; The construction of the newly added sample retention set is calculated by using the average of the difference between the samples in the set close to the hyperplane 3 / 4 and the samples in the corresponding set closest to the hyperplane ; When there are samples that do not meet the KKT condition in the incremental samples, the incremental samples that meet the KKT condition and whose hyperplane geometric distance is less than or equal to the threshold are retained The more samples that meet the KKT condition in the incremental samples, the fewer samples need to be retained. When the number of samples that meet the KKT condition is small, the larger the deflection of the new model classification hyperplane is, the more samples are retained. The fourth processing module is configured to apply the incremental training SVM to perform encryption adversarial attack detection and repeat the third processing module.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps in the encryption counterattack detection method based on incremental learning described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps in the encryption counterattack detection method based on incremental learning described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • SVM incremental learning method for improving KKT condition based on sample distribution density

    CN113449779A

  • Lightweight generative adversarial network, and encrypted traffic hiding method and device based on network in anonymous network environment

    CN117544353A