Method and device for constructing HTTP distributed denial of service attack detection model

Through the high-speed packet processing framework and Berkeley packet filter to extract features, the Gaussian Naive Bayes algorithm is used to detect HTTP DDoS attacks, which solves the problems of unstable detection results and high computing resources in the existing technology, and achieves a more efficient and stable Attack identification.

CN118612083APending Publication Date: 2024-09-06GUANGZHOU UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410724784.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing technologies require a large amount of data and high computing resources when detecting HTTP distributed denial-of-service attacks (DDoS). The detection results have low adaptability and are unstable, making it difficult to effectively distinguish between normal and attack traffic.

Method used

Use a high-speed packet processing framework and extended Berkeley packet filter to extract feature data sets, use Gaussian Naive Bayes algorithm to build a classifier, and distinguish normal and attack traffic through features such as request frequency, time interval, and response data size. .

Benefits of technology

It improves the adaptability and stability of detection results, simplifies the amount of calculation, is suitable for running in the Linux kernel, does not rely on specialized hardware or software, can identify multiple attack types, and provides more stable detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612083A
    Figure CN118612083A
Patent Text Reader

Abstract

The invention relates to an HTTP distributed denial of service attack detection model construction method and device. The method comprises the following steps: collecting data by using a high-speed data packet processing framework; based on an extended Berkley packet filter, classifying the data to obtain a feature data set; according to the feature data set, training a preset algorithm model to obtain a trained algorithm model; acquiring a test data set by using a high-speed data packet processing framework; and verifying the trained algorithm model according to the test data set to obtain a Gaussian naive Bayes algorithm classifier model. The problems that in the prior art, a large amount of data is needed to serve as training data, the algorithm is complex, the requirement for computing resources is high, the detection result is greatly influenced by the training data, adaptability is low, and the result is unstable are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data classification and data detection, and specifically to a method and device for constructing an HTTP distributed denial of service attack detection model. Background Art

[0002] In recent years, Distributed Denial of Service (DDoS) attackers have paid more attention to HTTP DDoS because of its better concealment. HTTP DDoS attacks launched at the application layer pose a challenge to detection because the attacker's request packets are very similar to those of normal users, and HTTP DDoS attacks launched at the application layer are usually less expensive and only require lower bandwidth to prevent normal users from accessing the server.

[0003] The existing technologies are mainly divided into several categories: detection methods based on behavioral analysis, detection methods based on machine learning, and detection methods based on deep learning. The detection method based on behavioral analysis detects HTTP DDoS attacks by analyzing and identifying abnormal behaviors in network traffic. The HTTP DDoS attack detection method based on machine learning uses machine learning algorithms to learn the characteristics of HTTP DDoS attacks from a large amount of network traffic data, and builds a classifier to determine whether the network traffic is attack traffic. The HTTP DDoS attack detection method based on deep learning uses deep learning algorithms such as deep neural networks (DNN) or convolutional neural networks (CNN) to learn the characteristics of HTTP DDoS attacks from a large amount of network traffic data, and build a model to determine whether the network traffic is attack traffic.

[0004] Existing technologies require a large amount of data as training data, the algorithms are complex and require high computing resources, the detection results are greatly affected by the training data, the adaptability is low and the results are unstable. Summary of the invention

[0005] In view of the above problems, the purpose of this application is to provide a method and device for building an HTTP distributed denial of service attack detection model.

[0006] According to the first aspect of the embodiment of the present application, a method for constructing an HTTP distributed denial of service attack detection model is provided, characterized in that it includes: using a high-speed data packet processing framework to collect data; based on an extended Berkeley packet filter, classifying the data to obtain a feature data set; based on the feature data set, training a preset algorithm model to obtain a trained algorithm model; using a high-speed data packet processing framework to obtain a test data set; based on the test data set, verifying the trained algorithm model to obtain a Gaussian Naive Bayes algorithm classifier model. Further, the method further includes: using a high-speed data packet processing framework to obtain container network traffic; based on an extended Berkeley packet filter, extracting features from the container network traffic to obtain a feature attribute data set; based on a preset Gaussian Naive Bayes algorithm classifier model, taking the feature attribute data set as input, outputting a normal data set and an attack data set.

[0007] Furthermore, the method classifies the data based on the extended Berkeley packet filter to obtain a feature data set, including: extracting features from the data based on the extended Berkeley packet filter to obtain feature attributes; and marking the training data set as a normal sample set and an attack sample set according to the feature attributes to obtain a feature data set.

[0008] Further, the extended Berkeley packet filter performs feature extraction on the data to obtain feature attributes, including: the feature attributes include one or more of the request frequency feature, the request time interval feature, the response data size feature, the request and response time interval feature and the POST data packet feature. In the data, the user's access frequency within a preset time is extracted to obtain the request frequency feature; in the data, the user's access time interval is extracted to obtain the request time interval feature; based on the data, the ratio of the user's request time interval to the response data packet size is calculated to obtain the response data size feature; in the data, the time required for the server to process the request data packet is extracted to obtain the request and response time interval feature; in the data, the POST data packet chunk.length data is extracted to obtain the POST data packet feature. According to the second aspect of the embodiment of the present application, there is provided an HTTP distributed denial of service attack detection model construction device, characterized in that it includes: a training data acquisition module, used to collect data using a high-speed data packet processing framework; a feature extraction module, used to classify the data based on an extended Berkeley packet filter to obtain a feature data set; a classifier training module, used to train a preset algorithm model according to the feature data set to obtain a trained algorithm model; a test data acquisition module, used to obtain a test data set using a high-speed data packet processing framework; a classifier verification module, used to verify the trained algorithm model according to the test data set to obtain a Gaussian Naive Bayes algorithm classifier model.

[0009] Furthermore, the device further includes: a using module for obtaining container network traffic using a high-speed data packet processing framework; extracting features from the container network traffic based on an extended Berkeley packet filter to obtain a feature attribute data set; based on a preset Gaussian Naive Bayes algorithm classifier model, taking the feature attribute data set as input, outputting a normal data set and an attack data set.

[0010] Furthermore, the feature extraction module is specifically used to: extract features from the data based on an extended Berkeley packet filter to obtain feature attributes; and mark the training data set as a normal sample set and an attack sample set according to the feature attributes to obtain a feature data set.

[0011] Furthermore, the feature extraction module is specifically used for: the feature attributes include one or more of the request frequency feature, the request time interval feature, the response data size feature, the request and response time interval feature and the POST data packet feature; in the data, the user's access frequency within a preset time is extracted to obtain the request frequency feature; in the data, the user's access time interval is extracted to obtain the request time interval feature; based on the data, the ratio of the user's request time interval to the response data packet size is calculated to obtain the response data size feature; in the data, the time required for the server to process the request data packet is extracted to obtain the request and response time interval feature; in the data, the POST data packet chunk.length data is extracted to obtain the POST data packet feature.

[0012] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; a memory for storing processor executable instructions; a processor, configured to read executable instructions from the memory and execute the instructions to implement a method for constructing an HTTP distributed denial of service attack detection model provided in the first aspect of the present application.

[0013] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, a method for constructing an HTTP distributed denial of service attack detection model provided in the first aspect of the present application is implemented.

[0014] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0015] This application obtains a training data set, processes the training data set, and obtains a training data set with characteristic attributes. The training data set with characteristic attributes is a characteristic attribute adapted to characterize HTTP DDoS attack means. The characteristic attributes cover a variety of HTTP DDoS attack features, and enhance the adaptability and stability of the result data. The test data set verifies the algorithm model after training, and obtains the Gaussian Naive Bayesian algorithm classifier model to ensure the quality of the calculation results of the Gaussian Naive Bayesian algorithm classifier model. The algorithm model is relatively simple, the amount of calculation is small, and no additional library support is required. It is suitable for running in the Linux kernel and does not require special hardware or software. The algorithm of this application is simple, does not take up space, uses specific feature extraction, expands coverage of more types of attack types, and the results are more stable. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0017] Figure 1 is a flow chart of a method for constructing a HTTP distributed denial of service attack detection model according to an exemplary embodiment;

[0018] Figure 2 It is a model use flow chart of a method for constructing a HTTP distributed denial of service attack detection model according to an exemplary embodiment;

[0019] Figure 3 It is a device diagram of a method for constructing an HTTP distributed denial of service attack detection model according to an exemplary embodiment. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.

[0021] Exemplary Method 1

[0022] like Figure 1As shown, the embodiment of the present application provides a method for constructing an HTTP distributed denial of service attack detection model, including the following steps:

[0023] In step S101, data is collected using a high-speed packet processing framework.

[0024] High-speed packet processing framework,PF_RING is a fast network packet processing technology that enables applications to handle large amounts of network traffic with minimal resource overhead by providing a high-speed and efficient packet capture environment.PF_RING is particularly suitable for building high-performance network monitoring and analysis tools because it can reduce the CPU usage of packet capture and reduce packet loss.

[0025] PF_RING efficiently captures inbound HTTP request packets from the network interface. PF_RING ensures fast and accurate data capture from network traffic due to its high-performance packet processing capabilities. These packets will be used as part of the dataset for subsequent training dataset processing. The captured data must contain complete HTTP request and response messages to ensure data integrity for subsequent analysis.

[0026] In step S102, the data is classified based on the extended Berkeley packet filter to obtain a feature data set.

[0027] Extended Berkeley Packet Filter (eBPF) is an extended BPF technology for the Linux kernel that can dynamically change the kernel's behavior at runtime by running custom BPF programs in the kernel. eBPF introduces many new features and optimizations, allowing it to support more types of programs, such as user space programs and kernel space programs, and can be safely loaded and unloaded at runtime. eBPF programs run in a virtual sandbox environment and can perform efficient packet processing at the kernel level, such as monitoring and network traffic analysis, while maintaining the security and stability of the system.

[0028] Based on the extended Berkeley packet filter, features are extracted from the data to obtain feature attributes; based on the feature attributes, the training data set is marked as a normal sample set and an attack sample set to obtain a feature data set.

[0029] Specifically, eBPF is used to perform preliminary analysis and classification on the packets captured from PF_RING. eBPF can efficiently perform packet filtering and feature extraction tasks in kernel space, extracting features that are critical to HTTP DDoS attack detection, and forming a training sample set that distinguishes normal and attack traffic. These samples will then be used to train the Gaussian Naive Bayes classifier.

[0030] The types of feature extraction include: request frequency features, request time interval features, response data size features, request and response time interval features and POST data packet feature values.

[0031] Specifically, request frequency feature extraction:

[0032] Describe the access frequency of users in a specific time. Take ten minutes as a time unit, and further subdivide it into 10 one-minute time windows. The number of user accesses in each window is counted. The user access request frequency characteristics are shown in Table 1. These access frequency data will be regarded as continuous variables, and the probability density function will be calculated through the Gaussian Naive Bayes model, and then the mean and variance of these data will be estimated. In this way, the changes in access frequency data can be fully utilized to improve the model's ability to detect abnormal traffic behavior.

[0033] Table 1 User access request frequency characteristics

[0034]

[0035] Request time interval feature extraction:

[0036] Describes the user's access time interval. The normal user's access time interval may be expressed as a large numerical and highly variable array, such as [247,578,10023,123,251], which reflects a random and irregular access pattern. In contrast, attackers usually generate very short time intervals, such as [1,2,1,3,1,2], in order to continue the attack, indicating a conscious and regular access pattern. The Gaussian Naive Bayes model calculates the mean and variance of the request time interval under each category, and then uses these parameters to calculate the probability density of the new request time interval to determine whether it is an attack behavior. By comparing with historical data, abnormal requests can be identified. The normal request frequency in different time periods (such as daytime and nighttime) may be different, and different Gaussian distribution parameters are assigned to data in different time periods. This method enables the Gaussian Naive Bayes model to more accurately distinguish normal traffic from abnormal traffic when detecting DDoS attacks.

[0037] Response data size feature extraction:

[0038] Describes the ratio of the user request time interval to the response data packet size. Due to human reading habits and reading ability, the amount of data returned by the response should be proportional to the time interval, that is, the larger the response data, the longer the reading time required, so the time interval for the next request is larger. Taking the time interval array of normal user access in the request time interval feature as an example, the sequence of normal users in this feature may be [21411 / 247 48925 / 578 70199 / 1002323131 / 123 34382 / 251]. The sequence of attackers in this feature may be [13242 / 1 52121 / 2 23513 / 189772 / 3 34252 / 1 23452 / 2], and the ratio is usually more than 100 times that of normal users. By calculating the Gaussian distribution parameters of the ratio of normal access and attack behavior, the probability density of the ratio of response data size to request time interval is calculated, which helps to determine whether it is a normal request or an attack behavior.

[0039] Request and response time interval feature extraction:

[0040] Describes the time required for the server to process a request packet. Under normal circumstances, the time required for the server to process user requests is roughly the same. When an attacker implements a large payload attack, a large amount of server CPU resources will be consumed, so the time required for the server to process user requests will be greatly increased. The response time interval is calculated in milliseconds. The sequence of a normal user in this feature may be [3 5 2 3 6], while the sequence of an attacker's feature may be [249 582 389 462 521]. The time interval between request and response is based on the data in and out of the server, regardless of network differences. By calculating the Gaussian distribution parameters and probability density, it is determined whether the behavior is a normal request or an attack behavior.

[0041] POST data packet feature value extraction:

[0042] Describes the abnormal data features in the POST data packet. Under normal circumstances, the chunk.length of the user's POST request data packet is random, but when the attacker implements a POST slow message body attack, the chunk.length is usually fixed and has a small value. The sequence of a normal user in this feature may be [287 578 179 493 272], while the feature sequence of an attacker may be [2 2 2 2 2]. Calculate the Gaussian distribution parameters of chunk.length under normal and attack behaviors, and then calculate the probability density of the chunk.length feature under normal and attack requests, thereby calculating the probability density of each category, and then determine whether the new data point belongs to an attack behavior by calculating the posterior probability.

[0043] In step S103, based on a preset algorithm, a trained algorithm model is obtained according to the training data set with characteristic attributes;

[0044] In addition to the direct impact of feature selection on the detection performance of the Gaussian Naive Bayes classifier, the key parameters of the classifier also have a significant impact on the detection efficiency. In this application, a series of detailed parameter tuning strategies are adopted to optimize the performance of the Gaussian Naive Bayes algorithm classifier. First, the Gaussian distribution parameters (mean and variance) of the features are adjusted according to the characteristics of the Gaussian Naive Bayes model to ensure that the model more accurately reflects the actual distribution of the data. This includes fine-tuning these parameters using real-time updates of the data to adapt to possible data changes. Secondly, feature selection methods such as information gain, mutual information, and correlation coefficients are used to screen out features with high correlation with the classification results. This helps to reduce the complexity of the model and improve the classification accuracy, especially when dealing with large data sets with multiple features. Finally, an automatic parameter optimization algorithm is used to optimize the model. This involves automatically finding the optimal combination of model parameters in a wide range of parameter spaces. In this way, manual intervention can be reduced while maintaining a high degree of accuracy and improving the overall performance of the model.

[0045] These methods are crucial to improving the generalization ability of the model and reducing the dimensionality of the feature space.

[0046] In order to solve the possible imbalance problem between normal traffic and attack traffic data, this application implements a strategy of real-time monitoring of network traffic ratio. When the attack traffic ratio is too low, the system automatically adjusts the resampling rate of the attack sample to maintain the balance of the training data.

[0047] For continuous features, Gaussian Naive Bayes directly uses the probability density function to estimate the conditional probability, thus avoiding the need to discretize the continuous features. This processing method helps to maintain the integrity of the data and the accuracy of the model. During the model implementation, the kernel width parameter of the Gaussian distribution was adjusted to find the optimal model configuration.

[0048] In addition, the feature sequences in this application will be converted into specific values ​​rather than existing in array form. These values ​​will be used as the basis for training the model based on whether they exceed a specific threshold. The setting of the threshold will be optimized and adjusted in actual testing to ensure the best performance of the classifier in different scenarios.

[0049] The Gaussian Naive Bayes algorithm is a special type of Naive Bayes classification algorithm that is used to process continuous data and assumes that the feature values ​​follow a Gaussian distribution (i.e., normal distribution). Like the basic Naive Bayes algorithm, the Gaussian Naive Bayes is also based on Bayes' theorem, but it uses a Gaussian probability density function when processing data features.

[0050] In the Gaussian Naive Bayes algorithm, the features of each category are assumed to follow a Gaussian distribution independently. This means that the value of each feature for a given category is centered around a simple Gaussian distribution. This distribution is defined by two parameters: mean (μ) and variance (σ2). Therefore, for a given category, the probability density of each feature can be expressed as follows:

[0051]

[0052] where x i represents the i-th feature dimension, σ ci and μ ci The distribution represents the feature x under category y=c i The corresponding standard deviation and expectation, c is the category of the feature.

[0053] In practical applications, the Gaussian Naive Bayes algorithm has a similar workflow to the Naive Bayes algorithm. First, the algorithm needs to calculate the mean and variance of each feature under each category from the training data. Then, for each new sample point, the algorithm uses these parameters to calculate the probability density of each feature, and then calculates the posterior probability that the sample point belongs to each category.

[0054] Based on the preset model, the training data set with characteristic attributes is used as input to output a normal training data set and an attack training data set. According to the normal training data set and the attack training data set, a training evaluation value is obtained; it is judged whether the training evaluation value reaches the preset evaluation value, if so, the training is terminated and the algorithm model after training is obtained, if not, the model is continued to be trained.

[0055] Use the prepared data set to train the Gaussian Naive Bayes classifier, which includes calculating the Gaussian distribution parameters of each feature under the normal and attack categories, such as the mean and variance, and then recording and saving the calculated parameters for subsequent verification and testing. The trained model can be stored for future rollback to the historical version, or enter the next stage for model testing.

[0056] In an embodiment of the present application, based on the mathematical formula of Gaussian Naive Bayesian Theorem, it is possible to estimate whether the traffic behavior of an IP address belongs to an attack type. Consider a specific IP whose request frequency is significantly higher than the mean of normal traffic, while the request time interval and response data size are both lower than the mean of attack traffic. In the Gaussian Naive Bayesian model, these observed eigenvalues ​​can help calculate the probability of an IP carrying out a malicious attack. For this IP, add x1 to represent the request frequency, x2 to represent the request time interval, and x3 to represent the response data size. According to the Gaussian Naive Bayesian model, the posterior probability P(attack|x1,x2,x3) of the existence of malicious attack behavior can be calculated by the following formula:

[0057] P=(attack|x1,x2,x3)∝P(x1|attack)·P(x2|attack)·P(x3|attack)·P(attack)

[0058] Where: P(x1|attack) represents the probability density of the request frequency feature value being higher than the attack threshold. P(x2|attack) represents the probability density of the request time interval feature value being lower than the attack threshold. P(x3|attack) represents the probability density of the response data size feature value being lower than the attack threshold. P(attack) is the prior probability, that is, the probability that the IP address behavior is an attack before any feature value is observed.

[0059] If P(attack|x1,x2,x3) is significant, it can be determined with a high probability that the traffic from the IP address is malicious.

[0060] In the embodiment of the present application, the Gaussian Naive Bayes algorithm is used. The algorithm is simple to implement and has a small amount of calculation. It is suitable for data classification problems with continuous numerical features. It has strong adaptability to problems such as data noise and missing data, and can handle complex and large data sets and maintain high classification accuracy. The algorithm is based on the probability density function of the Gaussian distribution, and the classification results are easy to understand and explain. The algorithm has a fast processing speed and is very suitable for real-time detection systems, and can respond to HTTP DDoS attacks in a timely manner.

[0061] Specifically, programs running in the kernel must follow the design principles of the kernel, avoid complex algorithms and data structures, avoid over-reliance on external third-party libraries or tools, and maintain ease of use as much as possible. Based on these rules, this application uses the Gaussian Naive Bayes algorithm to process and classify large amounts of network data. This method shows significant advantages in detecting HTTP DDoS attacks. The Gaussian Naive Bayes algorithm can effectively process continuous data features, such as request frequency and packet size, and it is suitable for real-time data analysis in high-speed network environments. This algorithm is computationally simple and efficient, does not rely on complex external libraries, is suitable for data processing at the kernel level, follows the design principles of the kernel and maintains ease of use.

[0062] The process of HTTP distributed denial of service attack detection is ongoing, and the classifier will continuously receive and process new data packets. If it is detected that the classification performance does not meet expectations in the actual application environment, we will take measures to retrain the classifier. The Gaussian distribution parameters are updated by reflecting the data of the current network behavior to ensure that the model can accurately reflect the latest traffic characteristics and attack patterns. In order to maintain the accuracy and adaptability of the classifier, we conduct regular evaluations and make corresponding adjustments based on the evaluation results. For example, adjust the core parameters of the Gaussian Naive Bayes model or adjust the eBPF program to better filter and preprocess inbound packets. In this way, we can ensure that the classifier maintains its effectiveness in a changing network environment and adapts to new attack trends in a timely manner.

[0063] Combining eBPF and PF_RING technologies, the present application can achieve efficient packet capture and preprocessing at the kernel level, reducing the overhead of traditional user space solutions. This method speeds up the data processing process, making the detection of HTTP DDoS attacks faster and more accurate. Since it does not rely on expensive hardware or specific software, this solution can provide efficient detection services at a low cost in a cloud environment, meeting the needs of modern container environments for network security and high availability. Therefore, in terms of solving technical problems and achieving the purpose of the invention, the present application provides an economical and effective HTTP DDoS attack detection solution.

[0064] In step S104, a high-speed data packet processing framework is used to obtain a test data set.

[0065] The test data set needs to be a mixture of two types of data packets: normal user data samples and HTTP DDoS data samples. These data packets are captured by PF_RING.

[0066] In step S105, the trained algorithm model is verified according to the test data set to obtain a Gaussian Naive Bayes algorithm classifier model.

[0067] Based on the extended Berkeley packet filter, features are extracted according to the test data set to obtain a test data set with feature attributes. The data set processing and feature extraction are performed in two stages through eBPF. The data set after processing and feature extraction will be used for testing the classifier model.

[0068] Based on the trained algorithm model, taking the test data set with characteristic attributes as input, after classification, outputting a test normal data set and a test attack data set;

[0069] According to the test normal data set and the test attack data set, detect whether the classification of each element in the test data set is correct, and according to the detection result, calculate the classification accuracy corresponding to the test data set as the test evaluation value;

[0070] Determine whether the test evaluation value reaches the preset evaluation value. If so, end the test and obtain a classifier model based on the Gaussian Naive Bayes algorithm. If not, retrain the model.

[0071] The classifier estimates the probability of each test sample, calculates the probability of it being normal or attack, and classifies the sample into the category with the highest probability. An overall performance evaluation is performed on all the results generated by the test, and the performance evaluation will take into account factors such as accuracy, precision, and processing time. The higher the accuracy, the more normal and attack requests can be identified, and the higher the precision, the fewer false positives. If the test results do not meet the expected standards, the parameters of the Gaussian Naive Bayes model will be adjusted or the features will be reselected as needed, and then the model will be retrained. After obtaining satisfactory test results, the trained model parameters will be saved to the classifier loader for quick access during real-time classification. This loader will store the Gaussian distribution parameters of the model, so that the Gaussian Naive Bayes algorithm can be effectively applied when classifying new samples.

[0072] After the model test results are satisfactory, the model data is sent to the classification manager. The main function of the classification model manager is to store the parameters of the Gaussian Naive Bayes classification model after training, especially the mean and variance of each feature in each category. This allows the system to quickly call these parameters when classifying new samples in the future, and evaluate the possibility of samples being normal or attacking through the Gaussian probability density function.

[0073] In an embodiment of the present application, the display module can display various important information of the HTTP DDoS detection system to the user, mainly including: real-time statistics of the accuracy of the classifier model, the blacklist of IP addresses classified as malicious users, classifier model parameters (for example, the mean and variance of the Gaussian distribution of each feature in each category), the number of users to be classified, the historical version of the classifier model, the execution classification conditions and other system information.

[0074] In addition to displaying important system information, it also has certain system control functions, which can easily modify some information in the system. Mainly including: export, clear and add operations of IP address blacklist, historical version rollback function of classifier model, classification condition modification, clearing of user list to be classified, etc. With these control functions, users can easily use this module in user space to modify important system data at any time.

[0075] Exemplary Method 2

[0076] like Figure 2 As shown, the embodiment of the present application provides a method for using a constructed HTTP distributed denial of service attack detection model, including the following steps:

[0077] In step S201, a high-speed data packet processing framework is used to obtain container network traffic.

[0078] HTTP DDoS is based on the Hypertext Transfer Protocol (HTTP). Attackers can simulate requests from normal users and use various technical means to make the characteristics of attack traffic difficult to distinguish. However, some security defense software currently used for containers is not yet perfect. Large-volume DDoS attacks can cause the complete paralysis of website services. Therefore, it is necessary to obtain container network traffic to determine whether the network traffic is attack traffic.

[0079] Container network traffic is efficiently captured at the network layer by PF_RING technology, leveraging PF_RING's high-performance capture capabilities.

[0080] In step S202, based on the extended Berkeley packet filter, features are extracted from the container network traffic to obtain a feature attribute data set.

[0081] The feature attribute dataset is a feature attribute suitable for characterizing HTTP DDoS attack methods.

[0082] eBPF performs preliminary cleaning on the container network traffic, removes access requests to static resources and redundant data, and performs feature extraction to obtain a feature attribute data set. The feature extraction types include: request frequency features, request time interval features, response data size features, request and response time interval features, and POST data packet feature values.

[0083] In step S203, based on a preset Gaussian Naive Bayes algorithm classifier model, the characteristic attribute dataset is used as input to output a normal dataset and an attack dataset.

[0084] Exemplary Devices

[0085] In the embodiments of the present application, Figure 3 , including a training data acquisition module 301, a feature extraction module 302, a classifier training module 303, a test data acquisition module 304, a classifier verification module 305 and a use module 306.

[0086] The training data acquisition module 301 is used to collect the training data set using a high-speed data packet processing framework;

[0087] The feature extraction module 302 is used to process the training data set based on the extended Berkeley packet filter to obtain a training data set with characteristic attributes; extract features based on the training data set based on the extended Berkeley packet filter to obtain characteristic attributes; and mark the training data set as a normal sample set and an attack sample set based on the characteristic attributes to obtain a training data set with characteristic attributes.

[0088] The classifier training module 303 is used to obtain a trained algorithm model based on a preset algorithm and the training data set with characteristic attributes; based on the preset model, take the training data set with characteristic attributes as input, output a training normal data set and a training attack data set; obtain a training evaluation value based on the training normal data set and the training attack data set; determine whether the training evaluation value reaches the preset evaluation value, if so, end the training and obtain the trained algorithm model, if not, continue training the model.

[0089] A test data acquisition module 304 is used to acquire a test data set using a high-speed data packet processing framework;

[0090] The classifier verification module 305 verifies the trained algorithm model according to the test data set to obtain a Gaussian Naive Bayesian algorithm classifier model. Based on the extended Berkeley packet filter, extract features according to the test data set to obtain a test data set with characteristic attributes; based on the trained algorithm model, take the test data set with characteristic attributes as input, output a test normal data set and a test attack data set; obtain a test evaluation value according to the test normal data set and the test attack data set; determine whether the test evaluation value reaches the preset evaluation value, if so, end the test and obtain a Gaussian Naive Bayesian algorithm classifier model, if not, retrain the model.

[0091] Using module 306, it is used to obtain container network traffic using a high-speed data packet processing framework; based on the extended Berkeley packet filter, extract features from the container network traffic to obtain a feature attribute data set; the feature attribute data set is a feature attribute adapted to characterize HTTP DDoS attack means; based on a preset Gaussian naive Bayes algorithm classifier model, the feature attribute data set is used as input to output a normal data set and an attack data set.

[0092] Exemplary Electronic Devices

[0093] This embodiment proposes an electronic device, including: one or more processors, and an internal memory and an external memory, wherein the internal memory stores instructions, and when the instructions are executed by the one or more processors, the one or more processors execute a method for constructing an HTTP distributed denial of service attack detection model as described in any of the aforementioned embodiments.

[0094] The processor is used to execute all or part of the steps in the HTTP distributed denial of service attack detection method in the embodiment. The memory is used to store various types of data, which may include instructions of any application or method in the electronic device, as well as data related to the application.

[0095] The processor can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, and is used to execute a method for constructing an HTTP distributed denial of service attack detection model described in the embodiment.

[0096] Computer storage media

[0097] The computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, a method for constructing an HTTP distributed denial of service attack detection model as described in any of the aforementioned embodiments is implemented.

[0098] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0099] In the 1930s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0100] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0101] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0102] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0103] It should be understood by those skilled in the art that one or more embodiments of this specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0104] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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.

[0105] 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.

[0106] 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 The steps for the functions specified in one or more boxes.

[0107] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0108] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0109] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0110] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0111] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0112] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0113] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.

Claims

1. A method for constructing a HTTP distributed denial of service attack detection model, characterized in that: include: Using a high-speed packet processing framework, data is collected; Based on an extended Berkeley packet filter, the data is classified to obtain a feature data set; According to the feature data set, a preset algorithm model is trained to obtain a trained algorithm model; Use a high-speed packet processing framework to obtain a test dataset; According to the test data set, the trained algorithm model is verified to obtain a Gaussian Naive Bayes algorithm classifier model.

2. The method according to claim 1, characterized in that The method further comprises: Use a high-speed packet processing framework to obtain container network traffic; Based on the extended Berkeley packet filter, extract features from the container network traffic to obtain a feature attribute data set; Based on a preset Gaussian Naive Bayes algorithm classifier model, the characteristic attribute data set is taken as input, and a normal data set and an attack data set are output.

3. The method according to claim 1, characterized in that The extended Berkeley packet filter classifies the data to obtain a feature data set, including: Based on the extended Berkeley packet filter, feature extraction is performed on the data to obtain feature attributes; According to the characteristic attributes, the training data set is marked as a normal sample set and an attack sample set to obtain a characteristic data set.

4. The method according to claim 3, characterized in that The extended Berkeley packet filter extracts features from the data to obtain feature attributes, including: The characteristic attributes include one or more of the request frequency characteristic, the request time interval characteristic, the response data size characteristic, the request and response time interval characteristic, and the POST data packet characteristic; From the data, the access frequency of users within a preset time is extracted to obtain request frequency characteristics; Extracting the user's access time interval from the data to obtain a request time interval feature; According to the data, the ratio of the user request time interval to the response data packet size is calculated to obtain the response data size feature; From the data, the time required for the server to process the request data packet is extracted to obtain the request and response time interval characteristics; From the data, extract the chunk.length data of the POST data packet to obtain the POST data packet characteristics.

5. A device for constructing a HTTP distributed denial of service attack detection model, characterized in that: include: A training data acquisition module, for collecting data using a high-speed packet processing framework; A feature extraction module, used for classifying the data based on an extended Berkeley packet filter to obtain a feature data set; A classifier training module is used to train a preset algorithm model according to the feature data set to obtain a trained algorithm model; a test data acquisition module is used to obtain a test data set using a high-speed data packet processing framework; The classifier verification module verifies the trained algorithm model according to the test data set to obtain a Gaussian Naive Bayes algorithm classifier model.

6. The device according to claim 5, characterized in that The device further comprises: A module is used to obtain container network traffic using a high-speed data packet processing framework; based on an extended Berkeley packet filter, features are extracted from the container network traffic to obtain a feature attribute data set; based on a preset Gaussian naive Bayes algorithm classifier model, the feature attribute data set is used as input to output a normal data set and an attack data set.

7. The device according to claim 5, characterized in that The feature extraction module is specifically used for: Based on the extended Berkeley packet filter, feature extraction is performed on the data to obtain feature attributes; According to the characteristic attributes, the training data set is marked as a normal sample set and an attack sample set to obtain a characteristic data set.

8. The device according to claim 5, characterized in that The feature extraction module is specifically used for: The characteristic attributes include one or more of the request frequency characteristic, the request time interval characteristic, the response data size characteristic, the request and response time interval characteristic, and the POST data packet characteristic; From the data, the access frequency of users within a preset time is extracted to obtain request frequency characteristics; Extracting the user's access time interval from the data to obtain a request time interval feature; According to the data, the ratio of the user request time interval to the response data packet size is calculated to obtain the response data size feature; From the data, the time required for the server to process the request data packet is extracted to obtain the request and response time interval characteristics; From the data, extract the chunk.length data of the POST data packet to obtain the POST data packet characteristics.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, used to implement a method for constructing an HTTP distributed denial of service attack detection model as described in any one of claims 1 to 4 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the method for constructing an HTTP distributed denial of service attack detection model as described in any one of claims 1 to 4 is implemented.

Citation Information

Cited By

  • DDoS attack defense method based on recognition model

    CN119172155A

  • A DDoS attack defense method based on identification model

    CN119172155B