Encrypted traffic attack resisting method, electronic equipment, storage medium and product
By adding multiple relationship perturbations to the encrypted traffic, and restoring the original traffic after detecting the model, the problem of generating real adversarial traffic and restoration in the existing technology is solved, and the concealment and controllability of encrypted traffic adversarial attacks is improved.
Patent Information
- Application Number
- CN202510554370.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-04-29
AI Technical Summary
The existing encrypted traffic adversarial attack methods fail to generate real adversarial traffic and fail to consider the restore problem of adversarial traffic after passing through the detection system, resulting in insufficient concealment and controllability.
By adding perturbations with multiple relationships to the encrypted traffic, the first and second adversarial byte sequences are generated, the load information is replaced to generate adversarial traffic, and the original traffic is restored using the multiple relationship after the model is detected, and the deep learning network model is used for training and perturbation generation.
It improves the concealment and controllability of encrypted traffic against attacks, can effectively restore the original traffic after detecting the model, and enhances the concealment and controllability of the attacks.
Smart Images

Figure CN120498624A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer network security, and in particular relates to an encrypted traffic anti-attack method, electronic equipment, storage medium and product. Background Art
[0002] With the rapid development of the internet in recent years, while various software and internet services have brought convenience to our lives, personal privacy and security have also been greatly threatened. Although most internet connections now use encryption, unlike the earlier days of the internet with transparent payloads, traffic payloads are essentially encrypted, making it virtually impossible to obtain personal information through payload analysis.
[0003] The encryption protocol based on TLS / SSL protects and conceals user privacy to a certain extent and ensures the invisibility of data, but it also conceals some of the original characteristics of the data, providing a hiding space for malicious network behavior. Encrypted malicious traffic is difficult to identify, and user privacy and security are still threatened.
[0004] Traffic adversarial attacks attempt to deceive detection models by generating adversarial traffic that resembles normal traffic. Traffic adversarial attacks generally target two areas: the feature space and the byte space. In the feature space, redundant packets are typically inserted into normal traffic to deceive detection systems. In the byte space, perturbations are added to the original bytes of traffic to deceive detection systems.
[0005] Existing adversarial attack methods use customized adversarial perturbations to generate adversarial samples. However, these adversarial samples are only the input form of the detection model, not the real adversarial traffic. They also do not consider whether the original traffic can be restored after the adversarial traffic passes through the detection system. Summary of the Invention
[0006] The purpose of the present invention is to address the deficiencies in the existing technology and provide an encrypted traffic anti-attack method, electronic device, storage medium and product to improve the concealment and controllability of traffic anti-attacks.
[0007] In order to achieve the above object, the technical solution adopted by the present invention is:
[0008] A method for defending against attacks on encrypted traffic, comprising the following steps:
[0009] S1. Obtain encrypted traffic;
[0010] S2. Extract the payload information from the encrypted traffic to obtain a traffic byte sequence;
[0011] S3. Using the traffic byte sequence as input to a deep learning network model, training the deep learning network model to obtain an encrypted traffic detection model;
[0012] S4. Attacking the encrypted traffic detection model using an adversarial attack method, adding a first perturbation and a second perturbation having a multiple relationship to the traffic byte sequence, to obtain a first adversarial byte sequence and a second adversarial byte sequence;
[0013] S5. Replace the payload information in the encrypted traffic with the first antagonistic byte sequence and the second antagonistic byte sequence respectively to obtain the first antagonistic traffic and the second antagonistic traffic.
[0014] This invention addresses the problem of existing methods failing to generate authentic adversarial traffic. Instead, it adds perturbations to the payload field to generate legitimate traffic, maintaining normal transmission capacity. Furthermore, it applies multiplication constraints when generating adversarial perturbations, ensuring that the generated perturbations have a multiplication relationship. This method leverages this multiplication relationship to restore the original traffic after the traffic passes the detection model, improving the stealth and controllability of adversarial attacks.
[0015] Furthermore, the process of S2 includes:
[0016] Segment the encrypted traffic by flow to form multiple traffic samples;
[0017] Extract load information from each traffic sample;
[0018] Convert payload information into a sequence of traffic bytes.
[0019] Furthermore, any one of the DeepPacket model, Datanet model, TrafficCNN model, Resnet18 model, and Densenet121 model is adjusted by changing the input layer to a single channel and the final softmax layer to a two-neuron softmax layer, and then used as a deep learning network model.
[0020] The byte sequence is a single channel. The model is adjusted by changing the input layer to a single channel to make it compatible with byte sequence input, and the final classification operation is changed to binary classification to make it suitable for binary classification.
[0021] Furthermore, when the deep learning network model adopts the adjusted DeepPacket model and Datanet model, the multiple between the first perturbation and the second perturbation is 2, 3, 4, 5...; when the deep learning network model adopts the adjusted TrafficCNN model, Resnet18 model, and Densenet121 model, the multiple between the first perturbation and the second perturbation is 2 or 3.
[0022] Furthermore, the expressions of the first adversarial byte sequence and the second adversarial byte sequence are as follows:
[0023] X ADV =X+e
[0024] X′ ADV =X+e′
[0025] e′=k·e
[0026] Among them, X ADV is the first adversarial byte sequence, X′ ADV is the second adversarial byte sequence, X is the traffic byte sequence, e is the first perturbation, e′ is the second perturbation, k is the multiple between the first and second perturbations, k = 2, 3, 4, 5, etc. Furthermore, the expression of the first perturbation is as follows:
[0027] e=grad·(r / s)·positions
[0028] Among them, grad is the gradient, r is the initial perturbation, s is the number of perturbation steps, and positions is the legal position.
[0029] Furthermore, S6, the traffic byte sequence is restored using the first adversarial byte sequence and the second adversarial byte sequence, the restored traffic byte sequence is converted into payload information, and the encrypted traffic is restored. The expression of the restored traffic byte sequence is as follows:
[0030] X′=(k·X ADV -X′ ADV ) / (k-1)
[0031] Among them, X ADV is the first adversarial byte sequence, X′ ADV is the second adversarial byte sequence, k is the multiple between the first perturbation and the second perturbation, and X′ is the restored traffic byte sequence.
[0032] Based on the same inventive concept, the present invention further provides an electronic device, comprising:
[0033] one or more processors;
[0034] A memory having one or more programs stored thereon, which, when executed by the one or more processors, enables the one or more processors to implement the steps of the method for encrypting traffic to resist attacks.
[0035] Based on the same inventive concept, the present invention also provides a computer-readable storage medium storing a computer program, which implements the steps of the encrypted traffic anti-attack method when executed by a processor.
[0036] Based on the same inventive concept, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the encrypted traffic anti-attack method when executed by a processor.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] The present invention can introduce a multiple relationship of disturbances to solve the problem of original traffic restoration under the premise of generating real adversarial traffic.
[0039] To address the problems of existing methods that fail to generate authentic adversarial traffic and fail to consider restoring the original traffic, the present invention's method for generating adversarial traffic in byte space only adds perturbations to the payload field to generate legitimate traffic, maintaining normal transmission capacity. Furthermore, a multiplication constraint is imposed when generating adversarial perturbations, ensuring that the generated perturbations have a multiplication relationship. This method can use this multiplication relationship to restore the original traffic after the traffic passes the detection model, thereby improving the stealth and controllability of the attack. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of the encrypted traffic countermeasure method of the present invention;
[0041] Figure 2 Schematic diagram of generating adversarial traffic for the adversarial attack of the present invention. DETAILED DESCRIPTION
[0042] The present invention will be described in detail below with reference to the following embodiments. It should be noted that the embodiments and features of the embodiments may be combined unless they conflict. For ease of description, the words "upper," "lower," "left," and "right" appearing below merely indicate the directions of upper, lower, left, and right relative to the accompanying drawings and do not limit the structure.
[0043] Example
[0044] To address the shortcomings of existing byte-space traffic counterattacks, this embodiment proposes a byte-space encrypted traffic counterattack method. This method generates traffic adversarial samples by applying customized perturbations to the payload of data packets. During the counterattack, multiple constraints are added to generate perturbations with multiple relationships, thereby generating traffic adversarial samples with perturbations with multiple relationships. This multiple relationship can be used to restore the original traffic after passing the detection model, better achieving the attack objective. This method is highly compatible with counterattack methods.
[0045] like Figure 1 、 Figure 2 The encrypted traffic anti-attack method of this embodiment includes the following steps:
[0046] Step 1: Obtain a standard and representative encrypted traffic data set. Generally, one type of traffic corresponds to one pcap file.
[0047] Step 2: Preprocess the acquired traffic data to extract traffic load information and form a traffic byte sequence.
[0048] Step 3: Send the preprocessed data to the deep learning network model for training to obtain an encrypted traffic detection model.
[0049] Step 4: Use adversarial attack on the encrypted traffic detection model to generate an adversarial byte sequence X with a multiple relationship of perturbations that can deceive the encrypted traffic detection model. ADV and X′ ADV .
[0050] e′=k·e
[0051] Wherein, e is the first disturbance, e′ is the second disturbance, k is the multiple between the first disturbance and the second disturbance, k=2, 3, 4, 5….
[0052] Step 5: Generate adversarial byte sequence X ADV and X′ ADV ,generate adversarial traffic samples that can deceive encrypted traffic detection models;
[0053] Step 6: Input the adversarial traffic sample into the encrypted traffic detection model to complete the deception and evaluate the effectiveness of the adversarial attack. Then, use the multiple relationship of the perturbation to restore the original encrypted traffic and evaluate the restoration performance of the method.
[0054] Step 1: Obtain a standard, representative encrypted traffic dataset. The USTC-TFC2016 public dataset is used. This dataset contains encrypted traffic, consisting of both malicious and benign traffic. Malicious and benign traffic are further categorized into 10 different types of traffic. Benign traffic includes BitTorrent and Gmail, while malicious traffic includes Cridex and Tinba. You can select appropriate traffic files as needed to form the dataset for subsequent experiments.
[0055] In step 2, the traffic data obtained in step 1 is preprocessed to extract traffic load information and form traffic samples. Specifically, different types of traffic are divided into flow units to form traffic samples. One flow corresponds to one traffic sample, and one flow includes several traffic data packets. Then, for each traffic sample, the data packets in each flow are read using a relevant toolkit or function library. In the process of reading the data packets, the load information is extracted using the function in Python's Pyshark library. It is determined whether there is payload field information (load information) in the data packet. If the load information exists, it is extracted; if not, the data packet is skipped. After completing the reading of all data packets, the extracted load information is normalized. That is, the first 1024 bytes of the payload information are first extracted. If the traffic sample is less than 1024 bytes, zeros are added to the end. Then, the 1024 bytes are converted into a one-dimensional byte sequence corresponding to 1024 decimal numbers, and each byte corresponds to an integer from 0 to 255, which is used as the input of the subsequent model. In this embodiment, the number of traffic samples generated for each subclass is 1000.
[0056] In step 3, the byte sequence of the corresponding sample obtained in step 2 is used as input to train the deep learning network model. The training goal is to enable the model to classify traffic samples as correctly as possible and obtain an encrypted traffic detection model.
[0057] This example uses five different deep learning network models, including the DeepPacket model, Datanet model, TrafficCNN model, Resnet18 model, and Densenet121 model. All traffic samples from small classes are grouped into large classes, meaning only a binary classification operation is performed on the traffic samples. The structures of the five deep learning network models were adjusted. The first input layer was changed to a single-channel layer to accommodate byte vector inputs. The final classification softmax layer was then replaced with a two-neuron softmax layer for binary classification, while all other parameters remained unchanged. This allows the model to output a 1x2 tensor representing the binary classification result. During training, the training set to test set ratio was 6:4, and training was repeated for 10 rounds with a batch size of 8. After training, the five models achieved classification accuracy of 99.30%, 99.75%, 99.73%, 99.75%, and 99.58%, respectively, for traffic samples. The classification results are shown in Table 4, demonstrating the high efficiency of the models in traffic classification.
[0058] In step 4, a specific image adversarial attack method can be used in combination with a multiple perturbation training method to add perturbations to the byte sequence. Specifically, FGSM, DeepFool, and C&W adversarial attack methods are used to attack the trained encrypted traffic detection model to form an adversarial byte sequence X with a multiple perturbation relationship. ADV and X′ ADV ,These adversarial byte sequences can effectively deceive the encrypted traffic detection model.
[0059] Use the adversarial attack method to add perturbations to the byte sequence to make the trained encrypted traffic detection model misclassify. In this embodiment, the FGSM attack method is used. The FGSM attack method is a gradient-based adversarial attack method that makes the encrypted traffic detection model misclassify by adding perturbations in the opposite direction of the gradient. During the attack, the added perturbations are controlled to have a multiple relationship, generating two adversarial byte sequences X with a multiple relationship of perturbations. ADV and X′ ADV .
[0060] X ADV =X+e
[0061] X′ ADV =X+e′
[0062] e′=k·e
[0063] e=grad·(r / s)·positions
[0064] Among them, X ADV is the first adversarial byte sequence, X′ ADV is the second adversarial byte sequence, X is the traffic byte sequence, e is the first perturbation, e′ is the second perturbation, k is the multiple between the first and second perturbations, k = 2, 3, 4, 5, etc. grad is the gradient, r is the initial perturbation, s is the number of perturbation steps, and positions is the legal position.
[0065] Preferably, when the deep learning network model adopts the adjusted DeepPacket model or Datanet model, k is selected as 2, 3, 4, 5...; when the deep learning network model adopts the adjusted TrafficCNN model, Resnet18 model, or Densenet121 model, k is selected as 2 or 3.
[0066] Adversarial attacks use methods such as FGSM, DeepFool, and C&W. The inputs of these methods are parameters such as gradients, vectors, and perturbation sizes.
[0067] In the FGSM attack on the traffic byte sequence X, the gradient grad* perturbation r is added each time. The gradient is the direction in which the loss function decreases fastest. If the sequence is updated in the opposite direction of the gradient, the loss will increase, and the generated adversarial byte sequence will be misidentified by the model. This is the attack process.
[0068] The multiple perturbation training method is as follows:
[0069] Input: original byte sequence X, corresponding true label y, perturbation size r, perturbation multiple k, target detection model F(), loss function criterion(), perturbation step number s;
[0070] Output: adversarial byte sequence X ADV , X′ ADV
[0071] 1:X ADV ←X, X ADV ←X
[0072] 2: fori←l...s do
[0073] 3: Step 1: Calculate the gradient
[0074] 4:y1←F(X ADV ), y2←F(X′ ADV )
[0075] 5: loss←criterion(y1,y)+criterion(y2,y)
[0076] 6: loss.backwardO
[0077] 7: grad←X ADV .grad
[0078] 8: Step 2: Calculate Legal Position
[0079] 9: positions←getLegalIndex(X ADV ,X ADV .grad,k)
[0080] 10: Step 3: Counter Attack
[0081] 11:X ADV =X ADV +grad*(r / s)*positions
[0082] 12: X′ ADV =X′ ADV +grad*(r / s)*k*positions
[0083] 13: end for
[0084] 14:Return Xadv,Xadv
[0085] Among them, the loss function is the cross entropy function, getLegalIndex(X ADV ,X ADV .grad,k) is to calculate all legal positions so that after the adversarial attack on these legal positions, all bytes are still in the range of [0-255]. Loss.backward() is gradient reversal, the perturbation step s is 10, and the perturbation r is 60 / 255; grad refers to the positive and negative of the gradient, that is, the direction, and positions are legal positions. After the loss is back-propagated, that is, after loss.backward(), X ADV An attribute grad will appear, through X ADV You can get grad by accessing it through .grad.
[0086] Step 5 generates an adversarial traffic sample that can deceive the encrypted traffic detection model through the generated adversarial byte sequence. Specifically, the data packets in the original encrypted traffic sample are read in sequence, and the corresponding payload field in each data packet is replaced with the corresponding adversarial byte sequence to form a new data packet; finally, all the changed data packets are rewritten into a new pcap file to obtain the adversarial traffic sample.
[0087] We use the rdpcap function in the Scapy library to read packets from the original encrypted traffic. We then access the payload field (the payload information) in each packet and replace it with the adversarial byte sequence. Finally, we use wrpcap in the Scapy library to write all packets to a new pcap file. This generates an adversarial traffic sample. By comparison, the adversarial traffic sample and the original encrypted traffic sample can be parsed normally, with only the payload information showing a difference; the data header remains unchanged. The original encrypted traffic, adversarial traffic, and restored encrypted traffic are shown in Tables 1, 2, and 3, respectively.
[0088] Table 1 Original encrypted traffic
[0089] 00e0 3c 68 74 6d 6c 3e 3c 68 65 61 64 3e 3c 74 69 74 00f0 6c 65 3e 41 70 61 63 68 65 20 54 6f 6d 63 61 74 0100 2f 36 2e 30 2e 32 34 20 2d 20 45 72 72 6f 72 20 0110 72 65 70 6f 72 74 3c 2f 74 69 74 6c 65 3e 3c 73 0120 74 79 6c 65 3e 3c 21 2d 2d 48 31 20 7b 66 6f 6e 0130 74 2d 66 61 6d 69 6c 79 3a 54 61 68 6f 6d 61 2c
[0090] Table 2: Countermeasures traffic
[0091] 00e0 b4 f0 2c f5 f4 6e 24 e0 ed e9 ec 56 b4 ec f1 ec 00f0 f4 ed c6 c9 40 a9 c3 e0 dd 98 bd ea fa e7 ea e0 0100 a7 ee a6 a8 a6 02 ac f0 8d 98 cc 9f f5 63 e9 ec 0110 fa ed e8 f7 ea ec 6c a7 ec 39 ec e4 ed c6 c4 bb 0120 ec 19 e4 ed b6 6c 81 a5 a5 48 cf e0 03 66 f7 f6 0130 fc d3 de e9 3d f1 f4 f1 3a cc d9 e0 e7 e5 91 8c
[0092] Table 3 Restored encrypted traffic
[0093] 00e0 3c 68 74 6d 6c 3e 3c 68 65 61 64 3e 3c 74 69 74 00f0 6c 65 3e 41 70 61 63 68 65 20 54 6f 6d 63 61 74 0100 2f 36 2e 30 2e 32 34 20 2d 20 45 72 72 6f 72 20 0110 72 65 70 6f 72 74 3c 2f 74 69 74 6c 65 3e 3c 73 0120 74 79 6c 65 3e 3c 21 2d 2d 48 31 20 7b 66 6f 6e 0130 74 2d 66 61 6d 69 6c 79 3a 54 61 68 6f 6d 61 2c
[0094] In step 6, the adversarial traffic sample is input into the encrypted traffic detection model to complete the deception and evaluate the effectiveness of the adversarial attack. Then, the original encrypted traffic is restored using the multiple relationship of the perturbation and the restoration performance of the method is evaluated. The effectiveness of the method is specifically demonstrated through experimental indicators.
[0095] X′=(k·X VDV -X′ ADV ) / (k-1)
[0096] Where X′ is the recovered traffic byte sequence.
[0097] The generated adversarial traffic samples are input into the encrypted traffic detection model, where accuracy, precision, recall, and F1 score are used as indicators. The results show that the encrypted traffic detection model has weak recognition ability for adversarial traffic samples and has low recognition efficiency, as shown in Table 4.
[0098] Table 4 Comparison of recognition efficiency of encrypted traffic detection models before and after the attack
[0099]
[0100] Finally, through X ADV and X′ ADV The disturbance multiple relationship between them is used to restore the encrypted traffic. It is found that the original traffic can be restored. As shown in Table 1 and Table 3, the restored encrypted traffic is consistent with the original encrypted traffic.
[0101] The methods for countering encrypted traffic are as follows:
[0102] Input: original flow f, corresponding true label y, perturbation size r, target detection model F()
[0103] Output: Adversarial flow f adv
[0104] 1: Step 1: Extracting the flow load
[0105] 2: packets←getPackets(f)
[0106] 3: l←len(packets)
[0107] 4: for i←1...l do
[0108] 5: packet←packets i
[0109] 6: payload←packet.payload
[0110] 7: X←X.append(payload)
[0111] 8: end for
[0112] 9: Step 2: Counterattack
[0113] 10:X ADV ←Attack(X,F(),y,r)
[0114] 11: Step 3: Changing the Load
[0115] 12: index←0
[0116] 13: for i←1...l do
[0117] 14: packet←packets i
[0118] 15: length←len(packet)
[0119] 16: packet.payload←X ADV [index:index+length]
[0120] 17: index←index+length
[0121] 18: end for
[0122] 19: Step 4: Generate Adversarial Flow
[0123] 20:f adv ←generateAdversarialFlow(packets)
[0124] 21: Return f adv
[0125] getPackets() processes the input flow, extracts all packets, and stores them in the packets variable. l represents the length of packets, or the number of packets. By sequentially accessing packets and consolidating the payload using the append operation, the original byte sequence X is obtained. append appends a vector to the end of a vector. The attack() function primarily uses adversarial attack methods to generate adversarial byte sequences. generateAdversarialFlow() generates adversarial traffic samples using the modified packets.
[0126] This method uses adversarial attack methods to attack deep learning network models, and can generate adversarial traffic samples with the same structure as the original traffic, which is better than similar work. At the same time, the perturbations generated by the multiple perturbation training method have a multiple relationship, and the original traffic can be restored through this multiple relationship. It has good practicality and effectiveness, and provides a new idea for encrypted traffic adversarial attack methods.
[0127] Traffic adversarial samples generated using this method can effectively evade detection models. After bypassing the detection system, the original traffic can be effectively restored by leveraging the multiples of the perturbation. This method only affects the payload of packets, and its effectiveness has been verified, demonstrating practical significance.
[0128] Another embodiment of the present invention provides an electronic device, including:
[0129] one or more processors;
[0130] A memory stores one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the steps of the method for encrypting traffic to resist attacks.
[0131] In some implementations, the memory may be a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage.
[0132] In other implementations, the processor may be a central processing unit (CPU), a digital signal processor (DSP), or other general-purpose processors, which are not limited herein.
[0133] Another embodiment of the present invention provides a computer-readable storage medium storing a computer program, which implements the steps of the method for encrypting traffic to resist attacks when the computer program is executed by a processor.
[0134] Another embodiment of the present invention provides a computer program product, including a computer program / instruction, which implements the steps of the encrypted traffic anti-attack method when executed by a processor.
[0135] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of one or more computer-usable storage media (including but not limited to disk storage, In the form of a computer program product implemented on a computer (such as an optical storage device).
[0136] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0137] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0139] The contents illustrated in the above embodiments should be understood as these embodiments are only used to more clearly illustrate the present invention, and are not used to limit the scope of the present invention. After reading the present invention, various equivalent modifications of the present invention by those skilled in the art shall fall within the scope defined by the claims attached to this application.
Claims
1. A method for defending against attacks on encrypted traffic, characterized in that: The following steps are involved: S1. Obtain encrypted traffic; S2. Extract the payload information from the encrypted traffic to form a traffic byte sequence; S3. Using the traffic byte sequence as input to a deep learning network model, training the deep learning network model to obtain an encrypted traffic detection model; S4. Attacking the encrypted traffic detection model using an adversarial attack method, adding a first perturbation and a second perturbation having a multiple relationship to the traffic byte sequence, to obtain a first adversarial byte sequence and a second adversarial byte sequence; S5. Replace the payload information in the encrypted traffic with the first antagonistic byte sequence and the second antagonistic byte sequence respectively to obtain the first antagonistic traffic and the second antagonistic traffic.
2. The method for resisting attacks on encrypted traffic according to claim 1, characterized in that: The S2 process includes: Segment the encrypted traffic by flow to form multiple traffic samples; Extract load information from each traffic sample; Convert payload information into a sequence of traffic bytes.
3. The method for resisting attacks on encrypted traffic according to claim 1, characterized in that: Adjust any one of the DeepPacket model, Datanet model, TrafficCNN model, Resnet18 model, and Densenet121 model, change the input layer to a single channel, and change the final softmax layer to a two-neuron softmax layer, and use it as a deep learning network model.
4. The method for resisting attacks on encrypted traffic according to claim 3, characterized in that: When the deep learning network model uses the adjusted DeepPacket model or Datanet model, the multiple between the first perturbation and the second perturbation is 2, 3, 4, 5, etc.; when the deep learning network model uses the adjusted TrafficCNN model, Resnet18 model, or Densenet121 model, the multiple between the first perturbation and the second perturbation is 2 or 3.
5. The method for resisting attacks on encrypted traffic according to claim 1, characterized in that: The expressions of the first adversarial byte sequence and the second adversarial byte sequence are as follows: X ADV =X+e X′ ADV =X+e′ e′=k·e Among them, X ADV is the first adversarial byte sequence, X′ ADV is the second adversarial byte sequence, X is the traffic byte sequence, e is the first perturbation, e′ is the second perturbation, and k is the multiple between the first and second perturbations.
6. The method for resisting attacks on encrypted traffic according to claim 1, characterized in that: The expression of the first perturbation is as follows: e=grad·(r / s)·positions Among them, grad is the gradient, r is the initial perturbation, s is the number of perturbation steps, and positions is the legal position.
7. The method for resisting attacks on encrypted traffic according to claim 1, characterized in that: S6. Restore the traffic byte sequence using the first adversarial byte sequence and the second adversarial byte sequence. Convert the restored traffic byte sequence into payload information to restore the encrypted traffic. The expression of the restored traffic byte sequence is as follows: X′=(k·X ADV -X′ ADV ) / (k-1) Among them, X ADV is the first adversarial byte sequence, X′ ADV is the second adversarial byte sequence, k is the multiple between the first perturbation and the second perturbation, and X′ is the restored traffic byte sequence.
8. An electronic device, characterized in that: include: one or more processors; A memory having one or more programs stored thereon, which, when executed by the one or more processors, enables the one or more processors to implement the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that The device stores a computer program, which implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.
10. A computer program product, characterized in that The method comprises a computer program / instruction, which implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Patent Citations
Encrypted traffic analysis defense method and system based on adversarial attack algorithm
CN113938291A
Method and device for generating and testing adversarial attack sample based on black box scene
CN117240624A
Counter-enhanced malicious encrypted traffic detection method based on feature analysis
CN118509219A
Network traffic confrontation sample generation method and system based on time sequence
CN118659907A
Attack defense method and device, equipment, medium and product
CN118802286A