Method and apparatus for detecting malicious DOS traffic, and electronic device and storage medium
By constructing a predictive model, combining features from the transport layer and application layer, and using TF-IDF and LightGBM algorithms to filter important features, the problem of protection against unknown DOS attacks was solved, achieving efficient and accurate DOS attack detection.
Patent Information
- Application Number
- PCT/CN2023/139623
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-29
- Filing Date
- 2023-12-18
- Publication Date
- 2024-12-05
AI Technical Summary
Existing technologies cannot effectively protect against unknown DOS attacks and have a defense gap, making it impossible to intercept initial attacks in a timely manner.
By constructing a prediction model, combining features from the transport layer and application layer, and using the TF-IDF and LightGBM algorithms, important features are selected for DOS attack detection.
It enables efficient detection of unknown DOS attacks, reduces defense gaps, and improves detection accuracy and efficiency.
Smart Images

Figure CN2023139623_05122024_PF_FP_ABST
Abstract
Description
A method, device, electronic device and storage medium for detecting malicious DOS traffic Technical Field
[0001] The present application relates to the field of digital information transmission technology, and in particular to a method, device, electronic device and storage medium for detecting malicious DOS traffic. Background Art
[0002] With the exponential growth of global computer networks and network applications, cyberattacks have surged. Among them, DoS attacks are a common yet potentially devastating type of cyberattack. These attacks intentionally exploit flaws in network protocol implementations or directly deplete the resources of the target. The goal is to disable normal services or resource access on the target computer or network, causing the target system to stop responding or even crash. These attacks can lead to resource starvation, and no matter how fast a computer's processing speed, memory capacity, or network bandwidth, the consequences of such attacks are unavoidable.
[0003] Currently, traditional anti-DDOS protection solutions require configuring blacklists and whitelists or waiting until a certain number of known preventable attacks have been detected before starting protection. They are unable to effectively intercept the initial attacks, have a certain defense window period, and are unable to detect and protect against unknown attacks.
[0004] Summary of the Invention
[0005] In order to solve the above problems, embodiments of the present application provide a method, device, electronic device and storage medium for detecting malicious DOS traffic.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting malicious DOS traffic, the method comprising:
[0007] Obtaining a user's session request packet, and extracting a first preset number of digital features of a first preset type from the session request packet based on a preset feature type database;
[0008] extracting a first text feature from the session request packet based on the user's access log, determining a second preset number of second text features from the first text feature according to a TF-IDF algorithm, and vectorizing the second text feature to obtain a second digital feature;
[0009] Constructing a prediction model, screening the first digital feature and the second digital feature based on feature importance to obtain a third preset number of third digital features, and training the prediction model based on the third digital features;
[0010] The newly acquired session request packet is detected based on the trained prediction model.
[0011] Preferably, obtaining the user's session request packet includes:
[0012] The user's traffic request packets are obtained, and the traffic request packets are grouped based on the session dimension to obtain session request packets.
[0013] Preferably, the extracting of a first preset number of digital features of a first preset type from the session request packet based on a preset feature category database includes:
[0014] A target digital feature is extracted from the session request packet based on a preset feature category database, and the target digital feature is screened based on the feature influence ranking corresponding to the feature category database to obtain a first preset number of first digital features, the feature category database including at least the first preset number of feature categories, and the target digital feature is a digital feature whose feature category matches the feature category database.
[0015] Preferably, the determining of the second text features of the second preset number of categories in the first text features according to the TF-IDF algorithm includes:
[0016] Calculating importance evaluation values corresponding to the first text features according to the TF-IDF algorithm, and sorting the importance evaluation values in descending order;
[0017] A second preset number of second text features are selected from the first text features based on the sorting order.
[0018] Preferably, vectorizing the second text feature to obtain the second digital feature includes:
[0019] vectorizing the second text feature to obtain a fourth digital feature;
[0020] The default value of the digital feature in the fourth digital feature is filled based on the average to obtain the second digital feature.
[0021] Preferably, the screening of the first digital features and the second digital features based on feature importance to obtain a third preset number of third digital features includes:
[0022] normalizing the first digital feature and the second digital feature, and summarizing the normalized first digital feature and the second digital feature to obtain a digital feature matrix;
[0023] The digital feature matrix is screened based on feature importance in the prediction model to obtain a third preset number of third digital features.
[0024] Preferably, the prediction model is a tree model using the LightGBM algorithm, and the LightGBM algorithm adopts a depth-first splitting strategy;
[0025] The step of training the prediction model based on the third digital feature includes:
[0026] The prediction model is trained based on the third digital feature, and the prediction model is optimized according to a grid search algorithm.
[0027] In a second aspect, an embodiment of the present application provides a device for detecting malicious DOS traffic, the device comprising:
[0028] An acquisition module, configured to acquire a user's session request packet and extract a first digital feature of a first preset number of types from the session request packet based on a preset feature type database;
[0029] A determination module is configured to extract a first text feature from the session request packet based on the user's access log, determine a second preset number of second text features from the first text feature according to a TF-IDF algorithm, and vectorize the second text feature to obtain a second digital feature;
[0030] a construction module, configured to construct a prediction model, screen the first digital feature and the second digital feature based on feature importance, obtain a third preset number of third digital features, and train the prediction model based on the third digital features;
[0031] A detection module is used to detect the newly acquired session request packet based on the trained prediction model.
[0032] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the computer program, the steps of the method provided in the first aspect or any possible implementation of the first aspect are implemented.
[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect or any possible implementation of the first aspect.
[0034] The beneficial effects of the present invention are: 1. DOS attacks are detected by fusing data features such as the size of transport layer session request packets and text features such as the URI of application layer access logs, adding DOS attack detection on the HTTP protocol side such as access logs, realizing dual DOS attack protection at the transport layer and application layer, thereby increasing the breadth and accuracy of the detection protocol, and realizing DOS attack protection both in the cloud and locally.
[0035] 2. It can capture DOS attacks with less obvious TCP and UDP transport layer protocol features during HTTP layer detection, avoiding defense gaps and making it easier to detect and protect against unknown attacks. It also has higher detection efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0037] FIG1 is a flow chart of a method for detecting malicious DOS traffic provided by an embodiment of the present application;
[0038] FIG2 is a schematic diagram of the structure of a device for detecting malicious DOS traffic provided by an embodiment of the present application;
[0039] FIG3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.
[0041] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application. Different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments described. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, even though the embodiment may not be clearly described in the following text.
[0042] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made to the function and arrangement of the elements described without departing from the scope of the present application. Various examples may appropriately omit, replace, or add various processes or components. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted, or combined. In addition, features described in some examples may be combined in other examples.
[0043] Referring to Figure 1, Figure 1 is a flow chart of a method for detecting malicious DOS traffic provided by an embodiment of the present application. In the embodiment of the present application, the method includes:
[0044] S101: Obtain a user's session request packet, and extract first digital features of a first preset number of types from the session request packet based on a preset feature type database.
[0045] The execution entity of this application can be a cloud server.
[0046] In one embodiment of the present application, a preset feature type database has many types of feature types pre-set, such as data packet size, average network flow length, combined features, etc. The cloud server will perform feature extraction on the user's session request packet obtained at the transport layer according to the feature types in the feature type database, so as to extract the first digital feature of the first preset number of feature types from the session request packet.
[0047] In one possible implementation, obtaining the user's session request packet includes:
[0048] The user's traffic request packets are obtained, and the traffic request packets are grouped based on the session dimension to obtain session request packets.
[0049] In one embodiment of the present application, a series of visits by a user in a short period of time is called a session, and the dimension of detection and protection will be based on the session. This approach will be more efficient than detecting a single traffic access and global request detection, and will not place too much burden on the server. Therefore, the traffic request packets will be grouped according to the session dimension, and multiple traffic belonging to a session will be integrated together, and finally a session request packet based on the session will be obtained. Among them, the session group identification will give priority to using the gateway-specific setcookie value when the user visits the website for the first time. The same specific gateway cookie is counted as a session dimension, and the session identification for requests without a specific gateway cookie field will degenerate back to the use of ip+ua for statistical identification. For traffic with less than 3 requests, the corresponding session statistics will not be performed.
[0050] In one possible implementation, extracting a first preset number of digital features of a first preset type from the session request packet based on a preset feature category database includes:
[0051] A target digital feature is extracted from the session request packet based on a preset feature category database, and the target digital feature is screened based on the feature influence ranking corresponding to the feature category database to obtain a first preset number of first digital features, the feature category database including at least the first preset number of feature categories, and the target digital feature is a digital feature whose feature category matches the feature category database.
[0052] In one embodiment of the present application, the feature category database may contain a large number of feature categories. If the digital features corresponding to each matched feature category are used for subsequent calculations, the amount of calculation may be very large. Therefore, when constructing the feature category database, a corresponding feature influence ranking is pre-set, and the influence of each feature category is manually ranked. Then, based on the ranking, the first digital features of the first preset number of categories with the highest influence are selected from the target digital features. These first digital features are subsequently obtained through dimensionality reduction screening and calculation.
[0053] Exemplarily, the feature type database may include 32 types (i.e., 32 dimensions) of feature types, from which 13 (i.e., the first preset number of types) features are selected according to the feature influence sorting, which may include the maximum packet length, minimum packet length, average packet length, and packet length variance of the network flow; the maximum interval time for packet arrival, the minimum interval time for packet arrival, the average interval time for packet arrival, the variance of the packet arrival interval time, and the average duration of the data flow, the packet transmission interruption time, and the packet transmission idle time; the number of bits of the packet service type identification, the number of packets carrying the service type identification, and the number of packets with each of the said service type identifications.
[0054] S102: Extract a first text feature from the session request packet based on the user's access log, determine a second preset number of second text features from the first text feature according to a TF-IDF algorithm, and vectorize the second text feature to obtain a second digital feature.
[0055] In one embodiment of the present application, the session request packet is extracted based on the user's access log on the HTTP protocol side of the application layer to obtain a series of first text features such as a Uniform Resource Identifier (URI) and log parameters. Similarly, using all the first text features may make the subsequent calculation process too complicated, so the first text features are processed according to the TF-IDF algorithm to determine a second preset number of second text features. Then, in order to be able to calculate the text features, they will be vectorized to become second digital features.
[0056] Among them, TF-IDF is used to evaluate the importance of a word to a document in a document collection. Its calculation formula is:
[0057] TF-IDF = the number of times a word or character appears in a document / the total number of characters or words in the document * log (the total number of documents / (the number of documents containing the word or character) + 1).
[0058] In one possible implementation, determining the second text features of the second preset number of categories from the first text features according to the TF-IDF algorithm includes:
[0059] Calculating importance evaluation values corresponding to the first text features according to the TF-IDF algorithm, and sorting the importance evaluation values in descending order;
[0060] A second preset number of second text features are selected from the first text features based on the sorting order.
[0061] In one embodiment of the present application, the above formula can be used to calculate the importance evaluation value corresponding to each first text feature. The higher the value, the more important the first text feature of that type is to the HTTP protocol side. By sorting the importance evaluation values, a second preset number of second text features (e.g., 4) can be selected.
[0062] In one possible implementation, vectorizing the second text feature to obtain a second digital feature includes:
[0063] vectorizing the second text feature to obtain a fourth digital feature;
[0064] The default value of the digital feature in the fourth digital feature is filled based on the average to obtain the second digital feature.
[0065] In one embodiment of the present application, the second text feature converted into the fourth digital feature through vectorization may have a default value, so it will be filled with an average. Specifically, an average function can be used to calculate the average value of the column where the default value is located, and the default value can be filled with the average value.
[0066] S103: Build a prediction model, screen the first digital feature and the second digital feature based on feature importance, obtain a third preset number of third digital features, and train the prediction model based on the third digital features.
[0067] In one embodiment of the present application, a prediction model will be constructed, which can be a decision tree model. The first digital feature and the second digital feature obtained in the above steps will be used to train the prediction model. However, some of the first digital features and the second digital features may be useless for model training. Therefore, the features will be screened according to feature importance to obtain a third digital feature to train the prediction model. In order to avoid the number of categories of the first digital feature and the second digital feature being too large, a third preset number of categories can be set, and only the third digital features of the third preset number of categories are selected according to the feature importance from high to low.
[0068] Among them, there are many ways to determine the importance of features. For example, a decision tree algorithm, such as classification and regression tree (CART), can be used to provide an importance score based on criteria for selecting split points, such as the Gini index or the reduction of entropy. It can also be determined based on permutation features, that is, the model is first fitted to the data, and the model itself does not support feature importance scoring. Then, the model makes predictions on the data set, but the value of a certain feature in the data set is disrupted. This operation is repeated for each feature in the data set. The whole process is then repeated 3, 5, 10 or more times. The average importance score of each input feature (and the distribution of scores for a given repetition) is used as the result. In the permutation feature importance method, a performance indicator needs to be provided as the basis for the importance score, such as the mean square error of regression and the accuracy of classification.
[0069] In one possible implementation, the screening of the first digital features and the second digital features based on feature importance to obtain a third preset number of third digital features includes:
[0070] normalizing the first digital feature and the second digital feature, and summarizing the normalized first digital feature and the second digital feature to obtain a digital feature matrix;
[0071] The digital feature matrix is screened based on feature importance in the prediction model to obtain a third preset number of third digital features.
[0072] In one embodiment of the present application, the first digital feature and the second digital feature can be normalized using the z-score standard deviation method, and the normalized digital features can be aggregated to obtain a digital feature matrix. By determining the feature importance of the digital features of each feature dimension in the digital feature matrix and screening the digital features in the matrix based on their importance, only the third digital features with the highest importance of the third preset number of categories can be retained. The prediction model trained based on these features can more easily detect DOS attacks.
[0073] In one embodiment, the prediction model is a tree model using the LightGBM algorithm, and the LightGBM algorithm adopts a depth-first splitting strategy;
[0074] The step of training the prediction model based on the third digital feature includes:
[0075] The prediction model is trained based on the third digital feature, and the prediction model is optimized according to a grid search algorithm.
[0076] In one embodiment of the present application, LightGBM is a fast, distributed, high-performance gradient boosting framework based on the decision tree algorithm, which makes it easier to quickly iterate the model in large-scale data sets. Before the LightGBM algorithm, most tree models used a level-wise splitting strategy when constructing a decision tree, that is, when splitting a node, the nodes on the same layer can be split at the same time, which can be multi-threaded in parallel to a certain extent, speeding up the construction of the decision tree. But from another perspective, when constructing the level-wise strategy, only the samples in the current node set will be considered for optimal splitting, so there is a possibility of a local optimal solution. In addition, parallel generation may not require additional splitting of some nodes in the same layer. Based on this, the LightGBM algorithm adopts a depth-first splitting strategy, that is, each time a leaf node is split, the global samples are considered, which will not cause the problem of local optimal solution, and also reduces the possibility of the number of post-pruning operations. For the depth-first splitting strategy, since the depth of the tree may be deeper, causing overfitting, the model parameters increase the maximum depth limit to reduce the risk of overfitting. In addition, the grid search algorithm will be used to optimize the prediction model. The grid search method is an exhaustive search method for specified parameter values. It optimizes the parameters of the estimation function through cross-validation to obtain the optimal learning algorithm. Specifically, the possible values of each parameter are permuted and combined, and all possible combinations are listed to form a "grid." Each combination is then used to train the SVM, and performance is evaluated using cross-validation. After the fit function has tried all parameter combinations, it returns a suitable classifier, automatically adjusting to the optimal parameter combination. Parameter values can be obtained using clf.best_params_.
[0077] S104: Detect the newly acquired session request packet based on the trained prediction model.
[0078] In one embodiment of the present application, after a prediction model is trained based on the third digital feature, the prediction model can be deployed to detect subsequent session request packets, thereby detecting the output results corresponding to each third digital feature from the session request packet. The output results are compared with the sample data during the training process to complete the detection and judgment of the DOS malicious attack. Detection using the prediction model trained by the present application can capture DOS attacks with unclear TCP and UDP transport layer protocol features during HTTP layer detection, avoiding defense gaps, making it easier to detect and protect against unknown attacks, and achieving higher detection efficiency and accuracy.
[0079] The following will be combined with Figure 2 to provide a detailed description of the malicious DOS traffic detection device provided in the embodiment of the present application. It should be noted that the malicious DOS traffic detection device shown in Figure 2 is used to execute the method of the embodiment shown in Figure 1 of the present application. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the embodiment shown in Figure 1 of the present application.
[0080] Please refer to Figure 2, which is a schematic diagram of the structure of a malicious DOS traffic detection device provided by an embodiment of the present application. As shown in Figure 2, the device includes:
[0081] An acquisition module 201 is configured to acquire a user's session request packet and extract a first preset number of first digital features of a first preset type from the session request packet based on a preset feature type database;
[0082] A determination module 202 is configured to extract a first text feature from the session request packet based on the user's access log, determine a second preset number of second text features from the first text feature according to a TF-IDF algorithm, and vectorize the second text feature to obtain a second digital feature;
[0083] A construction module 203 is configured to construct a prediction model, screen the first digital feature and the second digital feature based on feature importance, obtain a third preset number of third digital features, and train the prediction model based on the third digital features;
[0084] The detection module 204 is configured to detect the newly acquired session request packet based on the trained prediction model.
[0085] In one embodiment, the acquisition module 201 includes:
[0086] The acquisition unit is used to acquire the user's traffic request packets and group the traffic request packets based on the session dimension to obtain session request packets.
[0087] In one embodiment, the acquisition module 201 further includes:
[0088] A first extraction unit is configured to extract a target digital feature from the session request packet based on a preset feature category database, and filter the target digital feature based on a feature influence ranking corresponding to the feature category database to obtain a first preset number of first digital features, where the feature category database includes at least the first preset number of feature categories, and the target digital feature is a digital feature whose feature category matches that of the feature category database.
[0089] In one embodiment, the determining module 202 includes:
[0090] a sorting unit, configured to calculate the importance evaluation values corresponding to the first text features according to the TF-IDF algorithm, and sort the importance evaluation values in descending order;
[0091] A selection unit is configured to select a second preset number of second text features from the first text features based on a sorting order.
[0092] In one embodiment, the determining module 202 further includes:
[0093] a vectorization unit, configured to vectorize the second text feature to obtain a fourth digital feature;
[0094] The filling unit is configured to fill in a default value of a digital feature in the fourth digital feature based on the average to obtain a second digital feature.
[0095] In one embodiment, the construction module 203 includes:
[0096] a normalization unit, configured to normalize the first digital feature and the second digital feature, and aggregate the normalized first digital feature and the second digital feature to obtain a digital feature matrix;
[0097] A screening unit is used to screen the digital feature matrix based on feature importance in the prediction model to obtain a third preset number of third digital features.
[0098] In one embodiment, the prediction model is a tree model using the LightGBM algorithm, and the LightGBM algorithm adopts a depth-first splitting strategy;
[0099] The construction unit 203 further includes:
[0100] An optimization unit is used to train the prediction model based on the third digital feature and optimize the prediction model according to a grid search algorithm.
[0101] Those skilled in the art will clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. "Unit" and "module" in this specification refer to software and / or hardware that can independently perform or cooperate with other components to perform specific functions, where the hardware can be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.
[0102] Each processing unit and / or module in the embodiments of the present application may be implemented by an analog circuit that implements the functions described in the embodiments of the present application, or may be implemented by software that executes the functions described in the embodiments of the present application.
[0103] Referring to Figure 3, which shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present application, the electronic device can be used to implement the method in the embodiment shown in Figure 1. As shown in Figure 3, the electronic device 300 may include: at least one central processing unit 301, at least one network interface 304, a user interface 303, a memory 305, and at least one communication bus 302.
[0104] The communication bus 302 is used to implement the connection and communication between these components.
[0105] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0106] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0107] The central processing unit 301 may include one or more processing cores. The central processing unit 301 utilizes various interfaces and circuits to connect various components within the entire electronic device 300. It executes instructions, programs, code sets, or instruction sets stored in the memory 305, and accesses data stored in the memory 305 to perform various functions and process data for the terminal 300. Optionally, the central processing unit 301 may be implemented using at least one hardware form factor selected from the group consisting of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The central processing unit 301 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content displayed on the display; and the modem handles wireless communications. It is understood that the modem may not be integrated into the central processing unit 301 and may be implemented as a separate chip.
[0108] Among them, the memory 305 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may also be at least one storage device located away from the aforementioned central processing unit 301. As shown in Figure 3, the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module and program instructions.
[0109] In the electronic device 300 shown in FIG3 , the user interface 303 is mainly used to provide an input interface for the user and obtain user input data; and the central processing unit 301 can be used to call the malicious DOS traffic detection application stored in the memory 305 and specifically perform the following operations:
[0110] Obtaining a user's session request packet, and extracting a first preset number of digital features of a first preset type from the session request packet based on a preset feature type database;
[0111] extracting a first text feature from the session request packet based on the user's access log, determining a second preset number of second text features from the first text feature according to a TF-IDF algorithm, and vectorizing the second text feature to obtain a second digital feature;
[0112] Constructing a prediction model, screening the first digital feature and the second digital feature based on feature importance to obtain a third preset number of third digital features, and training the prediction model based on the third digital features;
[0113] The newly acquired session request packet is detected based on the trained prediction model.
[0114] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above method. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a microdrive, a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0115] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0116] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0117] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, 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 service interface, and the indirect coupling or communication connection of the device or unit can be electrical or other forms.
[0118] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0119] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0120] 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 memory. 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 memory, including a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0121] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0122] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure herein, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art that are not recorded in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A method for detecting malicious DOS traffic, It is characterized in that The method comprises: Acquire a user's session request packet, and extract first digital features of a first preset type and quantity from the session request packet based on a preset feature type database; Extracting a first text feature from the session request packet based on the user's access log, determining a second text feature of a second preset number of types from the first text feature according to a TF-IDF algorithm, and vectorizing the second text feature to obtain a second digital feature; Constructing a prediction model, screening the first digital feature and the second digital feature based on feature importance to obtain a third preset number of third digital features, and training the prediction model based on the third digital features; The newly acquired session request packet is detected based on the trained prediction model.
2. The method according to claim 1, It is characterized in that The step of obtaining a user's session request packet includes: The user's traffic request packets are obtained, and the traffic request packets are grouped based on the session dimension to obtain session request packets.
3. The method according to claim 1, It is characterized in that The extracting of the first digital features of the first preset type and quantity from the session request packet based on the preset feature type database includes: The target digital feature is extracted from the session request packet based on a preset feature category database, and the target digital feature is screened based on the feature influence ranking corresponding to the feature category database to obtain a first digital feature of a first preset number of categories, wherein the feature category database includes at least the first preset number of feature categories, and the target digital feature is a digital feature whose feature category matches the feature category database.
4. The method according to claim 1, It is characterized in that The step of determining the second text features of a second preset number of categories in the first text features according to the TF-IDF algorithm includes: Calculating each importance evaluation value corresponding to each of the first text features according to the TF-IDF algorithm, and sorting the importance evaluation values in descending order; A second preset number of types of second text features are selected from the first text features based on the sorting order.
5. The method according to claim 1, It is characterized in that The vectorizing the second text feature to obtain a second digital feature includes: vectorizing the second text feature to obtain a fourth digital feature; The digital feature default value in the fourth digital feature is filled based on the average to obtain the second digital feature.
6. The method according to claim 1, It is characterized in that The step of screening the first digital feature and the second digital feature based on feature importance to obtain a third digital feature of a third preset number of types includes: The first digital feature and the second digital feature are standardized, and the standardized first digital feature is summarized. and the second digital feature to obtain a digital feature matrix; The digital feature matrix is screened based on feature importance in the prediction model to obtain third digital features of a third preset number of types.
7. The method according to claim 1, It is characterized in that The prediction model is a tree model using the LightGBM algorithm, and the LightGBM algorithm adopts a depth-first splitting strategy; The step of training the prediction model based on the third digital feature comprises: The prediction model is trained based on the third digital feature, and the prediction model is optimized according to a grid search algorithm.
8. A detection device for malicious DOS traffic, It is characterized in that The device comprises: An acquisition module, configured to acquire a user's session request packet, and extract first digital features of a first preset type and quantity from the session request packet based on a preset feature type database; A determination module, configured to extract a first text feature from the session request packet based on the user's access log, determine a second text feature of a second preset number of types from the first text feature according to a TF-IDF algorithm, and vectorize the second text feature to obtain a second digital feature; A construction module, configured to construct a prediction model, screen the first digital feature and the second digital feature based on feature importance, obtain a third digital feature of a third preset number of types, and train the prediction model based on the third digital feature; A detection module is used to detect the newly acquired session request packet based on the trained prediction model.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
LDoS attack detection method in SDN based on RF-GMM
CN112788063A
Malicious encrypted traffic detection method and device, electronic equipment and storage medium
CN114268484A
Information system network attack detection method based on flow analysis
CN115150182A
Malicious DOS traffic detection method and device, electronic equipment and storage medium
CN116389166A
Method and system for resilient and adaptive detection of malicious websites
US20150200962A1
