Malicious encrypted traffic detection method and system based on multi-dimensional feature fusion

By fusing the characteristics of encrypted traffic data and handshake metadata in malicious encrypted traffic detection, and using the cross attention mechanism to generate fusion features, the problem of inefficiency in encrypted traffic detection is solved, and the accuracy of malicious traffic detection is improved and reliability.

CN118944932APending Publication Date: 2024-11-12CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411009219.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The prior art has low performance when detecting encrypted traffic, making it difficult to effectively identify malicious activities. It mainly relies on basic information and plain text features, and cannot fully utilize the characteristic information of encrypted traffic.

Method used

Using a multi-dimensional feature fusion method, through the fusion of encrypted traffic data and handshake metadata, encrypted traffic features and handshake metadata are extracted and combined, fusion features are generated using the cross attention mechanism, and a classification model is input to distinguish malicious encrypted traffic from normal encryption. flow.

Benefits of technology

It significantly improves the accuracy and reliability of malicious traffic detection, can comprehensively learn encrypted traffic characteristics from two different angles, and enhances the understanding and classification of encrypted traffic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118944932A_ABST
    Figure CN118944932A_ABST
Patent Text Reader

Abstract

The invention provides a malicious encrypted traffic detection method and system based on multi-dimensional feature fusion, and relates to the technical field of network and information security, and the method comprises the steps: obtaining encrypted traffic data and handshake metadata of a session between two devices; extracting an encrypted traffic feature from the encrypted traffic data of the session between the two devices, and extracting a handshake element feature from the handshake element data of the session between the two devices; and fusing the encrypted traffic feature and the handshake element feature to obtain a fused feature. Inputting the fusion features into a classification model, and outputting a classification result; wherein the classification model is used for distinguishing whether the traffic of the session between the devices is malicious encrypted traffic or normal encrypted traffic. According to the embodiment of the invention, the encrypted traffic data and the handshake metadata can be fused, the fused features are used for traffic classification, and the fusion mode can fully learn the encrypted traffic features from two different angles, so that the accuracy and reliability of malicious traffic detection are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network and information security technology, and in particular to a malicious encrypted traffic detection method and system based on multi-dimensional feature fusion. Background Art

[0002] With the development of Internet technology, data encryption technology has become increasingly popular, and the SSL / TLS protocol has become a standard solution for protecting network communication security. Encryption technology can effectively protect data from eavesdropping and tampering, but it also brings challenges to supervision and security detection. Especially in the field of network security, malware and attackers often use encrypted traffic to hide their activities.

[0003] In the field of encrypted traffic detection, existing technologies mainly rely on basic information such as IP addresses and ports, or plaintext features in the handshake process such as certificate information. These methods are effective when processing non-encrypted traffic, but are limited by the opacity of the data in encrypted traffic detection, and their efficiency is greatly reduced. Summary of the invention

[0004] The present invention provides a malicious encrypted traffic detection method and system based on multi-dimensional feature fusion, which utilizes encrypted traffic data and handshake metadata for fusion, and uses the fused features for traffic classification. This fusion method can fully learn the encrypted traffic features from two different angles, thereby enhancing the accuracy and reliability of malicious traffic detection.

[0005] In a first aspect, an embodiment of the present invention provides a malicious encrypted traffic detection method based on multi-dimensional feature fusion, comprising:

[0006] Get encrypted traffic data and handshake metadata of a conversation between two devices;

[0007] extracting encrypted traffic features from encrypted traffic data of a session between two devices, and extracting handshake meta-features from handshake metadata of a session between two devices;

[0008] Fusion the encrypted traffic feature and the handshake meta feature to obtain a fusion feature;

[0009] The fusion feature is input into a classification model, and a classification result is output; wherein the classification model is used to distinguish whether the traffic of a session between devices is malicious encrypted traffic or normal encrypted traffic.

[0010] The above method can obtain encrypted traffic data and handshake metadata, fuse the encrypted traffic data and handshake metadata to obtain fusion features, and use the fusion features to classify traffic to distinguish malicious encrypted traffic from normal encrypted traffic. This fusion method can fully learn encrypted traffic features from two different angles, thereby enhancing the accuracy and reliability of malicious traffic detection.

[0011] In a possible implementation, extracting encrypted traffic features from encrypted traffic data of a session between two devices includes:

[0012] Converting encrypted traffic data of a session between two devices into encrypted traffic data represented by a digital representation;

[0013] Compressing the encrypted traffic data represented by digits to obtain the encrypted traffic data represented by low-dimensional vectors;

[0014] The encrypted traffic data represented by the low-dimensional vector is reconstructed to obtain the encrypted traffic features.

[0015] The above method compresses the encrypted traffic data, thereby retaining the particularly significant features of the data, thereby providing valuable input for subsequent feature fusion and model classification, and improving the accuracy of traffic classification.

[0016] In one possible implementation, the handshake metadata includes multiple categories of metadata;

[0017] Extract handshake meta features from the handshake metadata of a session between two devices, including:

[0018] converting each category of metadata of a conversation between two devices into a digital representation of each category of metadata;

[0019] Extracting meta-features of each category from the metadata of each category represented digitally through an embedding encoder;

[0020] The meta-features of each category are combined to obtain the handshake meta-features.

[0021] The above method extracts handshake metadata features from metadata through an embedding encoder. This encoding method not only converts discrete category features into continuous dense vectors, but also captures and represents the potential relationship between different categories in the vector space. In addition, the feature vector trained by the embedding encoder can be directly used for subsequent feature fusion, which improves the computational efficiency.

[0022] In one possible implementation, each category of metadata of a conversation between two devices is converted into each category of metadata represented digitally, including:

[0023] An open source package is used to convert each category of non-digital representation of metadata for a conversation between two devices into each category of digital representation of metadata; or

[0024] Each category of metadata represented by non-digital expressions in a conversation between two devices is mapped to each category of metadata represented by digital expressions by using a preset mapping relationship between non-digital expressions and digits.

[0025] The above method can convert non-digital metadata into digital metadata by using an open source package or a mapping relationship between non-digital characters and numbers, so that feature vectors can be extracted from the digital metadata to facilitate feature extraction.

[0026] In a possible implementation, the encrypted traffic feature and the handshake meta feature are fused to obtain a fused feature, including:

[0027] Mapping the first feature through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix;

[0028] Determining a weight corresponding to a first feature according to the first query matrix, the first key matrix, and the first value matrix;

[0029] Map the second feature through two linear layers to obtain a second key matrix and a second value matrix;

[0030] Using the weight corresponding to the first feature as a second query matrix, obtaining the weight corresponding to the second feature according to the second query matrix, the second key matrix and the second value matrix, and using the weight corresponding to the second feature as a fusion feature;

[0031] Among them, if the first feature is the encrypted traffic feature, the second feature is the handshake meta feature; if the first feature is the handshake meta feature, the second feature is the encrypted traffic feature.

[0032] The above method can automatically learn and extract the correlation between these two types of features. The generated fusion features more comprehensively reflect the nature of encrypted traffic, thereby significantly improving the performance of traffic classification tasks.

[0033] In one possible implementation, obtaining encrypted traffic data and handshake metadata of a session between two devices includes:

[0034] Parse the pcap files collected from any of the two devices to obtain log files;

[0035] Find the preset characters from the log file;

[0036] If the preset character is a character in the first character set, determining that the content included in the preset character is encrypted traffic data, and other content in the log file except the encrypted traffic data is handshake metadata; or

[0037] If the preset character is a character in the first character set, it is determined that the content contained in the preset character is encrypted traffic data; if the preset character is a character in the second character set, it is determined that the content contained in the preset character is handshake metadata.

[0038] The above method can locate encrypted traffic data and handshake metadata through preset characters, thereby improving the accuracy of data acquisition.

[0039] In a second aspect, an embodiment of the present invention provides a malicious encrypted traffic detection system based on multi-dimensional feature fusion, including:

[0040] An acquisition module for acquiring encrypted traffic data and handshake metadata of a session between two devices;

[0041] a feature extraction module, for extracting encrypted traffic features from encrypted traffic data of a session between two devices, and extracting handshake meta features from handshake metadata of a session between two devices;

[0042] A feature fusion module, used for fusing the encrypted traffic feature with the handshake meta feature to obtain a fused feature;

[0043] The classification module is used to input the fusion feature into a classification model and output a classification result; wherein the classification model is used to distinguish whether the traffic of the session between devices is malicious encrypted traffic or normal encrypted traffic.

[0044] In a possible implementation, the feature fusion module is specifically used to:

[0045] Mapping the first feature through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix;

[0046] Determining a weight corresponding to a first feature according to the first query matrix, the first key matrix, and the first value matrix;

[0047] Map the second feature through two linear layers to obtain a second key matrix and a second value matrix;

[0048] Using the weight corresponding to the first feature as a second query matrix, obtaining the weight corresponding to the second feature according to the second query matrix, the second key matrix and the second value matrix, and using the weight corresponding to the second feature as a fusion feature;

[0049] Among them, if the first feature is the encrypted traffic feature, the second feature is the handshake meta feature; if the first feature is the handshake meta feature, the second feature is the encrypted traffic feature.

[0050] In a third aspect, an embodiment of the present invention provides an electronic device, including:

[0051] processor;

[0052] A processor is used to execute the computer program or instructions in the memory so that the malicious encrypted traffic detection method based on multi-dimensional feature fusion as described in any one of the first aspects is executed.

[0053] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor, the processor is enabled to execute the malicious encrypted traffic detection method based on multi-dimensional feature fusion as described in any one of the first aspects.

[0054] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the malicious encrypted traffic detection method based on multi-dimensional feature fusion as described in any one of the first aspects.

[0055] In addition, the technical effects brought about by any implementation method in the second to fifth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here.

[0056] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 A flowchart of a malicious encrypted traffic detection method based on multi-dimensional feature fusion provided by an embodiment of the present invention;

[0058] Figure 2 A schematic diagram of a session between an SSL client and a server provided in an embodiment of the present invention;

[0059] Figure 3 A schematic diagram of a parsed log file provided by an embodiment of the present invention;

[0060] Figure 4 A flow chart for extracting features from encrypted traffic data provided by an embodiment of the present invention;

[0061] Figure 5 A flow chart of extracting features from handshake metadata provided by an embodiment of the present invention;

[0062] Figure 6 A flow chart of a feature fusion method provided by an embodiment of the present invention;

[0063] Figure 7 A flowchart of another feature fusion method provided by an embodiment of the present invention;

[0064] Figure 8 A schematic diagram of feature fusion and classification provided by an embodiment of the present invention;

[0065] Fig. 9 A flowchart of a classification model training method provided by an embodiment of the present invention;

[0066] Fig.10 A schematic diagram of the structure of a malicious encrypted traffic detection device based on multi-dimensional feature fusion provided by an embodiment of the present invention;

[0067] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0069] In the description of the embodiments of the present application, unless otherwise specified, in the description of the embodiments of the present application, "plurality" refers to two or more than two.

[0070] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0071] Glossary:

[0072] Encrypted traffic detection: The process of identifying and analyzing encrypted data streams in network communications to determine whether there is malicious behavior or security risks. When communication data is encrypted using an encryption algorithm (such as SSL / TLS), the network security system cannot directly read the data content, so traditional detection methods cannot effectively analyze it. The goal of encrypted traffic detection is to solve this problem. This application is to identify abnormal behavior or malicious activity by analyzing the metadata, features or other relevant information of encrypted traffic, and using machine learning, deep learning and other technologies.

[0073] SSL / TLS handshake: SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are encryption protocols for network communication security. They are often used to protect the communication between web browsers and servers. The handshake is the process of the SSL / TLS protocol to establish a secure communication channel. The SSL / TLS handshake usually includes steps such as the client sending a request, the server responding, the certificate exchange, and the key negotiation. These steps ensure the security and integrity of the communication.

[0074] The present invention is described in detail below with reference to the accompanying drawings:

[0075] Combination Figure 1 As shown, an embodiment of the present invention provides a malicious encrypted traffic detection method based on multi-dimensional feature fusion, including:

[0076] S100: Obtain encrypted traffic data and handshake metadata of a session between two devices.

[0077] The encrypted traffic data of the conversation between the two devices includes the content that the two devices want to transfer. For example, if the conversation between the two devices wants to transfer the storage address of an image, then the encrypted data of the storage address of the image is the encrypted traffic data of the conversation between the two devices.

[0078] The handshake metadata of a session between two devices is encryption-related data of the session between the two devices, for example, the handshake metadata includes protocol version, cipher suite, elliptic curve, SSL history, certificate verification result, certificate status, etc.

[0079] S101: extracting encrypted traffic features from encrypted traffic data of a session between two devices, and extracting handshake meta features from handshake metadata of a session between the two devices.

[0080] S102: Fusing the encrypted traffic feature and the handshake meta feature to obtain a fused feature.

[0081] S103: Input the fusion feature into a classification model and output a classification result; wherein the classification model is used to distinguish whether the traffic of a session between two devices is malicious encrypted traffic or normal encrypted traffic.

[0082] In detail, the fused features are input into the classification model, and the fused features are analyzed in the classification model to obtain whether the traffic of the session between the two devices is malicious encrypted traffic or normal encrypted traffic. For example, if the analysis shows that the traffic of the session between the two devices is malicious encrypted traffic, then the output classification result is that the traffic of the session between the two devices is malicious encrypted traffic; if the analysis shows that the traffic of the session between the two devices is normal encrypted traffic, then the output classification result is that the traffic of the session between the two devices is normal encrypted traffic.

[0083] In this way, the present invention uses encrypted traffic data to provide an in-depth understanding of data content, and uses handshake metadata to provide key information about connection establishment and encryption protocols, such as protocol version and encryption algorithm, etc. The encrypted traffic data and handshake metadata are fused to obtain fused features, and the fused features are used to analyze the category of traffic. This combination allows two different angles to fully learn the encrypted traffic features, thereby enhancing the accuracy and reliability of malicious traffic detection.

[0084] In some embodiments, step 100 specifically includes:

[0085] Parse the pcap files collected from any of the two devices to obtain log files;

[0086] Find the preset characters from the log file;

[0087] If the preset character is a character in the first character set, determining that the content included in the preset character is encrypted traffic data, and other content in the log file except the encrypted traffic data is handshake metadata; or

[0088] If the preset character is a character in the first character set, it is determined that the content contained in the preset character is encrypted traffic data; if the preset character is a character in the second character set, it is determined that the content contained in the preset character is handshake metadata.

[0089] Exemplary, combined Figure 2 As shown, a conversation process between a client and a server using the SSL protocol to establish a secure channel is shown. The first packet sent by the client 200 in the SSL handshake to the server 201 in the SSL handshake is clienthello. The packet is all plain text and mainly includes information such as a random number generated by the client, a list of supported encryption suites, and a list of compression algorithms. After the server 201 receives the client hello from the client 200, the server 201 returns serverhello to the client 200. The main content of server hello includes information such as the TLS protocol version selected for subsequent use, a random number, a session id, an encryption suite selected from the encryption suite list supported by the client, and a compression algorithm selected from the compression algorithm list.

[0090] Server 201 sends its own Certificate to client 200. Certificate is the certificate. Server 201 sends Server key Exchange to client 200. Server key Exchange is used to send parameters and data related to the key exchange algorithm. Server 201 sends Certificate Request to client 200. CertificateRequest is the certificate request. Server 201 sends Server Hello Done to client 200. Server HelloDone indicates that client 200 is notified that the current communication is completed. Client 200 sends its own Certificate to server 201. Client 200 sends Client key Exchange to server 201. Client key Exchange is the exchange key parameter. Client 200 sends Certificate Verify to server 201. Certificate Verify indicates certificate verification. Client 200 sends Change Cipher Spec to server 201. Change Cipher Spec is a coding change notification. This step is for client 200 to notify server 201 that all subsequent messages will be encrypted using the previously negotiated secret key. It is an event message. Finished indicates completion. The client 200 and the server 201 use the negotiated key to encrypt the communication content for communication, the encrypted communication content is Encrypted Date, and Close Messages is the closing information.

[0091] Use the collected pcap file at any device of the client 200 and the server 201. Use a network security monitoring tool such as Zeek to parse the collected pcap file, extract key information of the encrypted session, and generate log files such as ssl.log. The ssl.log log file records the detailed information of each SSL / TLS session, such as the protocol version, cipher suite, elliptic curve, SSL history, certificate verification result, certificate status, and encrypted traffic data.

[0092] Among them, the elliptic curve is a string that represents encryption-related information;

[0093] SSL history is a string, similarly, representing encryption-related information.

[0094] Combination Figure 3As shown in the figure, the content after the colon of protocol version, cipher suite, elliptic curve, SSL history, certificate verification result, and certificate status is the handshake metadata, and the content after the colon of payload is the encrypted traffic data.

[0095] The first character set is the character representation of encrypted traffic data, such as payload; the second character set is the character representation of handshake metadata, such as protocol version, cipher suite, elliptic curve, SSL history, certificate verification result, certificate status, etc.

[0096] When the payload field is found in the ssl.log log file, the content contained in the payload, that is, the content after the payload colon is the encrypted traffic data; the other content in the ssl.log log file is the handshake metadata; the handshake metadata can also be searched one by one, for example, the protocol version field is locked, and the content after the protocol version colon is the handshake metadata. Similarly, other handshake metadata can be extracted.

[0097] Before feature extraction, the present invention can also remove redundant and irrelevant data, process missing or invalid values, etc. from the encrypted traffic data and handshake metadata. Irrelevant data can be understood as sessions between other devices other than the session between two devices. For example, device A will have a session with device B and device C. When determining malicious traffic detection of the session between device A and device B, the session between device A and device C is irrelevant data. When obtaining the encrypted traffic data and handshake metadata of the session between device A and device B, the encrypted traffic data and handshake metadata of the session between device A and device C are removed.

[0098] Invalid values ​​can be understood as invalid values ​​such as spaces and slashes.

[0099] In some embodiments, in combination Figure 4 As shown, step 101 extracts encrypted traffic features from encrypted traffic data of a session between two devices, specifically including:

[0100] S400: converting the encrypted traffic data of the session between the two devices into encrypted traffic data represented by digital data;

[0101] Among them, the encrypted traffic data of the conversation between the two devices is generally expressed in hexadecimal. The hexadecimal expression includes letters in addition to numbers. When executing step 400, the hexadecimal expression of the encrypted traffic data of the conversation between the two devices can be converted into encrypted traffic data expressed in decimal or binary, that is, encrypted traffic data expressed in digital form.

[0102] S401: compressing the encrypted traffic data represented by digits to obtain the encrypted traffic data represented by low-dimensional vectors;

[0103] S402: Reconstruct the encrypted traffic data represented by the low-dimensional vector to obtain encrypted traffic features.

[0104] Exemplarily, since the encrypted traffic data contains complex nonlinear features, a deep autoencoder is selected to capture the complex features implicit therein and effectively reduce the dimension of the data. Steps 401 and 402 are completed using a deep autoencoder, which includes an encoder and a decoder; the encoder is used to perform step 401, that is, the encoder is used to compress the encrypted traffic data represented to obtain the encrypted traffic data represented by a low-dimensional vector, and the decoder is used to perform step 402, that is, the encrypted traffic data represented by the low-dimensional vector is reconstructed to obtain the encrypted traffic features. In this way, through the entire encoding process, the deep autoencoder can learn the compressed representation of the encrypted traffic data and retain the most significant encryption features of the data, thereby providing valuable input for subsequent feature fusion and classification.

[0105] The handshake metadata includes multiple categories of metadata; for example, six categories of metadata: protocol version, cipher suite, elliptic curve, SSL history, certificate verification result, and certificate status.

[0106] In some embodiments, in combination Figure 5 As shown, step 101 extracts handshake meta features from handshake metadata of a session between two devices, including:

[0107] S500: Convert metadata of each category of a conversation between two devices into metadata of each category represented digitally.

[0108] Specifically, an open source package is used to convert each category of non-digital representation metadata of a conversation between two devices into each category of digital representation metadata; or

[0109] Each category of metadata represented by non-digital expressions in a conversation between two devices is mapped to each category of metadata represented by digital expressions by using a preset mapping relationship between non-digital expressions and digits.

[0110] For example, the category of the handshake metadata is Cipher Suites, and the Cipher Suites are:

[0111] TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384;

[0112] For letters such as ECDHE, ECDSA, TLS, WITH, AES, GCM, and SHA, that is, metadata represented by non-numbers, you can use open source packages or the mapping relationship between the above letters and numbers to convert them into numbers.

[0113] The mapping relationship between letters and numbers is shown in Table 1:

[0114] ECDHE ECDSA TLS WITH AES GCM SHA 11 12 13 14 15 16 17

[0115] When converting cipher suites, convert ECDHE to 11, ECDSA to 12, TLS to 13, WITH to 14, AES to 15, GCM to 16, and SHA to 17.

[0116] The final digital representation of the cipher suite is: 13_11_12_14_15_256_16_17384.

[0117] The category of handshake metadata is elliptic curve, and the elliptic curve is: P384; the non-numeric metadata that needs to be converted is P. If P is converted to 20, then the elliptic curve can be converted to 20384.

[0118] It should be noted that the above mapping relationship is only exemplary and cannot be used as a specific limitation of the present invention. The mapping relationship can be set according to actual conditions.

[0119] S501: extracting meta-features of each category from metadata of each category represented digitally by an embedding encoder;

[0120] Among them, the handshake metadata is a discrete category feature, such as the protocol version and encryption algorithm. The embedding encoder can convert these category features into a continuous, dense vector form to meet the requirements of the machine learning model. Here, FastText is used as an embedding encoder as an example. For each category data c, the embedding encoder maps it to an embedding vector e c This mapping relationship is achieved through the embedding matrix E embedding Definition, use the category data as the index to extract the corresponding embedding vector from the embedding matrix. During the training process, the goal of the embedding encoder is to learn an optimal embedding matrix E embedding , making similar categories closer in the embedding space and dissimilar categories farther away. Through this encoding process, the category features of the handshake metadata are converted into dense vector representations, providing effective input data for subsequent feature fusion and classification.

[0121] S502: Combine the meta-features of each category to obtain a handshake meta-feature.

[0122] In detail, the meta-feature of each category is an M×N matrix, where M is equal to 1 or N is equal to 1; when combining, when M is equal to 1, the combination can be performed in the M direction, for example, in the M direction, one column is the protocol version, one column is the cipher suite, one column is the elliptic curve, one column is the SSL history record, one column is the certificate verification result, and one column is the certificate status; when N is equal to 1, the combination can be performed in the N direction, for example, in the N direction, one line is the protocol version, one line is the cipher suite, one line is the elliptic curve, one line is the SSL history record, one line is the certificate verification result, and one line is the certificate status.

[0123] Exemplary, handshake meta-feature

[0124] a 11 ~a m1 is the protocol version, a 12 ~a m2 is the cipher suite, a 13 ~a m3 is an elliptic curve, a 14 ~a m4 For SSL history, a 14 ~a m5 is the certificate verification result, a 16 ~a m6 The certificate status.

[0125] Alternatively, when combining the meta-features of each category, they can be directly arranged in a row in a preset order; the preset order is protocol version, cipher suite, elliptic curve, SSL history, certificate verification result, and certificate status; then in this row, the protocol version comes first, followed by the cipher suite, elliptic curve, SSL history, certificate verification result, and finally the certificate status.

[0126] Exemplary, handshake meta features:

[0127] A=

[0128] {a 11 a 12 … a 1m a 1(m+1) a 1(m+2) … a 1m×2 … a 1(m×5+1) a 1(m×5+2) … a 1(m×6)}

[0129] a 11 ~a m1 is the protocol version, a 1(m+1) ~a 1m×2 is the cipher suite, a 1(m×2+1) ~a1m×3 is an elliptic curve, a 1(m×3+1) ~a 1m×4 For SSL history, a 1(m×4+1) ~a 1m×5 is the certificate verification result, a 1(m×5+1) ~a 1(m×6) The certificate status.

[0130] The encoding process of the handshake metadata provided by the embodiment of the present invention not only converts discrete category features into continuous dense vectors, but also can capture and characterize the potential relationship between different categories in the vector space. The dimension of the word embedding vector can be adjusted according to actual needs, thereby maintaining the efficiency of calculation while improving the performance of the model. In addition, the feature vector obtained by training the embedding encoder can be directly used for subsequent feature fusion, which is particularly important in improving the accuracy of encrypted traffic detection.

[0131] In some embodiments, step 103 specifically includes:

[0132] Mapping the first feature through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix;

[0133] Determine the weight corresponding to the first feature according to the first query matrix, the first key matrix and the first value matrix; map the second feature through two linear layers to obtain a second key matrix and a second value matrix;

[0134] The weight corresponding to the first feature is used as the second query matrix, and the weight corresponding to the second feature is obtained according to the second query matrix, the second key matrix and the second value matrix, and the weight corresponding to the second feature is used as the fusion feature;

[0135] If the first feature is an encrypted traffic feature, the second feature is a handshake feature. Figure 6 As shown, the above content can be changed to:

[0136] S600: Mapping the encrypted traffic features through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix;

[0137] S601: Determine weights corresponding to encrypted traffic features according to a first query matrix, a first key matrix, and a first value matrix;

[0138] S602: Map the handshake meta-features through two linear layers to obtain a second key matrix and a second value matrix;

[0139] S603: The weight corresponding to the encrypted traffic feature is used as the second query matrix, and the weight corresponding to the handshake meta feature is obtained according to the second query matrix, the second key matrix and the second value matrix, and the weight corresponding to the handshake meta feature is used as the fusion feature.

[0140] Specifically, first, the encrypted traffic feature E is mapped into the first query matrix (query E ), the first key matrix (key E ) and the first value matrix (value E ), the weight A corresponding to the encrypted traffic feature is calculated through the self-attention mechanism E , calculated as follows:

[0141]

[0142] The attention weight A of the encrypted traffic feature E E As the second query matrix of the cross attention mechanism (query H ), the handshake meta-feature H is mapped to the second key matrix (key H ) and the second value matrix (value H ), the feature fusion process is completed through the following cross-attention calculation:

[0143]

[0144] Among them, Z is the fusion feature of the encrypted traffic feature E and the handshake meta feature H.

[0145] If the first feature is a handshake feature, the second feature is an encrypted traffic feature; combined Figure 7 As shown, the above content can be changed to:

[0146] S700: Map the handshake meta-features through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix;

[0147] S701: Determine weights corresponding to handshake meta-features according to a first query matrix, a first key matrix, and a first value matrix;

[0148] S702: Map the encrypted traffic features through two linear layers to obtain a second key matrix and a second value matrix;

[0149] S703: The weight corresponding to the handshake meta-feature is used as the second query matrix, and the weight corresponding to the encrypted traffic feature is obtained according to the second query matrix, the second key matrix and the second value matrix, and the weight corresponding to the encrypted traffic feature is used as the fusion feature.

[0150] Specifically, first, the handshake meta-feature H is mapped to the first query matrix (query H ), the first key matrix (key H ) and the first value matrix (value H ), the weight A corresponding to the handshake meta-feature is calculated through the self-attention mechanism H, calculated as follows:

[0151]

[0152] Attention weight A of handshake meta-feature H H As the second query matrix (query) of the cross attention mechanism, the encrypted traffic feature E is mapped to the second key matrix (key E ) and the second value matrix (value E ), the feature fusion process is completed through the following cross-attention calculation:

[0153]

[0154] Among them, Z is the fusion feature of the encrypted traffic feature E and the handshake meta feature H.

[0155] The present invention utilizes a Transformer-based cross-attention mechanism to fuse encrypted payload and handshake metadata features. By setting the handshake meta features as queries and the encrypted traffic features as keys and values, the present invention is able to automatically learn and extract the correlation between these two types of features. In this process, by calculating the attention weights, the model is able to automatically adjust which features should be emphasized or suppressed, thereby optimizing the feature fusion process. Ultimately, the generated fused feature vector more comprehensively reflects the nature of encrypted traffic, thereby significantly improving the performance of traffic classification tasks.

[0156] After fusion, further nonlinear transformation and feature extraction can be performed through a series of fully connected layers. The features are processed through residual structure and layer normalization to obtain the classification result, which can determine whether it is malicious encrypted traffic or normal encrypted traffic.

[0157] The residual structure is simply understood as the sum of features from different processing layers. Figure 8 As shown in FIG, the features before and after the self-attention mechanism are processed are added together to form a residual structure, and the features before and after the forward propagation process are added together to form a residual structure.

[0158] Exemplary, combined Figure 8 As shown in FIG, the handshake meta-features include meta-features extracted from the protocol version, meta-features extracted from the cipher suite, meta-features extracted from the elliptic curve, meta-features extracted from the SSL history, meta-features extracted from the certificate verification result, and meta-features extracted from the certificate status, which are mapped into the first query matrix (query) through three linear layers. H ), the first key matrix (key H ) and the first value matrix (value H), using the self-attention mechanism, the first query matrix (query H ), the first key matrix (key H ) and the first value matrix (value H ) Calculate the weight A corresponding to the handshake meta-feature H , the first query matrix (query H ), the first key matrix (key H ) and the first value matrix (value H ), and the weight A corresponding to the handshake meta-feature H The processed matrix is ​​obtained by summing and regularizing, and the processed matrix is ​​used as the second query matrix (query). The encrypted traffic feature E is mapped to the second key matrix (key) through two linear layers. E ) and the second value matrix (value E ), the second query matrix (query), the second key matrix (key E ) and the second value matrix (value E ) Cross-attention calculation is used to obtain the fusion features of the handshake meta-features and the encrypted traffic features; the fusion features of the handshake meta-features and the encrypted traffic features are forward propagated, and the fusion features after the forward propagation processing and the fusion features before the forward propagation processing are added and layer-normalized to obtain the classification results.

[0159] Before using a classification model for classification, it is first necessary to obtain a training set, and then use the training set to train the classification model.

[0160] Combination Fig. 9 As shown in Figure 1, the specific process of training the classification model includes:

[0161] S900: collecting multiple conversations between two devices;

[0162] Specifically, the encrypted traffic generated by normal communication between the target machine and the public network and simulated malicious attacks is collected. Network packet capture tools such as Wireshark are used to capture normal communication traffic and malicious attack traffic, and then clean and annotate them to distinguish normal traffic from different types of malicious traffic.

[0163] S901: Preprocess multiple conversations between two devices to obtain a training set and a verification set;

[0164] The preprocessing process includes: first, original traffic parsing: in the original traffic preprocessing stage, first use Zeek and other network security monitoring tools to parse the collected pcap file, extract the key information of the encrypted session, and generate log files such as ssl.log. These log files record the detailed information of each SSL / TLS session. The present invention mainly uses fields such as protocol version, cipher suite, elliptic curve, SSL history, certificate verification result, certificate status and encrypted traffic data.

[0165] Secondly, data cleaning and standardization: This step formats the extracted data, removes redundant and irrelevant data, and handles missing or invalid values. At the same time, duplicate records are deleted to avoid data duplication or misleading analysis results. This step is crucial for the subsequent encoding of handshake metadata features based on the embedding model.

[0166] Formatting the extracted data mainly converts the structure of the extracted data into a unified structure.

[0167] Final sample balance and splitting: Due to the different number of different types of traffic, this step uses oversampling or undersampling techniques to deal with the problem of class imbalance and ensure that malicious traffic and normal traffic are represented evenly in the training set. Then, the data is randomly split into training and test sets in the required proportions to support the model training and validation process.

[0168] For example, when oversampling technology is used to supplement category data, the category data can be supplemented by duplication. For example, when the flow data of a certain category is missing, the flow data of the category can be duplicated, and multiple flow data of the category can be duplicated to meet the requirement that the number of data of different categories is the same. Alternatively, a GAN network can be used for oversampling processing.

[0169] The number of different types of traffic may be different malware or different applications, such as chat software, shopping software, map software, and the like.

[0170] S902: extracting features from the handshake metadata and encrypted traffic data of the training set and the test set;

[0171] This step may refer to the above step 101.

[0172] S903: Use the features in the training set to train the basic network of the classification model, and use the features in the validation set to validate the classification model.

[0173] During the training process, refer to Figure 8As shown in the figure, the handshake meta-features and encrypted traffic features are used for feature fusion. After feature fusion, they are input into the basic network to determine the classification result. The classification result is compared with the actual result in the training set. The parameters of the basic network are modified according to the comparison result until the difference between the classification result determined by the basic network and the actual classification result is relatively small. The training is completed, that is, the basic network training obtains the classification model. Then, the features of the validation set are fused, and the fused features are input into the classification model to verify whether the difference between the classification result determined by the classification model and the actual classification result is relatively small. If it is relatively small, the verification is passed. Otherwise, the classification model needs to be further trained.

[0174] Optionally, a multi-layer perceptron is used as the basic network of the classification model. The multi-layer perceptron can fully tap into the complex patterns and behavioral features hidden in the fusion features due to its powerful processing capabilities, flexible structural adjustment, and excellent generalization capabilities. Through training, the multi-layer perceptron can effectively learn the decision boundary for distinguishing malicious and normal encrypted traffic from data that integrates multi-dimensional features.

[0175] like Fig.10 As shown, the present invention also provides a malicious encrypted traffic detection system based on multi-dimensional feature fusion, comprising:

[0176] An acquisition module 1000 is used to acquire encrypted traffic data and handshake metadata of a session between two devices;

[0177] A feature extraction module 1010, for extracting encrypted traffic features from encrypted traffic data of a session between two devices, and extracting handshake meta features from handshake meta data of a session between two devices;

[0178] The feature fusion module 1020 is used to fuse the encrypted traffic feature and the handshake meta feature to obtain a fused feature.

[0179] The classification module 1030 is used to input the fusion feature into a classification model and output a classification result; wherein the classification model is used to distinguish whether the traffic of a session between devices is malicious encrypted traffic or normal encrypted traffic.

[0180] Optionally, the feature extraction module 1010 is specifically used for:

[0181] Converting encrypted traffic data of a session between two devices into encrypted traffic data represented by a digital representation;

[0182] Compressing the encrypted traffic data represented by digits to obtain the encrypted traffic data represented by low-dimensional vectors;

[0183] The encrypted traffic data represented by the low-dimensional vector is reconstructed to obtain the encrypted traffic features.

[0184] Optionally, the feature extraction module 1010 is specifically configured to: the handshake metadata includes multiple categories of metadata;

[0185] converting each category of metadata of a conversation between two devices into a digital representation of each category of metadata;

[0186] Extracting meta-features of each category from the metadata of each category represented digitally through an embedding encoder;

[0187] The meta-features of each category are combined to obtain the handshake meta-features.

[0188] Optionally, the feature extraction module 1010 is further used for:

[0189] An open source package is used to convert each category of non-digital representation of metadata for a conversation between two devices into each category of digital representation of metadata; or

[0190] Each category of metadata represented by non-digital expressions in a conversation between two devices is mapped to each category of metadata represented by digital expressions by using a preset mapping relationship between non-digital expressions and digits.

[0191] Optionally, the feature fusion module 1020 is specifically used for:

[0192] Mapping the first feature through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix;

[0193] Determining a weight corresponding to a first feature according to the first query matrix, the first key matrix, and the first value matrix;

[0194] Map the second feature through two linear layers to obtain a second key matrix and a second value matrix;

[0195] Using the weight corresponding to the first feature as a second query matrix, obtaining the weight corresponding to the second feature according to the second query matrix, the second key matrix and the second value matrix, and using the weight corresponding to the second feature as a fusion feature;

[0196] Among them, if the first feature is the encrypted traffic feature, the second feature is the handshake meta feature; if the first feature is the handshake meta feature, the second feature is the encrypted traffic feature.

[0197] Optionally, the acquisition module 1000 is specifically used for:

[0198] Parse the pcap files collected from any of the two devices to obtain log files;

[0199] Find the preset characters from the log file;

[0200] If the preset character is a character in the first character set, determining that the content included in the preset character is encrypted traffic data, and other content in the log file except the encrypted traffic data is handshake metadata; or

[0201] If the preset character is a character in the first character set, it is determined that the content contained in the preset character is encrypted traffic data; if the preset character is a character in the second character set, it is determined that the content contained in the preset character is handshake metadata.

[0202] In addition, combined Figure 1-Figure 10 The malicious encrypted traffic detection method and system based on multi-dimensional feature fusion described in the embodiments of the present invention can be implemented by an electronic device.

[0203] Electronic devices, including: processors;

[0204] a memory for storing instructions executable by the processor;

[0205] The processor is configured to execute the instructions to implement the malicious encrypted traffic detection method based on multi-dimensional feature fusion as described in any one of the above descriptions.

[0206] Based on the above introduction, an exemplary Fig.11 electronic equipment structure.

[0207] The electronic device may include a processor 1110 and a memory 1120 storing computer program instructions.

[0208] Specifically, the processor 1110 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present invention.

[0209] The memory 1120 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 1120 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 1120 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 1120 may be inside or outside a data processing device. In a particular embodiment, the memory 1120 is a non-volatile solid-state memory. In a particular embodiment, the memory 1120 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.

[0210] The processor 1110 implements any one of the methods for performing tasks in the above embodiments by reading and executing computer program instructions stored in the memory 1120 .

[0211] In one example, the electronic device may further include a communication interface 1130 and a bus 1140. Fig.11 As shown, the processor 1110, the memory 1120, and the communication interface 1130 are connected via a bus 1140 and communicate with each other.

[0212] The communication interface 1130 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiment of the present invention.

[0213] Bus 1140 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1140 may include one or more buses. Although the embodiment of the present invention describes and shows a specific bus, the present invention considers any suitable bus or interconnection.

[0214] The electronic device can execute the malicious encrypted traffic detection method based on multi-dimensional feature fusion in the embodiment of the present invention based on the received task, thereby realizing the combination of Figure 1-Figure 10 The described method and system for detecting malicious encrypted traffic based on multi-dimensional feature fusion.

[0215] In addition, in combination with the electronic device in the above embodiments, an embodiment of the present invention may provide a storage medium. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the malicious encrypted traffic detection method based on multi-dimensional feature fusion as described in any one of the above items.

[0216] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0217] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0218] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0219] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0220] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A malicious encrypted traffic detection method based on multi-dimensional feature fusion, It is characterized in that include: Get encrypted traffic data and handshake metadata of a conversation between two devices; extracting encrypted traffic features from encrypted traffic data of a session between two devices, and extracting handshake meta-features from handshake metadata of a session between two devices; Fusion the encrypted traffic feature and the handshake meta feature to obtain a fusion feature; The fusion feature is input into a classification model, and a classification result is output; wherein the classification model is used to distinguish whether the traffic of a session between devices is malicious encrypted traffic or normal encrypted traffic.

2. According to the method for detecting malicious encrypted traffic based on multi-dimensional feature fusion according to claim 1, It is characterized in that Extract encrypted traffic features from the encrypted traffic data of a session between two devices, including: Converting encrypted traffic data of a session between two devices into encrypted traffic data represented by a digital representation; Compressing the encrypted traffic data represented by digits to obtain the encrypted traffic data represented by low-dimensional vectors; The encrypted traffic data represented by the low-dimensional vector is reconstructed to obtain the encrypted traffic features.

3. According to the method for detecting malicious encrypted traffic based on multi-dimensional feature fusion according to claim 1, It is characterized in that The handshake metadata includes multiple categories of metadata; Extract handshake meta features from the handshake metadata of a session between two devices, including: converting each category of metadata of a conversation between two devices into a digital representation of each category of metadata; Extracting meta-features of each category from the metadata of each category represented digitally through an embedding encoder; The meta-features of each category are combined to obtain the handshake meta-features.

4. According to claim 1, the method for detecting malicious encrypted traffic based on multi-dimensional feature fusion, It is characterized in that Convert each category of metadata for a conversation between two devices into a digital representation of each category of metadata, including: An open source package is used to convert each category of non-digital representation of metadata for a conversation between two devices into each category of digital representation of metadata; or Each category of metadata represented by non-digital expressions in a conversation between two devices is mapped to each category of metadata represented by digital expressions by using a preset mapping relationship between non-digital expressions and digits.

5. The method for detecting malicious encrypted traffic based on multi-dimensional feature fusion according to any one of claims 1 to 4, It is characterized in that The encrypted traffic feature and the handshake meta feature are merged to obtain a fused feature, including: Mapping the first feature through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix; Determining a weight corresponding to a first feature according to the first query matrix, the first key matrix, and the first value matrix; Map the second feature through two linear layers to obtain a second key matrix and a second value matrix; Using the weight corresponding to the first feature as a second query matrix, obtaining the weight corresponding to the second feature according to the second query matrix, the second key matrix and the second value matrix, and using the weight corresponding to the second feature as a fusion feature; Among them, if the first feature is the encrypted traffic feature, the second feature is the handshake meta feature; if the first feature is the handshake meta feature, the second feature is the encrypted traffic feature.

6. According to claim 1, the method for detecting malicious encrypted traffic based on multi-dimensional feature fusion, It is characterized in that Get encrypted traffic data and handshake metadata for a session between two devices, including: Parse the pcap files collected from any of the two devices to obtain log files; Find the preset characters from the log file; If the preset character is a character in the first character set, determining that the content included in the preset character is encrypted traffic data, and other content in the log file except the encrypted traffic data is handshake metadata; or If the preset character is a character in the first character set, it is determined that the content contained in the preset character is encrypted traffic data; if the preset character is a character in the second character set, it is determined that the content contained in the preset character is handshake metadata.

7. A malicious encrypted traffic detection system based on multi-dimensional feature fusion, It is characterized in that include: An acquisition module for acquiring encrypted traffic data and handshake metadata of a session between two devices; a feature extraction module, for extracting encrypted traffic features from encrypted traffic data of a session between two devices, and extracting handshake meta features from handshake metadata of a session between two devices; A feature fusion module, used for fusing the encrypted traffic feature with the handshake meta feature to obtain a fused feature; The classification module is used to input the fusion feature into a classification model and output a classification result; wherein the classification model is used to distinguish whether the traffic of the session between devices is malicious encrypted traffic or normal encrypted traffic.

8. According to claim 7, the malicious encrypted traffic detection system based on multi-dimensional feature fusion, It is characterized in that The feature fusion module is specifically used for: Mapping the first feature through three linear layers to obtain a first query matrix, a first key matrix, and a first value matrix; Determining a weight corresponding to a first feature according to the first query matrix, the first key matrix, and the first value matrix; Map the second feature through two linear layers to obtain a second key matrix and a second value matrix; Using the weight corresponding to the first feature as a second query matrix, obtaining the weight corresponding to the second feature according to the second query matrix, the second key matrix and the second value matrix, and using the weight corresponding to the second feature as a fusion feature; Among them, if the first feature is the encrypted traffic feature, the second feature is the handshake meta feature; if the first feature is the handshake meta feature, the second feature is the encrypted traffic feature.

9. An electronic device, It is characterized in that include: Memory, used to store computer programs or instructions; A processor is used to execute the computer program or instructions in the memory so that the malicious encrypted traffic detection method based on multi-dimensional feature fusion as described in any one of claims 1-6 is executed.

10. A computer-readable storage medium, It is characterized in that When the instructions in the storage medium are executed by a processor, the processor is enabled to execute the malicious encrypted traffic detection method based on multi-dimensional feature fusion as described in any one of claims 1-6.