A method and device for identifying and extracting encrypted traffic based on FPGA

Encrypted traffic identification and feature extraction are implemented through FPGA, and the third-order hybrid hashing method and dynamic load information complexity calculation are used to solve the problem of low efficiency of encrypted traffic processing in the existing technology and achieve rapid identification and feature extraction of encrypted traffic. , adapted to the real-time needs of the network environment.

CN118316603BActive Publication Date: 2024-10-18NANJING UNIV OF INFORMATION SCI & TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410720699.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-10-18
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

Existing technology cannot quickly and effectively perform preliminary differentiation and feature information extraction of encrypted traffic, resulting in low efficiency in processing encrypted traffic in a network environment and failure to meet real-time requirements.

Method used

The FPGA-based encrypted traffic identification and feature extraction method is used to quickly map the quintuple of data packets through the third-order mixed hashing method, and the dynamic load information complexity calculation and voting mechanism are used to mark the encrypted flow and extract the characteristic information of the encrypted traffic. .

Benefits of technology

It significantly improves the speed and efficiency of encrypted traffic identification, adapts to the immediate needs of the actual network environment, and provides effective support for subsequent encrypted traffic processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118316603B_ABST
    Figure CN118316603B_ABST
Patent Text Reader

Abstract

The present invention discloses an encrypted traffic identification and feature extraction method and device based on FPGA. The method comprises: collecting continuous Ethernet data packets at a traffic collection position, assigning a unique label to each data packet, and storing the data packet in a designated BRAM buffer according to the label; parsing the header field of the data packet in the buffer, including the load length and the five-tuple field, mapping the five-tuple data to the encrypted traffic flow table by a three-order bit mixed hash method, and outputting the load length; calculating the load information complexity of the data packet by a dynamic load information complexity calculation method according to the load length; calculating the encrypted flow confidence value according to the load information complexity of the data packet, and screening out the encrypted flow by a voting mechanism; and performing information parsing and feature extraction on the screened encrypted flow. The present invention improves the uniformity and efficiency of mapping by a three-order bit mixed hash method, and significantly improves the recognition efficiency of encrypted traffic by utilizing the efficient parallel processing capability of FPGA.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network traffic processing and hardware accelerated computing, and in particular to an encrypted traffic identification and feature extraction method and device based on FPGA (Field Programmable Gate Array). Background Art

[0002] With the rapid development of network technology and the increasing number of network security threats, encrypted communication has become a common means of protecting data transmission security. However, the increase in encrypted traffic has also brought new challenges to network traffic management, monitoring and security analysis. Especially in the identification and analysis of encrypted traffic, the traditional software-based method of identifying and extracting features of encrypted traffic faces problems such as slow processing speed, poor real-time performance and high resource consumption. Given that the analysis of encrypted traffic depends largely on the feature information extracted in the encrypted traffic preprocessing stage, real-time and efficient encrypted traffic identification and feature extraction has become a key link in improving the efficiency of encrypted traffic identification and analysis.

[0003] Under the current technical background, the identification and feature extraction tasks for encrypted traffic mainly rely on software implementation. Although this approach is effective to a certain extent, it consumes a lot of central processing unit (CPU) resources, and the processing speed often cannot meet the needs of the actual network environment, thus affecting the efficiency of encrypted traffic processing tasks. For example, the Chinese invention patent "A malicious encrypted traffic detection method (publication number: CN116708003A, publication date: 2023.09.05)" discloses a malicious encrypted traffic detection method, which calculates the information entropy of the encrypted traffic and inputs it as a feature vector into a deep learning model composed of CNN-LSTM. The Chinese invention patent "A behavior recognition method, device and electronic device for encrypted traffic (publication number: CN116846643A, publication date: 2023.07.06)" discloses a behavior recognition method, device and electronic device for encrypted traffic, which focuses on extracting the features of encrypted traffic samples and inputting them into an optimized recognition model. These inventions train deep learning models through software, which does improve the accuracy of encrypted traffic recognition to a certain extent, but fail to fully consider the real-time requirements in actual network scenarios. The Chinese invention patent "A method and device for detecting malicious encrypted traffic (publication number: CN116112289A, publication date: 2023.04.10)" proposes another method and device for detecting malicious encrypted traffic. By calculating the rolling information entropy of the entire byte stream and constructing its curve to judge the encrypted traffic, the accuracy of identifying encrypted traffic is further improved. However, since the information entropy of the entire byte stream needs to be calculated, there are deficiencies in real-time performance.

[0004] Since the current technology has not yet solved the problem of rapid preliminary differentiation of encrypted traffic and extracting features such as packet length and time information to provide effective support for subsequent encrypted traffic processing tasks, a new method and device are needed to solve this problem. Summary of the invention

[0005] Purpose of the invention: The purpose of the present invention is to provide an encrypted traffic identification and feature extraction method and device based on FPGA, which utilizes the parallelism, programmability and pipeline characteristics of FPGA to quickly and preliminarily distinguish encrypted traffic and extract feature information of encrypted flow to provide effective support for subsequent encrypted traffic processing tasks.

[0006] Technical solution: In the first aspect, the present invention provides an encrypted traffic identification and feature extraction method based on FPGA, comprising the following steps:

[0007] Based on the continuous Ethernet data packets collected at the traffic collection location, each data packet is assigned a unique label, and the data packet is stored in a designated block random access memory BRAM buffer according to the label;

[0008] Parse the header field of the data packet in the buffer, including the payload length and five-tuple field, map the five-tuple data to the encrypted traffic flow table through the three-order bit mixed hash method, and output the payload length information. The encrypted traffic flow table is a hash table implemented by BRAM. If a flow is marked as an encrypted flow, the subsequent data packets can directly determine whether they are encrypted traffic data packets based on the hash mapping of the five-tuple;

[0009] According to the payload length of the data packet, the dynamic payload information complexity calculation method is used to calculate the payload information complexity of data packets of different lengths, wherein if the payload length is greater than a specified number of bytes, it is truncated to a fixed specified number of bytes, and the payload information complexity of the data packet is calculated using a table lookup method; if the payload length is less than a specified number of bytes, the payload is padded with 0 to obtain a specified number of byte values, and the payload information complexity of the data packet is calculated using a table lookup method based on the payload information complexity error between padded with 0 and not padded with 0 calculated in advance;

[0010] The encrypted flow confidence value is calculated according to the distribution of the load information complexity of the data packet, and the encrypted flow is screened out using a voting mechanism based on the encrypted flow confidence value;

[0011] For the filtered encrypted flows, data packets are extracted by flow according to the encrypted traffic flow table, and information of the data packets is parsed to extract features.

[0012] Furthermore, the quintuple includes a source IP address, a destination IP address, a source port number, a destination port number, and a transport protocol.

[0013] Furthermore, the five-tuple data is mapped to the encrypted traffic flow table through a three-order bit mixed hash method, and the load length information is output. The parsed content includes:

[0014] Parse the header fields of the data packet, including the 32-bit source IP address, 32-bit destination IP address, 16-bit source port number, 16-bit destination port number, 8-bit transport protocol, and 16-bit payload length information;

[0015] Divide the 96 bits in the header field containing the source IP address, destination IP address, source port number, and destination port number into three 32-bit values ​​and add a predefined constant value to each of them. 0xdeadbefb Get three values ​​and add a fixed value to the first two values initval Form the initialized A and B, and add 8 bits of transmission protocol to the third value Protocol Form an initialized C;

[0016] The values ​​of A, B, and C are mixed in three stages, including circular shift, XOR, and subtraction operations. The first stage of mixing obtains C1, A1, and B1. The second stage of mixing obtains C2, A2, and B2. The third stage of mixing obtains C3, A3, and B3.

[0017] The C3 and B3 mixed in the third stage are subjected to cyclic shift, XOR and subtraction operations to obtain the final hash value.

[0018] Furthermore, the initialization methods of A, B, and C are expressed as follows:

[0019] ,

[0020] Wherein, Metadata represents the data of the five-tuple in the header field, [] represents the bit value of the corresponding range; Metadata[31:0] represents the 32-bit source IP address, Metadata[63:32] represents the 32-bit destination IP address, and Metadata[95:64] represents the 32-bit data consisting of the 16-bit source port number and the 16-bit destination port number;

[0021] The mixed operation of the values ​​of A, B, and C is performed in three stages as follows:

[0022] ,

[0023] Among them, rot(j,k) means to circularly shift j to the right by k positions. Represents exclusive OR.

[0024] Furthermore, the dynamic load information complexity calculation method calculates the load information complexity of data packets of different lengths including:

[0025] N represents the specified number. If the payload length of a data packet is greater than N bytes, a number of bytes are randomly offset and the data packet is truncated into a fixed N bytes. The truncated N bytes are divided into multiple channels. An identical hash function is used to map each byte value that appears in the data bit width arriving in each clock cycle into a hash table for parallel counting. The hash table contains the corresponding byte value and the number of times the byte value appears. Based on the number of times each byte value appears, a table lookup method is used to calculate the payload information complexity of the data packet.

[0026] If the payload length of the data packet is less than N bytes, the payload is padded with 0 to obtain N byte values, and the N byte values ​​obtained by padded with 0 are divided into multiple channels. The identical hash function is used to map each byte value appearing in the data bit width arriving in each clock cycle into a hash table for parallel counting. The hash table contains the corresponding byte value and the number of times the byte value appears. According to the counted number of times each byte value appears and the load information complexity error between padded with 0 and not padded with 0 calculated in advance, the load information complexity of the data packet is calculated using a table lookup method.

[0027] Further, calculating the encryption flow confidence value according to the distribution of the load information complexity of the data packet includes:

[0028] Calculate the mean and three times the standard deviation based on the previously counted payload information complexity data set of a specified number of bytes;

[0029] According to the calculated load information complexity falling into the normal distribution position, an encryption flow confidence value is obtained.

[0030] Furthermore, the encrypted stream is screened out using a voting mechanism according to the encrypted stream confidence value, including: determining whether the sum of the encrypted stream confidence values ​​of the first M data packets exceeds a set encrypted stream discrimination threshold, and if so, marking the corresponding stream as an encrypted stream.

[0031] In a second aspect, the present invention provides an encrypted traffic identification and feature extraction device based on FPGA, comprising:

[0032] A data packet collection module, used for collecting continuous Ethernet data packets at a flow collection location;

[0033] A data packet buffer module is used to store the collected data packets in a block random access memory BRAM buffer zone which is pre-configured by the FPGA and includes a plurality of storage slots, and each data packet in the buffer zone is assigned a unique label;

[0034] The data packet parsing module is used to parse the header field of the data packet in the buffer, including the payload length and the five-tuple field, map the five-tuple data to the encrypted traffic flow table through the three-order bit mixed hash method, and output the payload length information. The encrypted traffic flow table is a hash table implemented by BRAM. If a flow is marked as an encrypted flow, the subsequent data packets can directly determine whether they are encrypted traffic data packets based on the hash mapping of the five-tuple;

[0035] The data packet load information complexity calculation module is used to calculate the load information complexity of data packets of different lengths according to the load length of the data packet using a dynamic load information complexity calculation method, wherein if the load length is greater than a specified number of bytes, the data packet is truncated into a fixed specified number of bytes, and the load information complexity is calculated using a table lookup method; if the load length is less than a specified number of bytes, the load is padded with 0 to obtain a specified number of byte values, and the load information complexity is calculated using a table lookup method based on the load information complexity error between padded with 0 and not padded with 0 calculated in advance;

[0036] The encryption flow screening module is used to calculate the encryption flow confidence value according to the distribution of the load information complexity of the data packet, and screen out the encryption flow by using a voting mechanism according to the encryption flow confidence value;

[0037] The encrypted traffic feature extraction module is used to extract data packets by flow according to the encrypted traffic flow table for the filtered encrypted flows, perform information analysis on the data packets, and extract features.

[0038] In a third aspect, the present invention further provides an FPGA device, characterized in that it comprises: an FPGA chip, one or more Ethernet interfaces; the Ethernet interface is used for external data transmission, and one or more programs are stored in the FPGA chip, and when the program is executed by the processor, the steps of the FPGA-based encrypted traffic identification and feature extraction method as described in the first aspect of the present invention are implemented.

[0039] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the FPGA-based encrypted traffic identification and feature extraction method as described in the first aspect of the present invention.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] (1) Current technology cannot quickly and effectively perform preliminary identification of encrypted traffic and extract feature information, which is an urgent need in the processing of encrypted traffic in cyberspace. The present invention uses a three-order bit mixed hashing method to quickly map the five-tuple of the data packet, and optimizes traffic processing by maintaining an encrypted traffic flow table. In addition, the data packet load information complexity is quickly calculated through a dynamic load information complexity calculation method, and the encrypted flow is marked through a voting mechanism for encrypted flow identification, and the relevant features of the encrypted traffic are extracted. This not only provides effective support for the further processing of encrypted traffic, but also plays a vital role in the field of encrypted traffic processing.

[0042] (2) From the perspective of real-time performance, the present invention adopts a voting mechanism for encrypted flow identification. When the encryption confidence of the current M data packets exceeds the encrypted flow identification threshold, the flow is marked as encrypted flow. This method not only significantly improves the speed of identification, but also better adapts to the real-time requirements for encrypted flow processing in actual network environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 This is a flow chart of the encrypted traffic identification and feature extraction method based on FPGA;

[0044] Figure 2 A schematic diagram of collecting data packets at a traffic collection location and storing them in a buffer;

[0045] Figure 3 A schematic diagram of counting byte values ​​through an identity hash function;

[0046] Figure 4 It is a schematic diagram of the overall structure of the encrypted traffic identification and feature extraction device based on FPGA;

[0047] Figure 5 The figure is an effect diagram of the actual application of the method and device of the present invention. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings.

[0049] In today's digital network environment, with the popularity of encryption technology and the continuous evolution of network attacks, the processing of encrypted traffic has become an important challenge in the field of network security. Encrypted communication plays a key role in protecting user privacy and data security. At the same time, it has become an ideal tool for network attackers to hide their malicious activities. Although traditional network security technologies have improved the accuracy of encrypted traffic identification, they cannot meet the needs of real-time identification and analysis of encrypted traffic in high-speed network scenarios. In many cases, network administrators need to detect potential threats as early as possible before encrypted traffic passes through the network and take corresponding defensive measures. This ability to quickly identify and extract features is essential for protecting critical infrastructure, defending against network attacks, and responding to security threats in a timely manner. By analyzing patterns and anomalies in encrypted traffic, these systems can identify potential malicious activities, such as botnet communications or malware propagation. Even if the data is encrypted, features such as the time pattern of the traffic, the size of the traffic, and the target server can be effectively detected. Enterprises can use encrypted traffic features to identify and block the illegal transmission of sensitive data (such as credit card information, personal identity information, etc.). Feature extraction helps identify encrypted traffic that may contain sensitive information, even if the content is not directly inspected. By identifying the types of encrypted traffic in the network (such as video, VoIP, or file transfer), administrators can optimize network resource allocation and improve network efficiency. For example, a traffic management system can adjust bandwidth allocation by analyzing traffic characteristics to ensure that the performance of key applications is not affected. Therefore, rapid identification and feature extraction of encrypted traffic is of great significance, especially in improving network security and efficiency.

[0050] Reference Figure 1 The present invention provides an encrypted traffic identification and feature extraction method based on FPGA. The method is implemented on FPGA, and its main steps are: collecting continuous Ethernet data packets at a traffic collection position, assigning a unique label to each data packet, and storing the data packet in a specified BRAM buffer according to the label; parsing the header field of the data packet in the buffer, including the load length and the five-tuple field, mapping the five-tuple data to the encrypted traffic flow table through a three-order bit mixed hash method, and outputting the load length; according to the parsed load length, using a dynamic load information complexity calculation method to calculate the load information complexity of data packets with different load lengths; calculating the encrypted flow confidence value according to the load information complexity of the data packet, using a voting mechanism to screen out the encrypted flow, and performing in-depth feature information analysis on the encrypted flow, including but not limited to the length and time information of the encrypted traffic data packet.

[0051] In the embodiment of the present invention, the specific steps of the method are as follows:

[0052] Step S1: Collect continuous Ethernet data packets at the traffic collection location, assign a unique label to each data packet, and store the data packet in a specific BRAM buffer according to the label. The buffer provides a 2KB storage space for each data packet, which is conducive to improving the uniqueness and integrity of the data packet.

[0053] The data packets collected in Ethernet are collected at the traffic collection location using Xilinx's official 10G / 25G EthernetSubsystem IP core, which can implement 10Gbps and 25Gbps high-speed physical layer and data link layer interfaces, and provide AXI-Stream interface to interact with FPGA user logic. The 10G / 25G Ethernet Subsystem IP core mainly includes three parts: PMA (Physical Medium Attachment), PCS (Physical Coding Sublayer), and MAC (Medium Access Control).

[0054] The physical medium layer (PMA) realizes physical medium signal transmission through the Serializer / Deserializer (SerDes) technology. PMA uses the clock data recovery mechanism to recover the serial clock from the serial data transmitted by the optical module and convert it into 156.25MHz parallel data, which is equivalent to a line rate of 10.3125Gbps. When sending data, PMA serializes the data of the physical coding layer and transmits it to the optical module.

[0055] The physical coding layer (PCS) is responsible for completing data encoding, decoding, error detection and other functions. PCS uses 8b / 10b, 128b / 130b and other encoding methods, and improves the reliability of data during physical transmission through coding redundancy. PCS and MAC are connected through the XGMII interface, and the XGMII interface transmits complete Ethernet frames.

[0056] The media access control layer (MAC) consists of a data transmission module, a flow control module, and MAC configuration and status. In the sending operation, the MAC layer is responsible for receiving Ethernet frames from the upper layer, calculating and adding the frame check sequence (FCS), and appending the preamble and frame interval to generate a complete MAC frame. These frames are encoded by the physical coding layer (PCS) and serialized by the physical medium layer (PMA) before being sent out through the physical medium. In the receiving operation, the MAC layer processes the data from the physical layer, removes the preamble and frame interval, verifies the FCS to ensure data integrity, and then removes the FCS and passes the purified Ethernet frame to the upper layer. This series of processing ensures the accurate transmission and effective reception of data in Ethernet, allowing the user side to prepare for the next step of data processing.

[0057] According to an embodiment of the present invention, referring to Figure 2 , collect continuous Ethernet data packets at the traffic collection location, assign a unique idle label from the label management list, and store the data packets in a specific data packet buffer.

[0058] The packet buffer consists of slots of 2KB in size. During the packet transmission process, when a packet is too large to be transmitted at one time, it must be fragmented and transmitted in several pieces, and then reassembled at the receiving end. The maximum transmission unit (MTU) specified by Ethernet is 1500 bytes, so the size of the buffer slot is set to 2KB to better accommodate each individual packet.

[0059] Before a data packet enters the buffer, the label management list will assign it an idle label, which is currently unique. The unique label is the basis for subsequent on-demand data packet retrieval from the buffer. This process avoids large-scale transmission of data packets in the device and reduces resource usage. Figure 2 As shown in the figure, ①②③ in the figure refer to the unique labels assigned by the label management list to the data packets stored in the data packet buffer. The subsequent processing module can take out the data packet according to the label, and the data packet buffer module can store the data packet according to the label, which is convenient for data packet management. The labels in the label management list can be reused. When a data packet is processed and needs to be released, the corresponding data packet label will be released. The released data packet label is regarded as an idle label and will continue to be assigned to the subsequent data packets entering the buffer.

[0060] Step S2: Parse the header field of the data packet in the buffer, including the payload length and the five-tuple field. The five-tuple includes the source IP address, the destination IP address, the source port number, the destination port number, and the transport protocol. Use a three-order bit mixed hash method to map the five-tuple data to the encrypted traffic flow table and output the payload length information. The encrypted traffic flow table is a hash table implemented by BRAM. If a flow is marked as an encrypted flow, the subsequent data packets can directly determine whether they are encrypted traffic data packets based on the hash mapping of the five-tuple.

[0061] Through step S2, 104 bits of five-tuple information and payload length information can be parsed. The five-tuple includes the source IP address, destination IP address, source port number, destination port number, and protocol type. The corresponding parts are as follows:

[0062] Source IP address and destination IP address: The IP header of the IP data packet includes two fields: source IP address and destination IP address. Each field occupies 4 bytes, for a total of 8 bytes.

[0063] Source port number and destination port number: In the TCP or UDP header of a TCP or UDP data packet, there are two fields, the source port number and the destination port number. For the TCP header, the source port number and the destination port number each occupy 2 bytes, a total of 4 bytes; for the UDP header, the source port number and the destination port number each occupy 2 bytes, a total of 4 bytes.

[0064] Protocol type: In the IP header of an IP datagram, there is a protocol type field, which indicates the type of upper layer protocol encapsulated in the IP datagram and occupies 1 byte. If the TCP protocol is encapsulated in the IP datagram, the protocol type field is 6; if the UDP protocol is encapsulated in the IP datagram, the protocol type field is 17.

[0065] Payload length: In the IP header of an IP data packet, there is a header length field and a total length field. The total length field is a 16-bit field in the IP message that indicates the length of the entire IP message, including the header and data. The unit of this length is bytes. The length of the IP header is not fixed because it may contain optional fields. The header length field is located in the header of the IP message and is usually expressed in units of 32 bits (4 bytes). This field is usually expressed as how many 32-bit words are in the header, so the actual number of bytes requires multiplying the field value by 4. Therefore, the payload length of the data packet is the total length minus the header length (in bytes). This calculation gives the actual number of bytes contained in the data portion of the IP message, that is, the portion remaining after removing the header. This is particularly important for network analysis and processing, especially when it is necessary to process or inspect the content of the transmitted data.

[0066] According to an embodiment of the present invention, a three-order bit-mixed hashing method in step S2 includes the following steps:

[0067] S201: Parse the header fields of the data packet, including 32-bit source IP address, 32-bit destination IP address, 16-bit source port number, 16-bit destination port number, 8-bit transport protocol, and 16-bit payload length information;

[0068] S202: Divide the 96 bits in the header field including the source IP address, the destination IP address, the source port number, and the destination port number into three 32-bit values ​​and add a defined constant value 0xdeadbefb to obtain three values ​​A0, B0, and C0, then add a fixed initval to A0 and B0 to complete the initialization of A and B, and finally add the 8-bit transmission protocol to C0 to complete the initialization of C;

[0069] S203: Mixing the values ​​of A, B, and C in three stages, including circular shift, XOR, and subtraction operations, to improve the hashability of the hash and reduce the probability of hash collision;

[0070] S204: Perform cyclic shift, XOR and subtraction operations on C3 and B3 obtained by mixing in the third stage to obtain a final hash value.

[0071] According to an embodiment of the present invention, a three-order bit mixed hash method calculation process in step S202 is as follows:

[0072] ,

[0073]

[0074] Among them, AC is the initialization step, 0xdeadbefb is a defined constant value, and initval is a variable starting point introduced. The value is different for different scenarios, which can improve the flexibility of calculation. Metadata[31:0] represents the 32-bit source IP address, Metadata[63:32] represents the 32-bit destination IP address, and Metadata[95:64] represents the 32-bit data composed of the 16-bit source port number and the 16-bit destination port number. C1-B1 is the first stage of mixing, C2-B2 is the second stage of mixing, and C3-B3 is the third stage of mixing. Among them, rot(j,k) means to shift j to the right by k bits. The number of shifted bits k is a value obtained by a large number of experiments that can make the final hash result have better hashability. Finally, the hash value is obtained through XOR, shift and subtraction operations. According to the obtained hash value, the five-tuple information of the data packet can be mapped to the encrypted traffic flow table of the corresponding address.

[0075] Step S3: Based on the parsed payload length, if the payload length is greater than 256 bytes, it is truncated to a fixed 256 bytes, and the payload information complexity of the data packet is calculated using a table lookup method.

[0076] According to an embodiment of the present invention, step S3 specifically includes the following steps:

[0077] S301: Determine the payload length parsed in step S2. If the payload length of the data packet is greater than 256 bytes, randomly offset a few bytes and truncate the data packet into a fixed 256 bytes.

[0078] S302: Divide the truncated 256 bytes into multiple channels, such as Figure 3 As shown, the identity hash function h(x)=x is used to map each byte value appearing in the data bit width arriving in each clock cycle into a hash table for parallel counting, and the hash table contains the corresponding byte value and the number of times the byte value appears. The x refers to the corresponding 8-bit byte value. For example, the byte value corresponding to 00000001 is 1. For the payload data with a data bit width of 64 bits, it can be divided into 8 channels, and the number of times the corresponding 8 8-bit byte values ​​in the 64-bit payload data appear in each clock cycle is counted;

[0079] S303: Calculate the load information complexity of the entire data packet using a table lookup method based on the number of occurrences of the byte value counted. The load information complexity stored in the table can be calculated by Get, where i is each possible byte value, and z is the number of times the corresponding byte value appears in 256 bytes.

[0080] Step S4: For data packets with a payload length less than 256 bytes, fill with 0 to a fixed 256 bytes, and use a table lookup method to estimate the payload information complexity of the data packet, taking into account the error between the actual payload information complexity and the payload information complexity.

[0081] According to an embodiment of the present invention, step S4 specifically includes the following steps:

[0082] S401: For a data packet whose payload length is less than 256 bytes, the payload is padded with 0 to obtain a 256-byte value;

[0083] S402: Divide the 256-byte value obtained by adding 0 into multiple channels, such as Figure 3As shown, the identity hash function h(x)=x is used to map each byte value appearing in the data bit width arriving in each clock cycle into a hash table for parallel counting, and the hash table contains the corresponding byte value and the number of times the byte value appears. The x refers to the corresponding 8-bit byte value. For the payload data with a data bit width of 64 bits, it can be divided into 8 channels, and the number of times the corresponding 8 8-bit byte values ​​in the 64-bit payload data appear in each clock cycle is counted;

[0084] S403: Based on the number of times the byte value appears, a table lookup method is used to quickly calculate the value of the logarithmic function. For the 256 byte values ​​obtained after 0-padding, the load information complexity is lower than the load information complexity corresponding to the actual load length. When using the table lookup method, the error between the load information complexities of the two needs to be considered. The load information complexity calculated after 0-padding for different load lengths is added with the error between 0-padding and non-0-padding for different load lengths obtained by multiple experiments in advance to obtain the load information complexity corresponding to the actual load length. The error is calculated in advance, and the corresponding load information complexity stored in the lookup table is the load information complexity after the error is added.

[0085] Step S5: Calculate the encrypted flow confidence value according to the load information complexity of the data packet, and use a voting mechanism for encrypted flow identification to screen out the encrypted flow. If the sum of the encrypted flow confidence values ​​of the current five data packets exceeds the set encrypted flow identification threshold, the flow is marked as an encrypted flow.

[0086] According to an embodiment of the present invention, step S5 specifically includes the following steps:

[0087] S501: Based on a large number of encrypted traffic data packets with different payload lengths collected in advance, multiple experiments are conducted to obtain a payload information complexity data set with a payload length of 256 bytes and a normal distribution, and the mean μ and 3 times the standard deviation are calculated. ;

[0088] S502: Calculate the position of the normal distribution according to the load information complexity obtained in step S3 and step S4, and obtain an encrypted stream confidence value;

[0089] S503: Based on the encryption flow confidence values ​​of the first M data packets, a voting mechanism for encryption flow identification is used to screen the encryption flow. In the embodiment of the present invention, if the sum of the encryption flow confidence values ​​of the current five data packets exceeds the set encryption flow identification threshold, the flow is marked as an encryption flow.

[0090] Step S6: Perform in-depth analysis of the characteristic information of the screened encrypted stream, including but not limited to packet length, time information such as the time interval between packets, traffic direction such as uplink or downlink, statistical characteristics such as average packet size, standard deviation, maximum packet length, minimum packet length and other characteristic information.

[0091] In step S6, specific characteristic information needs to be extracted from the continuous data stream, but the reception of data packets is usually not strictly carried out in the order of a single stream. This means that data packets from different streams may be received at the same time during processing. For example, the first data packet of the first stream may be received first, followed by the first data packet of the second stream, and then the second data packet of the first stream, and so on. Since different streams may contain different information, some of them may be judged as encrypted streams while others are not. Therefore, in order to effectively process data, it is necessary to establish an encrypted traffic flow table. Through this flow table, data packets that are judged to be encrypted streams can be identified and tracked. For example, if the first stream is judged to be an encrypted stream and the second stream is not, the data packets of the first stream are preferentially processed according to the flow table. In this way, the first data packet of the first stream can be extracted and analyzed first, followed by its second data packet, while the data packets of the second stream are ignored. In this way, those important data streams can be analyzed more targeted, thereby improving processing efficiency and accuracy, and in-depth analysis of characteristic information.

[0092] Based on the same technical concept as the method embodiment, the present invention also provides an encrypted traffic identification and feature extraction device based on FPGA, such as Figure 4 As shown, it includes the following modules:

[0093] Data packet collection module, used for collecting data packets in Ethernet;

[0094] The data packet buffer module is used to store the collected data packets in a buffer pre-configured by the FPGA, which contains multiple 2KB storage slots. Each data packet in the buffer is assigned a free label to ensure that only unique data packets are stored. This buffer is conducive to improving the uniqueness and integrity of data packets;

[0095] The data packet parsing module is used to parse the header field of the data packet in the buffer, including the load length and five-tuple fields, including the source IP address, destination IP address, source port number, destination port number, and transport protocol. The five-tuple data is mapped to the encrypted traffic flow table through a three-order bit mixed hash method, and the load length information is output. The encrypted traffic flow table is a hash table implemented by BRAM. If a flow is marked as an encrypted flow, the subsequent data packets can directly determine whether it is an encrypted traffic data packet based on the hash mapping of the five-tuple;

[0096] The data packet load information complexity calculation module is used to calculate the load information complexity of each data packet. Specifically, the load length of the data packet is judged, and according to the different load lengths, the identical hash function is used to parallelly count the number of times each byte value appears, and the dynamic load information complexity calculation method is used to calculate the load information complexity of different data packet lengths. Specifically, if the load length is greater than 256 bytes, a number of bytes are randomly offset and the data packet is truncated into a fixed 256 bytes, and the load information complexity is calculated using a table lookup method. If the load length is less than 256 bytes, the load is padded with 0 to obtain a 256-byte value, and then the load information complexity is calculated using a table lookup method. The load information complexity obtained by this method takes into account the error between the load information complexity of the actual length and the load information complexity of the corresponding 256-byte value after padded with 0;

[0097] The encrypted flow screening module is used to screen out encrypted traffic. Specifically, the encrypted flow confidence value is calculated according to the load information complexity of the data packet, and a voting mechanism for encrypted flow discrimination is adopted. If the sum of the encrypted flow confidence values ​​of the current five data packets exceeds the set encrypted flow discrimination threshold, the flow is marked as encrypted flow;

[0098] The encrypted traffic feature extraction module is used to extract features from the screened encrypted traffic. Specifically, for the screened encrypted flow, data packets are extracted by flow according to the encrypted traffic flow table, and information on the data packets is analyzed to extract features, including but not limited to feature information such as data packet length and time information.

[0099] It should be understood that an FPGA-based encrypted traffic identification and feature extraction device in an embodiment of the present invention can implement all the technical solutions in the above-mentioned method embodiment, and the functions of its various functional modules can be specifically implemented according to the methods in the above-mentioned method embodiments. The specific implementation process can refer to the relevant description in the above-mentioned embodiments, which will not be repeated here.

[0100] like Figure 5 As shown, the final effect of using the FPGA-based encrypted traffic identification and feature extraction method and device of the present invention is: after collecting data packets in Ethernet, the method or device of the present invention can realize real-time identification of encrypted traffic data packets, quickly mark encrypted streams, and extract feature information of encrypted streams, including but not limited to packet length and time information. Finally, the extracted feature information is handed over to the CPU for the next step of encrypted traffic processing.

[0101] In addition, since the encrypted traffic identification and feature extraction tasks of the CPU are offloaded, the CPU can handle more important tasks, speeding up the data processing process in high-speed network scenarios and improving task processing efficiency.

[0102] The present invention also provides an FPGA device, which includes one or more 10G Ethernet interfaces; a GT transceiver; and an FPGA chip, wherein the FPGA device is configured to implement the steps of the FPGA-based encrypted traffic identification and feature extraction method as described above when executed. Among them, the Ethernet interface is mainly responsible for the physical layer reception and transmission of network data. In the method, the function of the Ethernet interface includes continuously receiving network traffic and providing the original data of the network data packet to the subsequent processing module. This is the first step in traffic collection to ensure seamless data acquisition from the physical level. GT transceivers (Gigabit Transceiver) are generally used for high-speed data transmission. In the FPGA chip, the GT transceiver is responsible for processing high-speed serial data communications, including but not limited to Ethernet data. They can very efficiently receive data from the Ethernet interface and convert the data into a format that the FPGA can process while maintaining the integrity and timing accuracy of the data. FPGA (Field Programmable Gate Array) chip is a highly flexible and configurable hardware device suitable for performing parallel data processing tasks. In the method, the functions of the FPGA chip include: buffering collected data packets; parsing buffered data packets; calculating the complexity of data packet load information; screening out encrypted flows according to a voting mechanism; extracting encrypted flow feature information; and maintaining an encrypted flow flow table.

[0103] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the FPGA-based encrypted traffic identification and feature extraction method as described above are implemented.

[0104] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods or apparatus products. Therefore, the present invention may take the form of a complete hardware embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of an FPGA product implemented on one or more of the FPGA chips, high-speed Ethernet interfaces, and GT transceivers.

Claims

1. A method for identifying and extracting encrypted traffic based on FPGA, characterized in that: The following steps are involved: Based on the continuous Ethernet data packets collected at the traffic collection location, each data packet is assigned a unique label, and the data packet is stored in a designated block random access memory BRAM buffer according to the label; Parse the header field of the data packet in the buffer, including the payload length and five-tuple field, map the five-tuple data to the encrypted traffic flow table through the three-order bit mixed hash method, and output the payload length information. The encrypted traffic flow table is a hash table implemented by BRAM. If a flow is marked as an encrypted flow, the subsequent data packets can directly determine whether they are encrypted traffic data packets based on the hash mapping of the five-tuple; According to the payload length of the data packet, the payload information complexity of data packets of different lengths is calculated using a dynamic payload information complexity calculation method, wherein if the payload length is greater than a specified number of bytes, it is truncated to a fixed specified number of bytes, and the payload information complexity of the data packet is calculated using a table lookup method; if the payload length is less than a specified number of bytes, the payload is padded with 0 to obtain a specified number of byte values, and the payload information complexity of the data packet is calculated using a table lookup method based on the payload information complexity error between padded with 0 and not padded with 0 calculated in advance; The encrypted flow confidence value is calculated according to the distribution of the load information complexity of the data packet, and the encrypted flow is screened out using a voting mechanism based on the encrypted flow confidence value; For the filtered encrypted flows, data packets are extracted by flow according to the encrypted traffic flow table, and information of the data packets is parsed to extract features; The five-tuple includes the source IP address, the destination IP address, the source port number, the destination port number, and the transport protocol. The five-tuple data is mapped to the encrypted traffic flow table through a three-order bit-mixed hash method, and the output payload length information includes: Parse the header fields of the data packet, including the 32-bit source IP address, 32-bit destination IP address, 16-bit source port number, 16-bit destination port number, 8-bit transport protocol, and 16-bit payload length information; Divide the 96 bits in the header field containing the source IP address, destination IP address, source port number, and destination port number into three 32-bit values ​​and add a predefined constant value to each of them. 0xdeadbefb Get three values ​​and add a fixed value to the first two values initval Form the initialized A and B, and add 8 bits of transmission protocol to the third value Protocol Form an initialized C; The values ​​of A, B, and C are mixed in three stages, including circular shift, XOR, and subtraction operations. The first stage of mixing obtains C1, A1, and B1. The second stage of mixing obtains C2, A2, and B2. The third stage of mixing obtains C3, A3, and B3. Perform cyclic shift, XOR and subtraction operations on C3 and B3 obtained by mixing in the third stage to obtain the final hash value; The initialization methods of A, B, and C are as follows: , Wherein, Metadata represents the data of the five-tuple in the header field, [] represents the bit value of the corresponding range; Metadata[31:0] represents the 32-bit source IP address, Metadata[63:32] represents the 32-bit destination IP address, and Metadata[95:64] represents the 32-bit data consisting of the 16-bit source port number and the 16-bit destination port number; The mixed operation of the values ​​of A, B, and C is performed in three stages as follows: , Among them, rot(j,k) means to circularly shift j to the right by k positions. Indicates exclusive OR; Dynamic payload information complexity calculation method The payload information complexity of data packets of different lengths is calculated by: N represents the specified number. If the payload length of a data packet is greater than N bytes, a number of bytes are randomly offset and the data packet is truncated into a fixed N bytes. The truncated N bytes are divided into multiple channels. An identical hash function is used to map each byte value that appears in the data bit width arriving in each clock cycle into a hash table for parallel counting. The hash table contains the corresponding byte value and the number of times the byte value appears. Based on the number of times each byte value appears, a table lookup method is used to calculate the payload information complexity of the data packet. If the payload length of the data packet is less than N bytes, the payload is padded with 0 to obtain N byte values, and the N byte values ​​obtained by padded with 0 are divided into multiple channels. The identical hash function is used to map each byte value appearing in the data bit width arriving in each clock cycle into a hash table for parallel counting. The hash table contains the corresponding byte value and the number of times the byte value appears. According to the counted number of times each byte value appears and the load information complexity error between padded with 0 and not padded with 0 calculated in advance, the load information complexity of the data packet is calculated using a table lookup method.

2. The method according to claim 1, characterized in that: The encryption flow confidence value is calculated based on the distribution of the payload information complexity of the data packet, including: Calculate the mean and three times the standard deviation based on the previously counted payload information complexity data set of a specified number of bytes; According to the calculated load information complexity falling into the normal distribution position, an encryption flow confidence value is obtained.

3. The method according to claim 1, characterized in that: The encrypted stream is screened out using a voting mechanism according to the encrypted stream confidence value, including: determining whether the sum of the encrypted stream confidence values ​​of the first M data packets exceeds a set encrypted stream discrimination threshold, and if so, marking the corresponding stream as an encrypted stream.

4. An encrypted traffic identification and feature extraction device based on FPGA, characterized in that: include: A data packet collection module, used for collecting continuous Ethernet data packets at a flow collection location; A data packet buffer module is used to store the collected data packets in a block random access memory BRAM buffer zone which is pre-configured by the FPGA and includes a plurality of storage slots, and each data packet in the buffer zone is assigned a unique label; The data packet parsing module is used to parse the header field of the data packet in the buffer, including the payload length and the five-tuple field, map the five-tuple data to the encrypted traffic flow table through the three-order bit mixed hash method, and output the payload length information. The encrypted traffic flow table is a hash table implemented by BRAM. If a flow is marked as an encrypted flow, the subsequent data packets can directly determine whether they are encrypted traffic data packets based on the hash mapping of the five-tuple; The data packet load information complexity calculation module is used to calculate the load information complexity of data packets of different lengths according to the load length of the data packet using a dynamic load information complexity calculation method, wherein if the load length is greater than a specified number of bytes, the data packet is truncated into a fixed specified number of bytes, and the load information complexity is calculated using a table lookup method; if the load length is less than a specified number of bytes, the load is padded with 0 to obtain a specified number of byte values, and the load information complexity is calculated using a table lookup method based on the load information complexity error between padded with 0 and not padded with 0 calculated in advance; The encryption flow screening module is used to calculate the encryption flow confidence value according to the distribution of the load information complexity of the data packet, and screen out the encryption flow by using a voting mechanism according to the encryption flow confidence value; The encrypted traffic feature extraction module is used to extract data packets by flow according to the encrypted traffic flow table for the filtered encrypted flows, perform information analysis on the data packets, and extract features; The five-tuple includes the source IP address, the destination IP address, the source port number, the destination port number, and the transport protocol. The data packet parsing module maps the five-tuple data to the encrypted traffic flow table through a three-order bit mixed hash method, and the output payload length information includes: Parse the header fields of the data packet, including the 32-bit source IP address, 32-bit destination IP address, 16-bit source port number, 16-bit destination port number, 8-bit transport protocol, and 16-bit payload length information; Divide the 96 bits in the header field containing the source IP address, destination IP address, source port number, and destination port number into three 32-bit values ​​and add a predefined constant value to each of them. 0xdeadbefb Get three values ​​and add a fixed value to the first two values initval Form the initialized A and B, and add 8 bits of transmission protocol to the third value Protocol Form an initialized C; The values ​​of A, B, and C are mixed in three stages, including circular shift, XOR, and subtraction operations. The first stage of mixing obtains C1, A1, and B1. The second stage of mixing obtains C2, A2, and B2. The third stage of mixing obtains C3, A3, and B3. Perform cyclic shift, XOR and subtraction operations on C3 and B3 obtained by mixing in the third stage to obtain the final hash value; The initialization methods of A, B, and C are as follows: , Wherein, Metadata represents the data of the five-tuple in the header field, [] represents the bit value of the corresponding range; Metadata[31:0] represents the 32-bit source IP address, Metadata[63:32] represents the 32-bit destination IP address, and Metadata[95:64] represents the 32-bit data consisting of the 16-bit source port number and the 16-bit destination port number; The mixed operation of the values ​​of A, B, and C is performed in three stages as follows: , Among them, rot(j,k) means to circularly shift j to the right by k positions. Indicates exclusive OR; The data packet load information complexity calculation module uses a dynamic load information complexity calculation method to calculate the load information complexity of data packets of different lengths, including: N represents the specified number. If the payload length of a data packet is greater than N bytes, a number of bytes are randomly offset and the data packet is truncated into a fixed N bytes. The truncated N bytes are divided into multiple channels. An identical hash function is used to map each byte value that appears in the data bit width arriving in each clock cycle into a hash table for parallel counting. The hash table contains the corresponding byte value and the number of times the byte value appears. Based on the number of times each byte value appears, a table lookup method is used to calculate the payload information complexity of the data packet. If the payload length of the data packet is less than N bytes, the payload is padded with 0 to obtain N byte values, and the N byte values ​​obtained by padded with 0 are divided into multiple channels. The identical hash function is used to map each byte value appearing in the data bit width arriving in each clock cycle into a hash table for parallel counting. The hash table contains the corresponding byte value and the number of times the byte value appears. According to the counted number of times each byte value appears and the load information complexity error between padded with 0 and not padded with 0 calculated in advance, the load information complexity of the data packet is calculated using a table lookup method.

5. An FPGA device, characterized in that: include: FPGA chip, one or more Ethernet interfaces; The Ethernet interface is used for external data transmission. One or more programs are stored in the FPGA chip. When the programs are executed by the processor, the steps of the FPGA-based encrypted traffic identification and feature extraction method as described in any one of claims 1 to 3 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the FPGA-based encrypted traffic identification and feature extraction method as described in any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Malicious encrypted traffic detection method and device

    CN116112289A

  • Malicious encrypted traffic detection method

    CN116708003A

  • Behavior recognition method and device for encrypted traffic and electronic equipment

    CN116846643A

  • High speed network data flow load balancing scheduling method based on field programmable gate array (FPGA)

    CN103139093A

  • Stacking-based multi-feature fusion malicious encrypted traffic identification method and device

    CN116346452A