WO2022094926A1 - 一种加密流量识别方法、系统、终端以及存储介质 - Google Patents

一种加密流量识别方法、系统、终端以及存储介质 Download PDF

Info

Publication number
WO2022094926A1
WO2022094926A1 PCT/CN2020/127102 CN2020127102W WO2022094926A1 WO 2022094926 A1 WO2022094926 A1 WO 2022094926A1 CN 2020127102 W CN2020127102 W CN 2020127102W WO 2022094926 A1 WO2022094926 A1 WO 2022094926A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
network traffic
traffic data
network
encrypted
Prior art date
Application number
PCT/CN2020/127102
Other languages
English (en)
French (fr)
Inventor
叶可江
林鹏
胡奕绅
须成忠
Original Assignee
中国科学院深圳先进技术研究院
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国科学院深圳先进技术研究院 filed Critical 中国科学院深圳先进技术研究院
Priority to PCT/CN2020/127102 priority Critical patent/WO2022094926A1/zh
Publication of WO2022094926A1 publication Critical patent/WO2022094926A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/16Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks using machine learning or artificial intelligence
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/02Capturing of monitoring data
    • H04L43/026Capturing of monitoring data using flow identification

Definitions

  • the present application belongs to the technical field of traffic identification, and in particular, relates to an encrypted traffic identification method, system, terminal and storage medium.
  • Traffic identification which aims to classify different network traffic into appropriate categories, is a fundamental task in network management and cyberspace security.
  • the traditional traffic identification method mainly adopts the method based on the port number. This method performs port matching according to the list provided by IANA (Internet Assigned Numbers Authority, Internet Assigned Numbers Authority) to determine the type of traffic. But as more and more applications use dynamically allocated ports or common communication protocol ports for masquerading, this approach has become unreliable. At the same time, with the gradual improvement of people's awareness of security and privacy, most of the current application traffic is encrypted by various encryption protocols, such as IPsec, SSL/TLS, SSH, etc., which makes the traditional traffic classification method no longer valid.
  • Classification method based on message type the header part of each SSL/TLS packet has a field that identifies the message type of the packet, which can abstract the packet sequence into a sequence of message types, and different types of message types. There are different probability transition relationships between them.
  • the method based on the message type is to learn the state transition matrix of different message types by establishing the Markov model of the message type.
  • the method based on the message sequence can basically only use the first-order or second-order Markov model, that is to say, it can only use the data of 2 or 3 time steps for training, so the learned time information is very limited.
  • the number of message types is very small, many different traffics will have similar sequence of message types.
  • Classification method based on length sequence is similar to the method based on message type, it abstracts the network flow into a sequence of length, and then uses Markov model or other machine learning methods to model the sequence.
  • the disadvantage of this method is that it is obviously a very naive simplification to represent data packets only by the packet length, and a lot of details are bound to be lost.
  • the length sequence will lose the distinction.
  • the present application provides an encrypted traffic identification method, system, terminal and storage medium, aiming to solve one of the above technical problems in the prior art at least to a certain extent.
  • a method for identifying encrypted traffic comprising the following steps:
  • Use Transformer to learn the time sequence relationship between the encoded network traffic data packets, obtain the feature representation of each network traffic data packet, and use bidirectional LSTM to learn the length information of each network traffic data packet;
  • the feature representation and length information of each network traffic data packet are fused and Softmax classified to obtain a traffic identification result of each network traffic data packet.
  • the technical solution adopted in the embodiment of the present application further includes: the training of a neural network model with data packet encoding capability includes:
  • An encrypted traffic identification model is built, the encrypted traffic identification model includes a pre-training layer, a data packet encoding layer, a timing layer, a supplementary layer and a classification layer, and the neural network model is trained on the pre-training layer of the encrypted traffic identification model.
  • the technical solution adopted in the embodiment of the present application also includes: the training of a neural network model with data packet coding capability includes:
  • the technical solution adopted in the embodiment of the present application further includes: the encoding the byte content of the network traffic data packet by using the neural network model includes:
  • the vector corresponding to each [PACKET] tag is used as the vector representation of the corresponding network traffic data packet.
  • the technical solutions adopted in the embodiments of the present application further include: using the Transformer to learn the time sequence relationship between the encoded network traffic data packets, and acquiring the feature representation of each network traffic data packet includes:
  • the technical solutions adopted in the embodiments of the present application further include: the use of bidirectional LSTM to learn the length information of each network traffic data packet includes:
  • the technical solutions adopted in the embodiments of the present application further include: the fusion of the feature representation and length information of the respective network traffic data packets and the Softmax classification include:
  • the gradient descent algorithm is used to update the network parameters of the encrypted traffic identification model.
  • an encrypted traffic identification system comprising:
  • Pre-training module used to obtain network traffic data packets, use Transformer Encoder to learn the correlation between the byte contents of each network traffic data packet, and train a neural network model with data packet encoding ability;
  • Data packet encoding module used to encode the byte content of the network traffic data packet through the neural network model
  • Feature learning module used to use the Transformer to learn the time sequence relationship between the encoded network traffic data packets, and obtain the feature representation of each network traffic data packet;
  • Length learning module used to learn the length information of each network traffic packet using bidirectional LSTM;
  • Fusion and classification module used to fuse the feature representation and length information of each network traffic data packet and perform Softmax classification to obtain the traffic identification result of each network traffic data packet.
  • a terminal includes a processor and a memory coupled to the processor, wherein,
  • the memory stores program instructions for implementing the encrypted traffic identification method
  • the processor is configured to execute the program instructions stored in the memory to control encrypted traffic identification.
  • a storage medium storing program instructions executable by a processor, where the program instructions are used to execute the encrypted traffic identification method.
  • the beneficial effects of the embodiments of the present application are: the encrypted network traffic identification method, system, terminal, and storage medium of the embodiments of the present application construct an end-to-end encrypted traffic identification model, and randomly cover some data packet words.
  • the unsupervised pre-training method of section content and recovery through Transformer can well learn the correlation between different packets, better express network traffic bytes, and achieve better packet encoding capabilities;
  • the feature representation, length information, and the fusion of feature representation and length information respectively calculate the loss function value once, and use the sum of the three loss function values to update the network parameters by gradient descent to ensure that the neural network can learn the original bytes of the data packet information and length information, improve network performance, and achieve better encrypted traffic identification effect while maintaining the integrity of data packet information.
  • Fig. 1 is the flow chart of the encrypted traffic identification method of the first embodiment of the present application
  • FIG. 2 is a flowchart of an encrypted traffic identification method according to a second embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an encrypted traffic identification model according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of an encrypted traffic identification system according to an embodiment of the application.
  • FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a storage medium according to an embodiment of the present application.
  • the encrypted traffic identification method of the embodiment of the present application proposes an end-to-end encrypted traffic identification framework at the data packet level.
  • Training and self-attention mechanism methods learn the deep connections between data packets to maintain the information integrity of the data packets and achieve better recognition results.
  • FIG. 1 is a flowchart of a method for identifying encrypted traffic according to the first embodiment of the present application.
  • the encrypted traffic identification method according to the first embodiment of the present application includes the following steps:
  • S1 Obtain network traffic data packets, use Transformer Encoder to learn the correlation between the byte contents of each network traffic data packet, and train a neural network model with data packet encoding capabilities;
  • S3 Use Transformer to learn the time sequence relationship between the encoded network traffic data packets, obtain the feature representation of each network traffic data packet, and use bidirectional LSTM to learn the length information of each network traffic data packet;
  • FIG. 2 is a flowchart of a method for identifying encrypted traffic according to the second embodiment of the present application.
  • the encrypted traffic identification method of the second embodiment of the present application includes the following steps:
  • the structure of the encrypted traffic identification model is shown in Figure 3, which includes a pre-training layer, a data packet encoding layer, a timing layer, a supplementary layer and a classification layer.
  • S20 In the pre-training layer, obtain a large number of unsupervised network traffic data packets, use the Transformer Encoder (encoder) to learn the correlation between the byte contents of each network traffic data packet, and train a neural network with data packet encoding ability Model;
  • the training process of the pre-training layer specifically includes:
  • S24 Use the Transformer Encoder to learn the correlation between the byte contents of each network traffic packet, recover the masked byte contents, and use the cross entropy as the loss function to train a neural network model with packet encoding ability.
  • the embodiment of the present application adopts the unsupervised pre-training method of randomly masking part of the byte content of the data packet and restoring it through the Transformer in the pre-training layer to train the neural network model, which can better express the network traffic bytes, so as to achieve better performance. Good packet encoding capability.
  • S30 In the data packet encoding layer, use the neural network model trained by the pre-training layer to encode the content of each byte of the network traffic data packet respectively, and send the encoded network traffic data packet to the time sequence layer;
  • the implementation process of the neural network model encoding the network traffic data packet specifically includes:
  • S40 In the time sequence layer, use the Transformer to learn the time sequence relationship between each network traffic data packet, and obtain the feature representation of each network traffic data packet;
  • S50 In the supplementary layer, using the length information of all network traffic data packets as input, use bidirectional LSTM (Long Short-Term Memory, long short-term memory network) to learn the hidden features of the data packet length sequence;
  • LSTM Long Short-Term Memory, long short-term memory network
  • the learning process of the length information of the network traffic data packet specifically includes:
  • S60 The feature representation h1 and length information h2 of the network traffic data packets are used as the input of the classification layer, and the traffic identification results of each network traffic datagram are output by fusing the feature representation h1 and the length information h2 and Softmax classification ;
  • the fusion process of the feature representation h 1 and the length information h 2 by the classification layer specifically includes:
  • the embodiment of the present application performs one loss function value calculation for each part (h 1 , h 2 , h 3 ) in the classification layer, and uses the sum of the three loss function values to perform gradient descent to update the network parameters to ensure The neural network learns the original byte information and length information of the data packet to improve network performance.
  • FIG. 4 is a schematic structural diagram of an encrypted network traffic identification system according to an embodiment of the present application.
  • the encrypted network traffic identification system 40 in the embodiment of the present application includes:
  • Pre-training module 41 used to obtain network traffic data packets, use Transformer Encoder to learn the correlation between the byte contents of each network traffic data packet, and train a neural network model with data packet encoding capability;
  • Data packet encoding module 42 used to encode the byte content of the network traffic data packet through the neural network model;
  • Feature learning module 43 for using Transformer to learn the time sequence relationship between the encoded various network traffic data packets, to obtain the feature representation of each network traffic data packet;
  • Length learning module 44 used to learn the length information of each network traffic data packet using a bidirectional LSTM;
  • the memory 52 stores program instructions for implementing the above-described encrypted traffic identification method.
  • the processor 51 is configured to execute program instructions stored in the memory 52 to control encrypted traffic identification.
  • the processor 51 may also be referred to as a CPU (Central Processing Unit, central processing unit).
  • the processor 51 may be an integrated circuit chip with signal processing capability.
  • the processor 51 may also be a general purpose processor, digital signal processor (DSP), application specific integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component .
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA off-the-shelf programmable gate array
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • FIG. 6 is a schematic structural diagram of a storage medium according to an embodiment of the present application.
  • the storage medium of this embodiment of the present application stores a program file 61 capable of implementing all the above methods, wherein the program file 61 may be stored in the above-mentioned storage medium in the form of a software product, and includes several instructions to make a computer device (which may It is a personal computer, a server, or a network device, etc.) or a processor that executes all or part of the steps of the methods of the various embodiments of the present invention.
  • a computer device which may It is a personal computer, a server, or a network device, etc.
  • a processor that executes all or part of the steps of the methods of the various embodiments of the present invention.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes , or terminal devices such as computers, servers, mobile phones, and tablets.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请涉及一种加密流量识别方法、系统、终端以及存储介质。包括:获取网络流量数据包,学习各个网络流量数据包字节内容之间的关联性,训练一个具有数据包编码能力的神经网络模型;通过所述神经网络模型对所述网络流量数据包的字节内容进行编码;学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示,并学习各个网络流量数据包的长度信息;对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类,得到所述各个网络流量数据包的流量识别结果。本申请可以保证神经网络可以学习到数据包的原始字节信息和长度信息,在保持数据包信息完整性的同时达到更好的加密流量识别效果。

Description

一种加密流量识别方法、系统、终端以及存储介质 技术领域
本申请属于流量识别技术领域,特别涉及一种加密流量识别方法、系统、终端以及存储介质。
背景技术
流量识别,旨在将不同的网络流量分类到合适的类别,是网络管理和网络空间安全中的一项基本任务。传统的流量识别方法主要采用基于端口号的方法,该方法根据IANA(Internet Assigned Numbers Authority,互联网号码分配局)提供的列表进行端口匹配,来确定流量的类别。但是随着越来越多的应用程序使用动态分配的端口或通用的通信协议端口进行伪装,这种方法已经变得不可靠。同时,随着人们的安全和隐私意识的逐渐提高,当前大多数应用流量都通过了各种各样的加密协议进行了加密,如IPsec、SSL/TLS、SSH等,这使得传统的流量分类方法不再有效。
近年来,一些学者使用加密流量的流特征(如数据包消息类型、包长度序列、统计特征等)结合机器学习方法进行建模,取得了一定的效果。具体包括:
一、基于消息类型的分类方法;每一个SSL/TLS的数据包header部分都有一个字段标识了该数据包的消息类型,可以把数据包序列抽象成一组消息类型的序列,不同类别的消息类型之间有着不同概率转移关系。基于消息类型的方法就是通过建立消息类型的马尔科夫模型,学习不同消息类型的状态转移矩阵。然而,考虑到可计算问题,基于消息序列的方法基本上只能使用一阶或者二阶马尔科夫模型,也就是说它只能使用2个或3个时间步的数据进行训练,因此学习到的时间信息非常有限。同时,由于消息类型的数目非常少,这会导致许多不同的流量之间会有相似的消息类型序列,重叠的消息类型会导致流量之间区分度不高,相似消息类型的不同类别流量将无法被精确地分开。另外,对于结合握手信息的方法,在真实场景中并不是所有的SSL/TLS流量都会含有这些信息:当短时间内恢复刚刚丢失的会话时,客户端和服务器之间不需要重新进行握手,这时候的网络流量就不含有握手包信息。
二、基于长度序列的分类方法;基于长度序列的方法与基于消息类型的方 法类似,它将网络流抽象成一个长度序列,然后使用马尔科夫模型,或者其他机器学习方法对序列进行建模。该方法的缺点在于:仅仅用包长度来代表数据包显然是一个非常朴素的简化,势必会丢失大量的细节。当数据包的长度一样或者接近的时候(如IP层的数据包分片),长度序列将丧失区分性。
三、基于统计特征的方法;这类方法主要思想是提取网络数据包的流级别,以此来表示一个通信流,然后结合其他机器学习算法进行分类。这些统计特征一般包括数据包的平均大小、平均间隔、传输速率等,有不少开源工具提供这些特征的提取功能。该方法的缺点在于:(1)特征被高度抽象,使得细粒度的操作无法实现(比如学习两个数据包之间的联系);(2)提取流统计特征需要设定一个监听间隔,比如10s,15s,这使得实时的流量分类成为不可能。
发明内容
本申请提供了一种加密流量识别方法、系统、终端以及存储介质,旨在至少在一定程度上解决现有技术中的上述技术问题之一。
为了解决上述问题,本申请提供了如下技术方案:
一种加密流量识别方法,包括以下步骤:
获取网络流量数据包,使用Transformer Encoder学习各个网络流量数据包字节内容之间的关联性,训练一个具有数据包编码能力的神经网络模型;
通过所述神经网络模型对所述网络流量数据包的字节内容进行编码;
使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示,并使用双向LSTM学习各个网络流量数据包的长度信息;
对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类,得到所述各个网络流量数据包的流量识别结果。
本申请实施例采取的技术方案还包括:所述训练一个具有数据包编码能力的神经网络模型包括:
搭建加密流量识别模型,所述加密流量识别模型包括预训练层、数据包编码层、时序层、补充层和分类层,在所述加密流量识别模型的预训练层训练所述神经网络模型。
本申请实施例采取的技术方案还包括:所述训练一个具有数据包编码能力 的神经网络模型包括:
将所有网络流量数据包按照相同的五元组:<源IP,目标IP,源端口,目标端口,传输协议>进行划分,每一组代表一个双向通信流;
提取每个网络流量数据包在IP层以上的字节内容,并将提取的字节内容转换成16进制文件;
按照设定比例分别对每个16进制文件中的字节内容进行随机掩盖,并分别在每个文件头部加入[PACKET]标记;
使用Transformer Encoder学习所述各个网络流量数据包字节内容之间的关联性,并恢复被掩盖的字节内容,使用交叉熵作为损失函数训练所述神经网络模型。
本申请实施例采取的技术方案还包括:所述通过所述神经网络模型对所述网络流量数据包的字节内容进行编码包括:
在所述加密流量识别模型的数据包编码层,提取每个网络流量数据包在IP层以上的字节内容,并将提取的字节内容转换成16进制文件;
分别在每个16进制文件的头部加入[PACKET]标记,并将每个16进制文件的字节内容切割或填充到预设长度;
使用所述神经网络模型对每个16进制文件的字节内容分别进行编码后,使用各个[PACKET]标记所对应的向量作为对应网络流量数据包的向量表示。
本申请实施例采取的技术方案还包括:所述使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示包括:
在所述加密流量识别模型的时序层,使用Transformer Encoder分别处理每个网络流量数据包的向量e i,使其融合其他网络流量数据包的信息,得到每个网络流量数据包的新的向量表示v i=Transformer(e i);
对所述每个网络流量数据包的向量表示v i进行拼接,得到每个网络流量数据包的特征表示h 1=Concat(v 1,v 2,…,v m)W o;其中,W o是神经网络的权重矩阵,Concat代表将两个向量拼接。
本申请实施例采取的技术方案还包括:所述使用双向LSTM学习各个网络流量数据包的长度信息包括:
在所述加密流量识别模型的补充层,分别提取每个网络流量数据包的原始长度信息,构建长度序列:L={l 1,l 2,…,l m}={length(p 1),length(p 2),…,length(p m)};其中l i表示数据包的长度,p i代表第i个数据包,length()表示提取数据包的长度信息;
使用双向LSTM对所述长度序列L进行学习,得到每个网络流量数据包的长度信息h 2=Concat(LSTM→(l 1,l 2,…,l m),LSTM←(l 1,l 2,…,l m));其中l i表示数据包的长度,Concat代表将两个向量拼接。
本申请实施例采取的技术方案还包括:所述对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类包括:
在所述加密流量识别模型的分类层,对所述时序层中的h 1进行全连接和Softmax分类,得到预测值γ 1
Figure PCTCN2020127102-appb-000001
并计算其交叉熵损失函数值loss 1;其中,W、b是神经网络待学习的参数;
对所述补充层中的h 2进行全连接和Softmax分类,得到预测值γ 2
Figure PCTCN2020127102-appb-000002
并计算其交叉熵损失函数值loss 2
将h 1、h 1进行拼接,得到h 3=Concat(h 1,h 2);
对h 3进行全连接和Softmax分类,得到预测值γ 3
Figure PCTCN2020127102-appb-000003
Figure PCTCN2020127102-appb-000004
并计算其交叉熵损失函数值loss 3
计算loss 1、loss 2、loss 3之和
Figure PCTCN2020127102-appb-000005
并根据计算结果采用梯度下降算法更新所述加密流量识别模型的网络参数。
本申请实施例采取的另一技术方案为:一种加密流量识别系统,包括:
预训练模块:用于获取网络流量数据包,使用Transformer Encoder学习各 个网络流量数据包字节内容之间的关联性,训练一个具有数据包编码能力的神经网络模型;
数据包编码模块:用于通过所述神经网络模型对所述网络流量数据包的字节内容进行编码;
特征学习模块:用于使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示;
长度学习模块:用于使用双向LSTM学习各个网络流量数据包的长度信息;
融合及分类模块:用于对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类,得到所述各个网络流量数据包的流量识别结果。
本申请实施例采取的又一技术方案为:一种终端,所述终端包括处理器、与所述处理器耦接的存储器,其中,
所述存储器存储有用于实现所述加密流量识别方法的程序指令;
所述处理器用于执行所述存储器存储的所述程序指令以控制加密流量识别。
本申请实施例采取的又一技术方案为:一种存储介质,存储有处理器可运行的程序指令,所述程序指令用于执行所述加密流量识别方法。
相对于现有技术,本申请实施例产生的有益效果在于:本申请实施例的加密网络流量识别方法、系统、终端以及存储介质通过构建端到端的加密流量识别模型,通过随机掩盖部分数据包字节内容并通过Transformer进行恢复的无监督预训练方法,可以很好地学习不同数据包之间的关联性,更好地表达网络流量字节,以达到更好地数据包编码能力;通过分别对特征表示、长度信息以及特征表示和长度信息的融合分别进行一次损失函数值的计算,并用三个损失函数值之和进行梯度下降更新网络参数,以保证神经网络可以学习到数据包的原始字节信息和长度信息,提高网络性能,在保持数据包信息完整性的同时达到更好的加密流量识别效果。
附图说明
图1是本申请第一实施例的加密流量识别方法的流程图;
图2是本申请第二实施例的加密流量识别方法的流程图;
图3是本申请实施例的加密流量识别模型的结构示意图;
图4为本申请实施例的加密流量识别系统结构示意图;
图5为本申请实施例的终端结构示意图;
图6为本申请实施例的存储介质的结构示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
针对现有技术的不足,本申请实施例的加密流量识别方法提出一个数据包级别的端到端加密流量识别框架,该框架使用数据包原始字节+长度序列的策略,采用无监督的流量预训练以及自注意力机制方法学习数据包之间的深层联系,以保持数据包的信息完整性,达到更好的识别效果。
具体的,请参阅图1,是本申请第一实施例的加密流量识别方法的流程图。本申请第一实施例的加密流量识别方法包括以下步骤:
S1:获取网络流量数据包,使用Transformer Encoder学习各个网络流量数据包字节内容之间的关联性,训练一个具有数据包编码能力的神经网络模型;
S2:通过所述神经网络模型对所述网络流量数据包的字节内容进行编码;
S3:使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示,并使用双向LSTM学习各个网络流量数据包的长度信息;
S4:对所述各个网络流量数据包的特征表示和长度信息进行融合以及 Softmax分类,得到所述各个网络流量数据包的流量识别结果。
请参阅图2,是本申请第二实施例的加密流量识别方法的流程图。本申请第二实施例的加密流量识别方法包括以下步骤:
S10:搭建一个数据包级别的端到端的加密流量识别模型;
本步骤中,加密流量识别模型结构如图3所示,其包括预训练层、数据包编码层、时序层、补充层和分类层。
S20:在预训练层,获取大量无监督的网络流量数据包,使用Transformer Encoder(编码器)学习各个网络流量数据包字节内容之间的关联性,训练出一个具有数据包编码能力的神经网络模型;
本步骤中,预训练层的训练过程具体包括:
S21:将所有网络流量数据包按照相同的五元组:<源IP,目标IP,源端口,目标端口,传输协议>进行划分,其中,每一组代表一个双向通信流;
S22:提取每个网络流量数据包在IP层以上的字节内容,并将提取的字节内容转换成16进制文件;
S23:按照设定比例(本申请实施例中设定该比例为15%,具体可根据实际操作进行设置)分别对每个16进制文件中的字节内容进行随机掩盖,并分别在每个文件头部加入[PACKET]标记;
S24:使用Transformer Encoder学习各个网络流量数据包字节内容之间的关联性,并恢复被掩盖的字节内容,使用交叉熵作为损失函数训练出一个具有数据包编码能力的神经网络模型。
上述中,本申请实施例在预训练层采用随机掩盖数据包的部分字节内容并通过Transformer进行恢复的无监督预训练方法训练神经网络模型,可以更好地表达网络流量字节,以达到更好的数据包编码能力。
S30:在数据包编码层,利用预训练层训练得到的神经网络模型对网络流量数据包的每个字节内容分别进行编码,并将编码后的网络流量数据包送入时序层;
本步骤中,神经网络模型对网络流量数据包进行编码的实现过程具体包括:
S31:提取每个网络流量数据包在IP层以上的字节内容,并将提取的字节内容转换成16进制文件;
S32:分别在每个16进制文件的头部加入[PACKET]标记,并将每个16进制文件的字节内容切割或填充到预设长度;
S33:使用神经网络模型对每个16进制文件的字节内容(包括[PACKET]标记)分别进行编码后,分别使用各个[PACKET]标记所对应的向量作为对应网络流量数据包的向量表示,并将其送入时序层;
上述中,本申请实施例通过在数据包编码层补充每个数据包的长度信息,防止在切割或填充时造成的长度信息丢失,尽可能地保持了数据包信息的完整性。
S40:在时序层中,使用Transformer学习各个网络流量数据包之间的时序关系,获取每个网络流量数据包的特征表示;
本步骤中,时序层对时序关系的学习过程具体包括:
S41:使用Transformer Encoder分别处理每个网络流量数据包的向量e i,使其融合其他网络流量数据包的信息,得到每个网络流量数据包的新的向量表示v i=Transformer(e i);
S42:对每个网络流量数据包的向量表示v i进行拼接,得到每个网络流量数据包的特征表示h 1=Concat(v 1,v 2,…,v m)W o;其中,W o是神经网络的权重矩阵,Concat代表将两个向量拼接。
S50:在补充层,以所有网络流量数据包的长度信息为输入,使用双向LSTM(Long Short-Term Memory,长短期记忆网络)学习数据包长度序列的隐特征;
本步骤中,网络流量数据包的长度信息学习过程具体包括:
S51:分别提取每个网络流量数据包的原始长度信息,构建长度序列:L={l 1,l 2,…,l m}={length(p 1),length(p 2),…,length(p m)};其中l i表示数据包的长度,p i代表第i个数据包,length()表示提取数据包的长度信息;
S52:使用双向LSTM对长度序列L进行学习,得到每个网络流量数据包的长度信息h 2=Concat(LSTM→(l 1,l 2,…,l m),LSTM←(l 1,l 2,…,l m));其中l i表示数据包的长度,Concat代表将两个向量拼接。
S60:以网络流量数据包的特征表示h 1和长度信息h 2作为分类层的输入,通过对特征表示h 1和长度信息h 2进行融合以及Softmax分类,输出各个网络流量数据包的流量识别结果;
本步骤中,分类层对特征表示h 1和长度信息h 2的融合过程具体包括:
S61:对时序层中的h 1进行全连接和Softmax分类,得到预测值γ 1
Figure PCTCN2020127102-appb-000006
并计算其交叉熵损失函数值loss 1;其中,W、b是神经网络待学习的参数。
S62:对补充层中的h 2进行全连接和Softmax分类,得到预测值γ 2
Figure PCTCN2020127102-appb-000007
并计算其交叉熵损失函数值loss 2
S63:对h 1、h 1进行拼接,得到h 3=Concat(h 1,h 2);
S64:对h 3进行全连接和Softmax分类,得到预测值γ 3
Figure PCTCN2020127102-appb-000008
Figure PCTCN2020127102-appb-000009
并计算其交叉熵损失函数值loss 3
S65:计算三个损失函数值之和
Figure PCTCN2020127102-appb-000010
并根据计算结果采用梯度下降算法更新网络参数。
上述中,本申请实施例在分类层中对每一部分(h 1、h 2、h 3)均进行一次损失函数值的计算,并用三个损失函数值之和进行梯度下降更新网络参数,以保证神经网络学习到数据包的原始字节信息和长度信息,提高网络性能。
基于上述,本申请实施例的加密网络流量识别方法通过构建端到端的加密流量识别模型,在模型的预训练层,通过随机掩盖部分数据包字节内容并通过Transformer进行恢复的无监督预训练方法,可以很好地学习不同数据包之间的关联性,更好地表达网络流量字节,以达到更好地数据包编码能力;通过在数据包编码层补充数据包的长度信息,防止了在切割或填充阶段的长度信息丢失,尽可能地保持了数据包信息的完整性;在分类层中,通过分别对时序层中的特征表示、补充层中的长度信息以及特征表示和长度信息的融合分别进行一次损失函数值的计算,并用三个损失函数值之和进行梯度下降更新网络参数,以保证神经网络可以学习到数据包的原始字节信息和长度信息,提高网络性能。本申请使用端到端策略,不需要额外进行特征工程等操作,在保持数据包信息完整性的同时达到更好的加密流量识别效果。
请参阅图4,是本申请实施例的加密网络流量识别系统的结构示意图。本申请实施例的加密网络流量识别系统40包括:
预训练模块41:用于获取网络流量数据包,使用Transformer Encoder学习各个网络流量数据包字节内容之间的关联性,训练一个具有数据包编码能力的神经网络模型;
数据包编码模块42:用于通过所述神经网络模型对所述网络流量数据包的字节内容进行编码;
特征学习模块43:用于使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示;
长度学习模块44:用于使用双向LSTM学习各个网络流量数据包的长度信息;
融合及分类模块45:用于对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类,得到所述各个网络流量数据包的流量识别结果。
请参阅图5,为本申请实施例的终端结构示意图。该终端50包括处理器51、与处理器51耦接的存储器52。
存储器52存储有用于实现上述加密流量识别方法的程序指令。
处理器51用于执行存储器52存储的程序指令以控制加密流量识别。
其中,处理器51还可以称为CPU(Central Processing Unit,中央处理单元)。处理器51可能是一种集成电路芯片,具有信号的处理能力。处理器51还可以是通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
请参阅图6,为本申请实施例的存储介质的结构示意图。本申请实施例的存储介质存储有能够实现上述所有方法的程序文件61,其中,该程序文件61可以以软件产品的形式存储在上述存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施方式方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质,或者是计算机、服务器、手机、平板等终端设备。
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本申请中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本申请所示的这些实施例,而是要符合与本申请所公开的原理和新颖特点相一致的最宽的范围。

Claims (10)

  1. 一种加密流量识别方法,其特征在于,包括:
    获取网络流量数据包,使用Transformer Encoder学习各个网络流量数据包字节内容之间的关联性,训练一个具有数据包编码能力的神经网络模型;
    通过所述神经网络模型对所述网络流量数据包的字节内容进行编码;
    使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示,并使用双向LSTM学习各个网络流量数据包的长度信息;
    对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类,得到所述各个网络流量数据包的流量识别结果。
  2. 根据权利要求1所述的加密流量识别方法,其特征在于,所述训练一个具有数据包编码能力的神经网络模型前包括:
    搭建加密流量识别模型,所述加密流量识别模型包括预训练层、数据包编码层、时序层、补充层和分类层,在所述加密流量识别模型的预训练层训练所述神经网络。
  3. 根据权利要求2所述的加密流量识别方法,其特征在于,所述训练一个具有数据包编码能力的神经网络模型包括:
    将所有网络流量数据包按照相同的五元组:<源IP,目标IP,源端口,目标端口,传输协议>进行划分,每一组代表一个双向通信流;
    提取每个网络流量数据包在IP层以上的字节内容,并将提取的字节内容转换成16进制文件;
    按照设定比例分别对每个16进制文件中的字节内容进行随机掩盖,并分别 在每个文件头部加入[PACKET]标记;
    使用Transformer Encoder学习所述各个网络流量数据包字节内容之间的关联性,并恢复被掩盖的字节内容,使用交叉熵作为损失函数训练所述神经网络模型。
  4. 根据权利要求3所述的加密流量识别方法,其特征在于,所述通过所述神经网络模型对所述网络流量数据包的字节内容进行编码包括:
    在所述加密流量识别模型的数据包编码层,提取每个网络流量数据包在IP层以上的字节内容,并将提取的字节内容转换成16进制文件;
    分别在每个16进制文件的头部加入[PACKET]标记,并将每个16进制文件的字节内容切割或填充到预设长度;
    使用所述神经网络模型对每个16进制文件的字节内容分别进行编码后,使用各个[PACKET]标记所对应的向量作为对应网络流量数据包的向量表示。
  5. 根据权利要求4所述的加密流量识别方法,其特征在于,所述使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示包括:
    在所述加密流量识别模型的时序层,使用Transformer Encoder分别处理每个网络流量数据包的向量e i,使其融合其他网络流量数据包的信息,得到每个网络流量数据包的新的向量表示v i=Transformer(e i);
    对所述每个网络流量数据包的向量表示v i进行拼接,得到每个网络流量数据包的特征表示h 1=Concat(v 1,v 2,…,v m)W o;其中,W o是神经网络的权重矩阵,Concat代表将两个向量拼接。
  6. 根据权利要求2至5任一项所述的加密流量识别方法,其特征在于,所述使用双向LSTM学习各个网络流量数据包的长度信息包括:
    在所述加密流量识别模型的补充层,分别提取每个网络流量数据包的原始长度信息,构建长度序列:L={l 1,l 2,…,l m}={length(p 1),length(p 2),…,length(p m)};其中l i表示数据包的长度,p i代表第i个数据包,length()表示提取数据包的长度信息;
    使用双向LSTM对所述长度序列L进行学习,得到每个网络流量数据包的长度信息h 2=Concat(LSTM→(l 1,l 2,…,l m),LSTM←(l 1,l 2,…,l m)),其中l i表示数据包的长度,Concat代表将两个向量拼接。
  7. 根据权利要求6所述的加密流量识别方法,其特征在于,所述对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类包括:
    在所述加密流量识别模型的分类层,对所述时序层中的h 1进行全连接和Softmax分类,得到预测值γ 1
    Figure PCTCN2020127102-appb-100001
    并计算其交叉熵损失函数值loss 1;其中,W、b是神经网络待学习的参数;
    对所述补充层中的h 2进行全连接和Softmax分类,得到预测值γ 2
    Figure PCTCN2020127102-appb-100002
    并计算其交叉熵损失函数值loss 2
    将h 1、h 1进行拼接,得到h 3=Concat(h 1,h 2);
    对h 3进行全连接和Softmax分类,得到预测值γ 3
    Figure PCTCN2020127102-appb-100003
    Figure PCTCN2020127102-appb-100004
    并计算其交叉熵损失函数值loss 3
    计算loss 1、loss 2、loss 3之和
    Figure PCTCN2020127102-appb-100005
    并根据计算结果采用梯度下降算法更新所述加密流量识别模型的网络参数。
  8. 一种加密流量识别系统,其特征在于,包括:
    预训练模块:用于获取网络流量数据包,使用Transformer Encoder学习各个网络流量数据包字节内容之间的关联性,训练一个具有数据包编码能力的神经网络模型;
    数据包编码模块:用于通过所述神经网络模型对所述网络流量数据包的字节内容进行编码;
    特征学习模块:用于使用Transformer学习所述编码后的各个网络流量数据包之间的时序关系,获取各个网络流量数据包的特征表示;
    长度学习模块:用于使用双向LSTM学习各个网络流量数据包的长度信息;
    融合及分类模块:用于对所述各个网络流量数据包的特征表示和长度信息进行融合以及Softmax分类,得到所述各个网络流量数据包的流量识别结果。
  9. 一种终端,其特征在于,所述终端包括处理器、与所述处理器耦接的存储器,其中,
    所述存储器存储有用于实现权利要求1-7任一项所述的加密流量识别方法的程序指令;
    所述处理器用于执行所述存储器存储的所述程序指令以控制加密流量识别。
  10. 一种存储介质,其特征在于,存储有处理器可运行的程序指令,所述程序指令用于执行权利要求1至7任一项所述加密流量识别方法。
PCT/CN2020/127102 2020-11-06 2020-11-06 一种加密流量识别方法、系统、终端以及存储介质 WO2022094926A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/127102 WO2022094926A1 (zh) 2020-11-06 2020-11-06 一种加密流量识别方法、系统、终端以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/127102 WO2022094926A1 (zh) 2020-11-06 2020-11-06 一种加密流量识别方法、系统、终端以及存储介质

Publications (1)

Publication Number Publication Date
WO2022094926A1 true WO2022094926A1 (zh) 2022-05-12

Family

ID=81456919

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/127102 WO2022094926A1 (zh) 2020-11-06 2020-11-06 一种加密流量识别方法、系统、终端以及存储介质

Country Status (1)

Country Link
WO (1) WO2022094926A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115021986A (zh) * 2022-05-24 2022-09-06 中国科学院计算技术研究所 一种用于物联网设备识别可部署模型的构建方法与装置
CN115225731A (zh) * 2022-07-29 2022-10-21 中国人民解放军陆军工程大学 一种基于混合神经网络的在线协议识别方法
CN115242496A (zh) * 2022-07-20 2022-10-25 安徽工业大学 一种基于残差网络的Tor加密流量应用行为分类方法及装置
CN115277888A (zh) * 2022-09-26 2022-11-01 中国电子科技集团公司第三十研究所 一种移动应用加密协议报文类型解析方法及系统
CN115665286A (zh) * 2022-12-26 2023-01-31 深圳红途科技有限公司 接口聚类方法、装置、计算机设备及存储介质
CN115883263A (zh) * 2023-03-02 2023-03-31 中国电子科技集团公司第三十研究所 基于多尺度载荷语义挖掘的加密应用协议类型识别方法
CN115883401A (zh) * 2022-11-16 2023-03-31 华南师范大学 一种基于流交互图的端到端网络性能预测方法、系统及平台
CN116743349A (zh) * 2023-08-14 2023-09-12 数据空间研究院 一种Paillier密文求和方法、系统、装置和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831422A (zh) * 2019-01-17 2019-05-31 中国科学院信息工程研究所 一种基于端到端序列网络的加密流量分类方法
CN110730140A (zh) * 2019-10-12 2020-01-24 西安电子科技大学 基于时空特性相结合的深度学习流量分类方法
CN111737484A (zh) * 2020-05-15 2020-10-02 浙江工业大学 一种基于联合学习的警情知识图谱构建方法
US20200322362A1 (en) * 2019-04-05 2020-10-08 Hoseo University Academic Cooperation Foundation Deep-learning-based intrusion detection method, system and computer program for web applications

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831422A (zh) * 2019-01-17 2019-05-31 中国科学院信息工程研究所 一种基于端到端序列网络的加密流量分类方法
US20200322362A1 (en) * 2019-04-05 2020-10-08 Hoseo University Academic Cooperation Foundation Deep-learning-based intrusion detection method, system and computer program for web applications
CN110730140A (zh) * 2019-10-12 2020-01-24 西安电子科技大学 基于时空特性相结合的深度学习流量分类方法
CN111737484A (zh) * 2020-05-15 2020-10-02 浙江工业大学 一种基于联合学习的警情知识图谱构建方法

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115021986A (zh) * 2022-05-24 2022-09-06 中国科学院计算技术研究所 一种用于物联网设备识别可部署模型的构建方法与装置
CN115242496A (zh) * 2022-07-20 2022-10-25 安徽工业大学 一种基于残差网络的Tor加密流量应用行为分类方法及装置
CN115242496B (zh) * 2022-07-20 2024-04-16 安徽工业大学 一种基于残差网络的Tor加密流量应用行为分类方法及装置
CN115225731B (zh) * 2022-07-29 2024-03-05 中国人民解放军陆军工程大学 一种基于混合神经网络的在线协议识别方法
CN115225731A (zh) * 2022-07-29 2022-10-21 中国人民解放军陆军工程大学 一种基于混合神经网络的在线协议识别方法
CN115277888A (zh) * 2022-09-26 2022-11-01 中国电子科技集团公司第三十研究所 一种移动应用加密协议报文类型解析方法及系统
CN115277888B (zh) * 2022-09-26 2023-01-31 中国电子科技集团公司第三十研究所 一种移动应用加密协议报文类型解析方法及系统
CN115883401A (zh) * 2022-11-16 2023-03-31 华南师范大学 一种基于流交互图的端到端网络性能预测方法、系统及平台
CN115665286A (zh) * 2022-12-26 2023-01-31 深圳红途科技有限公司 接口聚类方法、装置、计算机设备及存储介质
CN115883263A (zh) * 2023-03-02 2023-03-31 中国电子科技集团公司第三十研究所 基于多尺度载荷语义挖掘的加密应用协议类型识别方法
CN115883263B (zh) * 2023-03-02 2023-05-09 中国电子科技集团公司第三十研究所 基于多尺度载荷语义挖掘的加密应用协议类型识别方法
CN116743349B (zh) * 2023-08-14 2023-10-13 数据空间研究院 一种Paillier密文求和方法、系统、装置和存储介质
CN116743349A (zh) * 2023-08-14 2023-09-12 数据空间研究院 一种Paillier密文求和方法、系统、装置和存储介质

Similar Documents

Publication Publication Date Title
WO2022094926A1 (zh) 一种加密流量识别方法、系统、终端以及存储介质
Wang The applications of deep learning on traffic identification
US11425047B2 (en) Traffic analysis method, common service traffic attribution method, and corresponding computer system
Dong et al. CETAnalytics: Comprehensive effective traffic information analytics for encrypted traffic classification
CN105162626B (zh) 基于众核处理器的网络流量深度识别系统及识别方法
WO2018175162A1 (en) Hardware-accelerated payload filtering in secure communication
CN112104570A (zh) 流量分类方法、装置、计算机设备和存储介质
Lin et al. A novel multimodal deep learning framework for encrypted traffic classification
CN111611280A (zh) 一种基于cnn和sae的加密流量识别方法
Wu et al. Tdae: Autoencoder-based automatic feature learning method for the detection of dns tunnel
CN113676348A (zh) 一种网络通道破解方法、装置、服务器及存储介质
CN103780501A (zh) 一种不可分小波支持向量机的对等网络流量识别方法
CN112491894A (zh) 一种基于时空特征学习的物联网网络攻击流量监测系统
Li et al. Transfer-learning-based network traffic automatic generation framework
Meng et al. Packet representation learning for traffic classification
CN114584522A (zh) 一种物联网设备的识别方法、系统、介质及终端
CN114448905B (zh) 一种加密流量识别方法、系统、终端以及存储介质
US11005764B2 (en) Methods and systems for transmission control protocol (TCP) communications
CN116248530A (zh) 一种基于长短时神经网络的加密流量识别方法
Meddahi et al. SIP-GAN: Generative Adversarial Networks for SIP traffic generation
CN114205151A (zh) 基于多特征融合学习的http/2页面访问流量识别方法
Mao et al. Semisupervised Encrypted Traffic Identification Based on Auxiliary Classification Generative Adversarial Network.
Jie et al. Timely traffic identification on P2P streaming media
Ge et al. Robot communication: Network traffic classification based on deep neural network
CN111835720B (zh) 基于特征增强的vpn流量web指纹识别方法

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20960387

Country of ref document: EP

Kind code of ref document: A1

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20960387

Country of ref document: EP

Kind code of ref document: A1