Malicious encrypted traffic detection method and device, computer equipment and medium
Through multi-feature extraction and feature data fusion, the random forest classification model is optimized, and the existing malicious encryption traffic detection problem is solved, and more efficient malicious encryption traffic recognition and detection is achieved.
Patent Information
- Application Number
- CN202411222276.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-11-19
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing malicious encryption traffic detection methods are not efficient and difficult to extract highly representative features, resulting in insufficient detection efficiency and accuracy.
Through multi-feature extraction and feature data fusion, the multi-feature extraction data of the target encrypted traffic data is obtained and input into the classification detection model. The random forest classification model is used for optimization processing to generate an efficient malicious encrypted traffic detection model.
It improves the efficiency and accuracy of malicious encrypted traffic detection, can more effectively identify malicious encrypted traffic, reduce false alarm rates, and improve network security protection capabilities.
Smart Images

Figure CN118984246A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the technical field of malicious traffic detection, and in particular, to a method, apparatus, computer equipment, and medium for detecting malicious encrypted traffic. Background Art
[0002] With the widespread popularity of Internet technology, network applications have become an indispensable part of people's daily lives. In order to better protect personal privacy information, the integration of network traffic and encryption technology has become the mainstream trend of network communication technology development. However, while legitimate network applications are encrypted, various network attack methods also use traffic encryption to hide malicious network programs on the Internet, causing great trouble to network security protection.
[0003] In related technologies, malicious encrypted traffic detection mainly builds a traffic classification detection model based on common machine learning algorithms, and completes the detection of malicious encrypted traffic by classifying and identifying the extracted encrypted traffic feature information.
[0004] However, using existing methods, the detection efficiency is not high. Summary of the invention
[0005] The embodiments described herein provide a method, apparatus, computer device, and medium for detecting malicious encrypted traffic, which overcome the above-mentioned problems.
[0006] In a first aspect, according to the content of the present disclosure, a method for detecting malicious encrypted traffic is provided, comprising:
[0007] Obtain target encrypted traffic data;
[0008] Performing multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data;
[0009] Performing feature data fusion on multiple feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data;
[0010] The target feature vector data corresponding to the target encrypted traffic data is input into a classification detection model, and the detection result of the target encrypted traffic data is determined based on the output result of the classification detection model.
[0011] Optionally, performing multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data includes:
[0012] Extracting the target encrypted traffic data based on a preset category extraction rule to obtain rule-extracted data;
[0013] Perform feature extraction on the rule-extracted data based on a preset feature extraction rule to obtain multiple feature extraction data corresponding to the target encrypted traffic data;
[0014] Among them, the preset category extraction rules are used to extract data corresponding to the preset categories, and the preset categories include: source IP address, target IP address and communication protocol; the preset feature extraction rules are used to extract data corresponding to the preset features, and the preset features include: data packet capacity, protocol type, data packet sending time interval and data packet type.
[0015] Optionally, before inputting the target feature vector data corresponding to the target encrypted traffic data into a classification detection model and determining the detection result of the target encrypted traffic data based on the output result of the classification detection model, the method further includes:
[0016] Get sample traffic data;
[0017] Performing encrypted traffic detection on the sample traffic data to obtain sample encrypted traffic data, wherein the encrypted traffic detection is used to identify encrypted traffic data and non-encrypted traffic data in the sample traffic data;
[0018] Performing multi-feature extraction on the sample encrypted traffic data to obtain multi-feature extraction data corresponding to the sample encrypted traffic data;
[0019] Performing feature data fusion on multiple feature extraction data corresponding to the sample encrypted traffic data to obtain sample feature vector data corresponding to the sample encrypted traffic data;
[0020] Based on the sample feature vector data corresponding to the sample encrypted traffic data, the random forest classification model is optimized to obtain the classification detection model.
[0021] Optionally, the sample feature vector data corresponding to the sample encrypted traffic data includes: a plurality of feature vectors, each of the feature vectors corresponding to a feature weight;
[0022] The optimizing process of the random forest classification model based on the sample feature vector data corresponding to the sample encrypted traffic data to obtain the classification detection model includes:
[0023] Inputting the sample feature vector data corresponding to the sample encrypted traffic data into the random forest classification model, and determining the detection result of the sample encrypted traffic data based on the output result of the random forest classification model;
[0024] If the detection result of the sample encrypted traffic data does not meet the preset conditions, the decision tree of the random forest classification model is updated based on the feature weight corresponding to each feature vector to obtain the classification detection model.
[0025] Optionally, before performing multi-feature extraction on the sample encrypted traffic data to obtain multi-feature extraction data corresponding to the sample encrypted traffic data, the method further includes:
[0026] Detecting whether there is preset abnormal data in the sample encrypted traffic data;
[0027] If it is detected that the preset abnormal data exists in the sample encrypted traffic data, deleting the preset abnormal data from the sample encrypted traffic data;
[0028] The preset abnormal data includes: data with missing values and data with incomplete data structure.
[0029] Optionally, the multi-feature extraction data corresponding to the sample encrypted traffic data includes: a plurality of extracted features, each of the extracted features corresponds to a feature category, and the feature category is used to describe whether the extracted feature belongs to a malicious traffic encryption category or a non-malicious traffic encryption category;
[0030] The step of fusing the multiple feature extraction data corresponding to the sample encrypted traffic data to obtain the sample feature vector data corresponding to the sample encrypted traffic data includes:
[0031] Classifying the plurality of extracted features based on the category to which each extracted feature corresponds;
[0032] Using principal component analysis to perform dimensionality reduction processing on the classified plurality of extracted features to obtain a plurality of normalized data;
[0033] Based on the category to which the feature corresponding to each of the normalized data belongs, feature data of the plurality of normalized data are fused to obtain sample feature vector data corresponding to the sample encrypted traffic data.
[0034] Optionally, also include:
[0035] If it is determined based on the detection result of the target encrypted traffic data that the target encrypted traffic data belongs to a malicious encrypted traffic type, then the data volume ratio of the target encrypted traffic data in the original encrypted traffic data to which it belongs is obtained, and the target encrypted traffic data is part of the traffic data in the original encrypted traffic data;
[0036] Based on the proportion of the target encrypted traffic data in the original encrypted traffic data to which it belongs, a corresponding early warning prompt is generated.
[0037] In a second aspect, according to the content of the present disclosure, a malicious encrypted traffic detection device is provided, including:
[0038] An acquisition module, used to acquire target encrypted traffic data;
[0039] An extraction module, used to perform multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data;
[0040] A fusion module, used for performing feature data fusion on multiple feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data;
[0041] A determination module is used to input the target feature vector data corresponding to the target encrypted traffic data into a classification detection model, and determine the detection result of the target encrypted traffic data based on the output result of the classification detection model.
[0042] In a third aspect, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the malicious encrypted traffic detection method in any of the above embodiments are implemented.
[0043] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the malicious encrypted traffic detection method in any of the above embodiments are implemented.
[0044] The malicious encrypted traffic detection method provided in the embodiment of the present application obtains target encrypted traffic data; performs multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data; performs feature data fusion on the multi-feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data; inputs the target feature vector data corresponding to the target encrypted traffic data into the classification detection model, and determines the detection result of the target encrypted traffic data based on the output result of the classification detection model. In this way, by performing multi-feature extraction on the encrypted traffic data, highly representative features can be extracted, and multiple features of the encrypted traffic data can be effectively unified by multi-feature fusion, which is convenient for improving the model detection efficiency of malicious encrypted traffic.
[0045] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein:
[0047] Figure 1 It is a flow chart of a malicious encrypted traffic detection method provided by the present invention.
[0048] Figure 2 It is a schematic diagram of a decision tree classification principle provided by the present disclosure.
[0049] Figure 3 It is a structural schematic diagram of a malicious encrypted traffic detection device provided by the present invention.
[0050] Figure 4 It is a structural schematic diagram of a computer device provided by the present disclosure.
[0051] It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.
[0053] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by a person skilled in the art to which the subject matter of the present disclosure belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the specification and the relevant art, and will not be interpreted in an idealized or overly formal form unless otherwise explicitly defined herein. As used herein, a statement that two or more parts are "connected" or "coupled" together shall mean that the parts are joined together directly or through one or more intermediate components.
[0054] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0055] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. Terms such as "first" and "second" are only used to distinguish one component (or a part of a component) from another component (or another part of a component).
[0056] In the description of the present application, unless otherwise specified, "plurality" means more than two (including two), and similarly, "multiple groups" means more than two groups (including two).
[0057] The existing technology mainly builds traffic classification detection models based on common machine learning algorithms, such as random forest algorithms, support vector machine algorithms, etc., and completes the detection of malicious encrypted traffic by classifying and identifying according to the extracted encrypted traffic feature information. Since the characteristics of malicious encrypted traffic are relatively simple, complex, and diverse, it is difficult to extract highly representative features when extracting related features of malicious encrypted traffic. Therefore, in the process of processing the detection model built using the machine learning algorithm, it is impossible to make timely judgments and processes on the detected malicious encrypted traffic.
[0058] In view of the shortcomings of traditional malicious encrypted traffic detection technology, this embodiment mainly improves and perfects the feature extraction stage, and uses multi-feature fusion technology to centrally process and convert the extracted malicious encrypted traffic features of multiple types and different complexities into a single feature vector data, which can effectively improve the detection efficiency and accuracy of malicious encrypted traffic.
[0059] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0060] Figure 1 is a flow chart of a malicious encrypted traffic detection method provided by an embodiment of the present disclosure, such as Figure 1 As shown in the figure, the specific process of the malicious encrypted traffic detection method includes:
[0061] S110. Obtain target encrypted traffic data.
[0062] The target encrypted traffic data is a separate piece of encrypted traffic data, which may be part of the encrypted traffic data in a complete encrypted traffic data set.
[0063] S120. Perform multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data.
[0064] Among them, by performing multi-feature extraction on the target encrypted traffic data under different categories, it is convenient to effectively extract highly representative features to fully represent the characteristics of the target encrypted traffic data.
[0065] In some embodiments, multi-feature extraction is performed on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data, including:
[0066] Data extraction is performed on the target encrypted traffic data based on preset category extraction rules to obtain rule-extracted data; feature extraction is performed on the rule-extracted data based on preset feature extraction rules to obtain multi-feature extraction data corresponding to the target encrypted traffic data.
[0067] Among them, the preset category extraction rules are used to extract data corresponding to the preset categories, and the preset categories include: source IP (Internet Protocol) address, target IP address and communication protocol; the preset feature extraction rules are used to extract data corresponding to the preset features, and the preset features include: data packet capacity, protocol type, data packet sending time interval and data packet type.
[0068] For example, the source IP address, target IP address and traffic data corresponding to the communication protocol are extracted from the target encrypted traffic data respectively to obtain rule extraction data, and for each set of rule extraction data, the corresponding data packet capacity, protocol type, data packet sending time interval and traffic data corresponding to the data packet type are extracted to obtain multi-feature extraction data corresponding to the target encrypted traffic data.
[0069] Therefore, by dividing the target encrypted traffic data into multiple categories and performing multi-feature extraction based on each category, the multi-feature extraction data corresponding to the target encrypted traffic data can be effectively obtained.
[0070] S130. Perform feature data fusion on multiple feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data.
[0071] Among them, the multi-feature extraction data corresponding to the target encrypted traffic data may include: multi-feature extraction data corresponding to multiple groups of rule extraction data. When feature data fusion is performed on the multi-feature extraction data corresponding to the target encrypted traffic data, the corresponding multi-feature data of each group of rule feature arrangement sequence (such as source IP address, target IP address and communication protocol) can be superimposed in sequence to obtain the target feature vector data corresponding to the target encrypted traffic data.
[0072] S140. Input the target feature vector data corresponding to the target encrypted traffic data into the classification detection model, and determine the detection result of the target encrypted traffic data based on the output result of the classification detection model.
[0073] The input of the classification detection model is the feature vector, and the output is the detection result of the encrypted traffic data corresponding to the feature vector. The classification detection model can output the corresponding detection result according to the feature vector of the encrypted traffic data. The detection result of the target encrypted traffic data can be used to describe the traffic type to which the target encrypted traffic data belongs, such as malicious encrypted traffic type or non-malicious encrypted traffic type.
[0074] In some embodiments, before inputting the target feature vector data corresponding to the target encrypted traffic data into the classification detection model and determining the detection result of the target encrypted traffic data based on the output result of the classification detection model, the method further includes:
[0075] Acquire sample traffic data; perform encrypted traffic detection on the sample traffic data to obtain sample encrypted traffic data; perform multi-feature extraction on the sample encrypted traffic data to obtain multi-feature extraction data corresponding to the sample encrypted traffic data; perform feature data fusion on the multi-feature extraction data corresponding to the sample encrypted traffic data to obtain sample feature vector data corresponding to the sample encrypted traffic data; optimize the random forest classification model based on the sample feature vector data corresponding to the sample encrypted traffic data to obtain a classification detection model.
[0076] Among them, the sample traffic data can be derived from the open source data set CTU-13, which is mainly derived from 13 different malicious encrypted traffic sets generated by a malware capture implementation project. In this embodiment, 83,526 encrypted session traffic captured during 5 types of malware activities are selected as the data set (i.e., sample traffic data) for the malicious encrypted traffic detection experiment. The main types include Zeus, Htbot, Sathurbot, Opencandy, Barys, etc. At the same time, 125,842 normal session traffic in the data set are selected as normal encrypted traffic data. The types and quantities of malicious encrypted traffic contained in the data set used in the experiment are specifically shown in Table 1 below.
[0077] Table 1 Types and quantities of malicious encrypted traffic
[0078]
[0079] Encrypted traffic detection is used to identify encrypted traffic data and non-encrypted traffic data in sample traffic data. Since the original traffic data (i.e., sample traffic data) includes multiple types of data such as malicious encrypted traffic, normal encrypted traffic, and some unencrypted traffic, it is necessary to perform data screening and other operations on the original traffic data before performing multi-feature fusion processing to remove the unencrypted traffic data contained therein. The specific detection method can use deep packet inspection technology to extract the payload of the traffic data packet to identify whether some of the traffic data in the original traffic data belongs to encrypted traffic data.
[0080] When extracting multiple features from sample encrypted traffic data, data segmentation can be used to extract encrypted traffic-related data, such as source IP address, destination IP address, communication protocol, etc., based on the basic format of traffic data. For example, according to the basic format of sample encrypted traffic data, each traffic data is split separately; the source IP address, destination IP address, protocol and other information content of each traffic data are extracted separately. Afterwards, the extracted data can be marked separately, and the features corresponding to the data can be extracted at the same time. For example, the extracted malicious encrypted traffic data and normal encrypted traffic data are marked separately, that is, a marking label content, such as 0 or 1, is added to the data packets contained in each type of traffic data, where 0 represents that the part of traffic data is malicious traffic data, and 1 represents that the part of traffic data is normal encrypted traffic data. For each type of traffic data, the main extracted features may include: data packet size, protocol type, data packet sending time interval, data packet type, etc.
[0081] Thus, by performing encrypted traffic detection on the sample traffic data, the sample encrypted traffic data is obtained; multi-feature extraction and feature data fusion are performed on the sample encrypted traffic data to obtain sample feature vector data corresponding to the sample encrypted traffic data; based on the sample feature vector data corresponding to the sample encrypted traffic data, the random forest classification model is optimized to obtain a classification detection model, and a classification detection model with high detection efficiency is effectively trained.
[0082] In some embodiments, the sample feature vector data corresponding to the sample encrypted traffic data includes: a plurality of feature vectors, each feature vector corresponding to a feature weight.
[0083] Based on the sample feature vector data corresponding to the sample encrypted traffic data, the random forest classification model is optimized to obtain a classification detection model, including:
[0084] The sample feature vector data corresponding to the sample encrypted traffic data is input into the random forest classification model, and the detection result of the sample encrypted traffic data is determined based on the output result of the random forest classification model; if the detection result of the sample encrypted traffic data does not meet the preset conditions, the decision tree of the random forest classification model is updated based on the feature weight corresponding to each feature vector to obtain a classification detection model.
[0085] Among them, updating the decision tree of the random forest classification model based on the feature weight corresponding to each feature vector to obtain the classification detection model may include: constructing a decision tree in the random forest classification model based on the feature weight corresponding to each feature vector, and calculating the classifier weight of the random forest classification model according to the classification result data of the decision tree (such as the ratio of the number of correct classifications to the number of all features, and the ratio of the mean cost to the mean number of features), and detecting whether the classification result of the decision tree meets the preset conditions through the classifier weight. If so, the classification detection model is obtained.
[0086] For example, the extracted feature vector set (i.e., sample feature vector data) is input into the random forest classification model, and the weight value w of each feature vector is set 1,k , the feature weight set Z can be expressed as the following formula (1).
[0087] Z=[w 1,1 ,w 1,2 ,...,w 1,k ] k>1 (1)
[0088] The random forest algorithm is used to construct a decision tree based on the feature vector set, and the weight value of the feature weight set is updated. The weight value update of the feature weight set is shown in formula (2).
[0089] Z m+1 =[w m+1,1 ,w m+1,2 ,...,w m+1,n ] k>1 (2)
[0090] In formula (2), m is the number of updates.
[0091] Randomly sample the feature vector set to generate a training set, build a new decision tree, and use the original feature set data to classify the new decision tree and calculate the error rate. The decision tree classification principle is as follows Figure 2 shown.
[0092] For feature sets that can be correctly classified, the corresponding weight values will naturally decrease after updating, that is, the probability of being detected in the next synthesis process will naturally decrease; on the contrary, for feature sets that are not correctly classified, it is necessary to improve a certain degree of adaptability to ensure the correctness of the next classification result. Therefore, the confusion factor is introduced to ensure that the sum of the weights of all feature sets is regarded as a whole after each weight update, as shown in formula (3).
[0093]
[0094] In formula (3), f is the confusion factor, α is the general parameter, δ is the weight balance coefficient, and e is the number of features under the correct classification result (i.e., the number of feature vectors).
[0095] After the overall performance of the random forest classification model is improved, the new feature data will be resampled according to the weight to obtain a new training set, and the corresponding new decision tree will be generated again. After all decision trees are generated, the classifier weight value corresponding to each decision tree is calculated, as shown in formula (4).
[0096] W=2 / (X -1 +Y -1 ) (4)
[0097] In formula (4), W is the classifier weight value corresponding to the decision tree, X is the ratio of the number of correct classifications of the decision tree to the number of all features, and Y is the ratio of the average cost to the average number of features.
[0098] When the classification accuracy of a decision tree is high, the number of correct classifications will also be greater, that is, the larger the value of X. If the classification accuracy of a decision tree is optimal and the cost is the lowest, its classification performance is optimal and the corresponding weight value is larger, then the result output by this decision tree is the detection result of malicious encrypted traffic.
[0099] In some embodiments, before performing multi-feature extraction on the sample encrypted traffic data to obtain multi-feature extraction data corresponding to the sample encrypted traffic data, the method of this embodiment further includes:
[0100] Check whether there is preset abnormal data in the sample encrypted traffic data; if it is detected that there is preset abnormal data in the sample encrypted traffic data, delete the preset abnormal data from the sample encrypted traffic data.
[0101] Among them, the preset abnormal data includes: data with missing values and data with incomplete data structure.
[0102] After obtaining the sample encrypted traffic data, multi-feature extraction is performed on the sample encrypted traffic data. Before obtaining the multi-feature extraction data corresponding to the sample encrypted traffic data, data cleaning operations can be performed to remove data with missing values or incomplete data structures.
[0103] Data cleaning operations are mainly used to filter out abnormal data, such as missing IP addresses or encryption protocols in data packets. Manual and script software are used to clean the collected sample encrypted traffic data to ensure that all traffic data can maintain content integrity.
[0104] In some embodiments, the multi-feature extraction data corresponding to the sample encrypted traffic data includes: multiple extracted features, each extracted feature corresponds to a feature category, and the feature category is used to describe whether the extracted feature belongs to a malicious traffic encryption category or a non-malicious traffic encryption category.
[0105] The multi-feature extraction data corresponding to the sample encrypted traffic data is subjected to feature data fusion to obtain sample feature vector data corresponding to the sample encrypted traffic data, including:
[0106] Based on the category to which each extracted feature belongs, multiple extracted features are classified; the principal component analysis method is used to perform dimensionality reduction on the classified multiple extracted features to obtain multiple normalized data; based on the category to which the feature corresponding to each normalized data belongs, multiple normalized data are feature fused to obtain sample feature vector data corresponding to the sample encrypted traffic data.
[0107] Among them, feature data fusion mainly realizes the fusion processing of multiple different features. After standardizing and reducing the dimension of the obtained multi-feature extraction data, the multi-feature fusion technology is used to convert the multiple different features into a single, longer feature vector, which is used as the input data of the detection model.
[0108] For example, feature screening is performed on multi-feature extracted data, and feature data of different sizes and lengths are classified according to the categories to which the features belong; the categories to which the features belong are divided into malicious encrypted traffic categories such as those in Table 1, namely Zeus, Htbot, Sathurbot, Opencandy, Barys, etc., and normal encrypted traffic types; the principal component analysis method is used to perform dimensionality reduction processing on all classified feature set data to achieve a normalized effect; according to the categories to which the features belong, multiple different features are superimposed together using multi-feature fusion technology to construct a single, longer feature vector, and finally a feature vector set is formed, which is used as the input data of the detection model. The input data is a single, longer feature vector formed by multi-feature fusion processing of multiple different features under each type, which converges into the final feature vector set.
[0109] The feature data fusion process mainly adopts the weighted sum kernel function method. On the basis of multiple extracted single features, the fusion method is used to construct and transform multiple single features into a feature kernel function. By combining multiple basic functions to replace the function of a single kernel function, the kernel function selection problem can be converted into the corresponding combination coefficient selection problem.
[0110] In this embodiment, by obtaining target encrypted traffic data; performing multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data; performing feature data fusion on the multi-feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data; inputting the target feature vector data corresponding to the target encrypted traffic data into the classification detection model, and determining the detection result of the target encrypted traffic data based on the output result of the classification detection model. In this way, by performing multi-feature extraction on the encrypted traffic data, highly representative features can be extracted, and multiple features of the encrypted traffic data can be effectively unified by multi-feature fusion, so as to improve the model detection efficiency of malicious encrypted traffic.
[0111] In some embodiments, the method of this embodiment further includes:
[0112] If it is determined based on the detection result of the target encrypted traffic data that the target encrypted traffic data belongs to the malicious encrypted traffic type, then the data volume ratio of the target encrypted traffic data in the original encrypted traffic data to which it belongs is obtained, and the target encrypted traffic data is part of the traffic data in the original encrypted traffic data; based on the data volume ratio of the target encrypted traffic data in the original encrypted traffic data to which it belongs, a corresponding early warning prompt is generated.
[0113] Among them, based on the proportion of the data volume of the target encrypted traffic data in the original encrypted traffic data to which it belongs, a corresponding early warning prompt is generated, which may include: if the proportion of the data volume of the target encrypted traffic data in the original encrypted traffic data to which it belongs is greater than or equal to a preset proportion threshold, it means that the target encrypted traffic data accounts for a large proportion in the original encrypted traffic data to which it belongs, and the corresponding network intrusion risk coefficient is high, and a first-level early warning prompt is generated; if the proportion of the data volume of the target encrypted traffic data in the original encrypted traffic data to which it belongs is less than the preset proportion threshold, it means that the target encrypted traffic data accounts for a small proportion in the original encrypted traffic data to which it belongs, and the corresponding network intrusion risk coefficient is low, and a second-level early warning prompt is generated; the prompt level of the first-level early warning prompt is higher than the prompt level of the second-level early warning prompt.
[0114] Therefore, by the proportion of the target encrypted traffic data in the original encrypted traffic data to which it belongs, a corresponding early warning prompt is generated, which facilitates timely and intuitive knowledge of the risk level of malicious encrypted traffic data.
[0115] In the specific experimental results of this embodiment, the training data shown in Table 1 is used to train the random forest classification model, and the experimental environment is configured under the Windows 10 operating system, 64G memory, Python 3.7 and other environments. This embodiment compares four different detection models on the test set, namely, the random forest algorithm detection model based on multi-feature fusion technology (i.e., the classification detection model in this embodiment), the detection model based on the random forest algorithm, the detection model based on the support vector machine algorithm, and the detection model based on the XGBost algorithm. Table 2 shows the final detection effect and detection efficiency of different detection models.
[0116] Table 2 Experimental verification results
[0117]
[0118] Table 2 shows the effect comparison between various detection models. The classification detection model in this embodiment has better overall detection effect than other detection models, and has achieved the best results in accuracy, precision, recall rate, and F1 score.
[0119] This embodiment mainly completes the detection of malicious encrypted traffic through three processes: data preprocessing, multi-feature fusion processing, and traffic classification detection. Data preprocessing process: clean the data to remove data with missing values or incomplete data structure. Data preprocessing process: segment the cleaned data and extract encrypted traffic related data such as source IP address, destination IP address, protocol, etc. according to the basic format of traffic data. Data preprocessing process: mark the extracted data separately, and extract all features corresponding to the data at the same time, and finally form a feature set. Multi-feature fusion processing process: use principal component analysis to reduce the dimension of all feature set data to achieve normalization. Multi-feature fusion processing process: use multi-feature fusion technology to superimpose multiple different features together to construct a single, longer feature vector, and finally form a feature vector set, which is used as the input data of the detection model. Traffic classification detection process: Use the random forest algorithm to build a decision tree based on the feature vector set and update the weight value in the feature set; randomly sample the feature set to generate a training set, build a new decision tree, and use the original feature set data to classify the new decision tree and calculate the error rate; after the overall performance of the random forest algorithm detection model is improved, the new feature data will be resampled according to the weight size to obtain a new training set and generate a corresponding new decision tree. When all decision trees are generated, calculate the classifier weight value corresponding to each decision tree; if a decision tree has the best classification accuracy and the lowest cost, then its classification performance is the best, and the corresponding weight value is larger, then the result output by this decision tree is the malicious encrypted traffic detection result.
[0120] In summary, this embodiment can greatly improve the detection efficiency of malicious encrypted traffic by preprocessing the original traffic data and converting multiple different features into a single feature vector data using multi-feature fusion technology as the input data of the random forest algorithm detection model. At the same time, comparative analysis with other detection models shows that this method can achieve better detection results in malicious encrypted traffic detection tasks.
[0121] Figure 3 This is a schematic diagram of the structure of a malicious encrypted traffic detection device provided in this embodiment. The malicious encrypted traffic detection device may include: an acquisition module 310, an extraction module 320, a fusion module 330 and a determination module 340.
[0122] The acquisition module 310 is used to acquire target encrypted traffic data.
[0123] The extraction module 320 is used to perform multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data.
[0124] The fusion module 330 is used to perform feature data fusion on multiple feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data.
[0125] The determination module 340 is used to input the target feature vector data corresponding to the target encrypted traffic data into the classification detection model, and determine the detection result of the target encrypted traffic data based on the output result of the classification detection model.
[0126] In this embodiment, optionally, the extraction module 320 is specifically used to:
[0127] Data extraction is performed on the target encrypted traffic data based on preset category extraction rules to obtain rule-extracted data; feature extraction is performed on the rule-extracted data based on preset feature extraction rules to obtain multi-feature extraction data corresponding to the target encrypted traffic data.
[0128] Among them, the preset category extraction rules are used to extract data corresponding to the preset categories, and the preset categories include: source IP address, target IP address and communication protocol; the preset feature extraction rules are used to extract data corresponding to the preset features, and the preset features include: data packet capacity, protocol type, data packet sending time interval and data packet type.
[0129] In this embodiment, optionally, it also includes: a detection module and a processing module.
[0130] The acquisition module 310 is also used to acquire sample flow data.
[0131] The detection module is used to perform encrypted traffic detection on the sample traffic data to obtain the sample encrypted traffic data. The encrypted traffic detection is used to identify the encrypted traffic data and the non-encrypted traffic data in the sample traffic data.
[0132] The extraction module 320 is also used to perform multi-feature extraction on the sample encrypted traffic data to obtain multi-feature extraction data corresponding to the sample encrypted traffic data.
[0133] The fusion module 330 is also used to perform feature data fusion on multiple feature extraction data corresponding to the sample encrypted traffic data to obtain sample feature vector data corresponding to the sample encrypted traffic data.
[0134] The processing module is used to optimize the random forest classification model based on the sample feature vector data corresponding to the sample encrypted traffic data to obtain a classification detection model.
[0135] In this embodiment, optionally, the sample feature vector data corresponding to the sample encrypted traffic data includes: a plurality of feature vectors, each feature vector corresponding to a feature weight.
[0136] Processing module, specifically used for:
[0137] The sample feature vector data corresponding to the sample encrypted traffic data is input into the random forest classification model, and the detection result of the sample encrypted traffic data is determined based on the output result of the random forest classification model; if the detection result of the sample encrypted traffic data does not meet the preset conditions, the decision tree of the random forest classification model is updated based on the feature weight corresponding to each feature vector to obtain a classification detection model.
[0138] In this embodiment, optionally, it also includes: a deletion module.
[0139] The detection module is also used to detect whether there is preset abnormal data in the sample encrypted traffic data.
[0140] The deletion module is used to delete the preset abnormal data from the sample encrypted traffic data if it is detected that there is preset abnormal data in the sample encrypted traffic data.
[0141] Among them, the preset abnormal data includes: data with missing values and data with incomplete data structure.
[0142] In this embodiment, optionally, the multi-feature extraction data corresponding to the sample encrypted traffic data includes: multiple extracted features, each extracted feature corresponds to a feature category, and the feature category is used to describe whether the extracted feature belongs to a malicious traffic encryption category or a non-malicious traffic encryption category.
[0143] The fusion module 330 is specifically used for:
[0144] Based on the category to which each extracted feature belongs, multiple extracted features are classified; the principal component analysis method is used to perform dimensionality reduction on the classified multiple extracted features to obtain multiple normalized data; based on the category to which the feature corresponding to each normalized data belongs, multiple normalized data are feature fused to obtain sample feature vector data corresponding to the sample encrypted traffic data.
[0145] In this embodiment, optionally, it also includes: a generation module.
[0146] The acquisition module 310 is also used to obtain the data volume ratio of the target encrypted traffic data in the original encrypted traffic data to which it belongs if it is determined based on the detection result of the target encrypted traffic data that the target encrypted traffic data belongs to a malicious encrypted traffic type. The target encrypted traffic data is part of the traffic data in the original encrypted traffic data.
[0147] The generation module is used to generate corresponding early warning prompts based on the proportion of the target encrypted traffic data in the original encrypted traffic data to which it belongs.
[0148] The malicious encrypted traffic detection device provided by the present disclosure can execute the above method embodiments. Its specific implementation principles and technical effects can be found in the above method embodiments, and the present disclosure will not repeat them here.
[0149] The present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0150] The computer device includes a memory 410 and a processor 420 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with a memory 410 and a processor 420, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0151] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.
[0152] The memory 410 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 410 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 410 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card or a flash card (FlashCard) equipped on the computer device. Of course, the memory 410 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 410 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 410 may also be used to temporarily store various data that have been output or are to be output.
[0153] The processor 420 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 410 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 420 is used to execute the program codes or instructions stored in the memory 410 or process data, such as running the program code of the above method.
[0154] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0155] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.
[0156] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.
[0157] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.
[0158] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0159] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0160] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0161] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
[0162] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for detecting malicious encrypted traffic, characterized in that: include: Obtain target encrypted traffic data; Performing multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data; Performing feature data fusion on multiple feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data; The target feature vector data corresponding to the target encrypted traffic data is input into a classification detection model, and the detection result of the target encrypted traffic data is determined based on the output result of the classification detection model.
2. The method according to claim 1, characterized in that The performing multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data includes: Extracting the target encrypted traffic data based on a preset category extraction rule to obtain rule-extracted data; Perform feature extraction on the rule-extracted data based on a preset feature extraction rule to obtain multiple feature extraction data corresponding to the target encrypted traffic data; Among them, the preset category extraction rules are used to extract data corresponding to the preset categories, and the preset categories include: source IP address, target IP address and communication protocol; the preset feature extraction rules are used to extract data corresponding to the preset features, and the preset features include: data packet capacity, protocol type, data packet sending time interval and data packet type.
3. The method according to claim 1, characterized in that Before inputting the target feature vector data corresponding to the target encrypted traffic data into the classification detection model and determining the detection result of the target encrypted traffic data based on the output result of the classification detection model, the method further includes: Get sample traffic data; Performing encrypted traffic detection on the sample traffic data to obtain sample encrypted traffic data, wherein the encrypted traffic detection is used to identify encrypted traffic data and non-encrypted traffic data in the sample traffic data; Performing multi-feature extraction on the sample encrypted traffic data to obtain multi-feature extraction data corresponding to the sample encrypted traffic data; Performing feature data fusion on multiple feature extraction data corresponding to the sample encrypted traffic data to obtain sample feature vector data corresponding to the sample encrypted traffic data; Based on the sample feature vector data corresponding to the sample encrypted traffic data, the random forest classification model is optimized to obtain the classification detection model.
4. The method according to claim 3, characterized in that The sample feature vector data corresponding to the sample encrypted traffic data includes: a plurality of feature vectors, each of which has a corresponding feature weight; The optimizing process of the random forest classification model based on the sample feature vector data corresponding to the sample encrypted traffic data to obtain the classification detection model includes: Inputting the sample feature vector data corresponding to the sample encrypted traffic data into the random forest classification model, and determining the detection result of the sample encrypted traffic data based on the output result of the random forest classification model; If the detection result of the sample encrypted traffic data does not meet the preset conditions, the decision tree of the random forest classification model is updated based on the feature weight corresponding to each feature vector to obtain the classification detection model.
5. The method according to claim 3, characterized in that: Before extracting multiple features from the sample encrypted traffic data to obtain the multiple feature extraction data corresponding to the sample encrypted traffic data, the method further includes: Detecting whether there is preset abnormal data in the sample encrypted traffic data; If it is detected that the preset abnormal data exists in the sample encrypted traffic data, deleting the preset abnormal data from the sample encrypted traffic data; The preset abnormal data includes: data with missing values and data with incomplete data structure.
6. The method according to claim 3, characterized in that The multi-feature extraction data corresponding to the sample encrypted traffic data includes: a plurality of extracted features, each of the extracted features corresponds to a feature category, and the feature category is used to describe whether the extracted feature belongs to a malicious traffic encryption category or a non-malicious traffic encryption category; The step of fusing the multiple feature extraction data corresponding to the sample encrypted traffic data to obtain the sample feature vector data corresponding to the sample encrypted traffic data includes: Classifying the plurality of extracted features based on the category to which each extracted feature corresponds; Using principal component analysis to perform dimensionality reduction processing on the classified plurality of extracted features to obtain a plurality of normalized data; Based on the category to which the feature corresponding to each of the normalized data belongs, feature data of the plurality of normalized data are fused to obtain sample feature vector data corresponding to the sample encrypted traffic data.
7. The method according to claim 1, characterized in that Also includes: If it is determined based on the detection result of the target encrypted traffic data that the target encrypted traffic data belongs to a malicious encrypted traffic type, then the data volume ratio of the target encrypted traffic data in the original encrypted traffic data to which it belongs is obtained, and the target encrypted traffic data is part of the traffic data in the original encrypted traffic data; Based on the proportion of the target encrypted traffic data in the original encrypted traffic data to which it belongs, a corresponding early warning prompt is generated.
8. A malicious encrypted traffic detection device, characterized in that: include: An acquisition module, used to acquire target encrypted traffic data; An extraction module, used to perform multi-feature extraction on the target encrypted traffic data to obtain multi-feature extraction data corresponding to the target encrypted traffic data; A fusion module, used for performing feature data fusion on multiple feature extraction data corresponding to the target encrypted traffic data to obtain target feature vector data corresponding to the target encrypted traffic data; A determination module is used to input the target feature vector data corresponding to the target encrypted traffic data into a classification detection model, and determine the detection result of the target encrypted traffic data based on the output result of the classification detection model.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method for detecting malicious encrypted traffic as claimed in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the malicious encrypted traffic detection method as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Flow detection method, system and device based on malicious encryption and medium
CN115865534A
Malicious encrypted traffic detection method and device, storage medium and electronic equipment
CN117579379A
Traffic detection method and apparatus, server, and storage medium
WO2021207984A1
Cited By
Encrypted malicious traffic detection method and device and electronic equipment
CN119766487A
Malicious encrypted traffic detection method and system
CN119996075A
Network flow intelligent cleaning method and system based on multi-dimensional feature matching, and medium
CN120856596A
Encrypted malicious traffic detection method, system and device of industrial control system, medium and product
CN121309213A
A method, system, device, medium and product for detecting encrypted malicious traffic of an industrial control system
CN121309213B
