Methods, devices, storage media, and electronic equipment for detecting web attacks

By combining multiple front-end and back-end recognition models into an overall model structure, the problem of the failure to effectively combine the recognition results of multiple independent models in the existing technology is solved, and a higher accuracy rate for Web attack detection is achieved.

CN117056907BActive Publication Date: 2026-11-17COMP NETWORK INFORMATION CENT CHINESE ACADEMY OF SCI
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210464545.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2026-11-17
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

In existing deep learning-based web attack detection methods, the identification results of multiple independent models are not effectively combined, resulting in limited improvement in identification performance.

Method used

An overall model structure of multiple pre-level recognition models and one post-level recognition model is adopted. By learning weights from the outputs of the pre-level models, an overall model is formed to detect web requests.

Benefits of technology

It improves the accuracy of web attack identification, better performs classification and identification tasks, and enhances detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117056907B_ABST
    Figure CN117056907B_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, storage medium, and electronic device for detecting web attacks. The method includes: acquiring a first training set; training multiple different pre-level recognition models based on the first training set to determine multiple trained pre-level recognition models; acquiring a second training set; training a post-level recognition model based on the second training set to determine a trained post-level recognition model; the input to the post-level recognition model is the output of the multiple pre-level recognition models; and detecting whether a target web request contains an attack based on the multiple trained pre-level and post-level recognition models. The method, apparatus, storage medium, and electronic device for detecting web attacks provided by this invention, combined with multiple pre-level recognition models, can improve recognition accuracy; furthermore, by learning a weight for different prediction results, it can better complete the classification and recognition task, and can better identify web attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of attack detection technology, and more specifically, to a method, apparatus, storage medium, and electronic device for detecting web attacks. Background Technology

[0002] With the rapid development of computer and internet technologies, web applications play an important role in people's lives and work, and an increasing number of web attacks have emerged in web application scenarios. Some web attacks (such as injection attacks and remote malicious file inclusion attacks) exploit vulnerabilities in web applications to launch attacks, causing serious adverse effects such as leakage of users' private information and tampering with system control permissions.

[0003] Currently, there are methods for detecting web attacks based on deep learning. To improve the accuracy of identification, some solutions utilize multiple models for parallel detection and identification, and determine the existence of a web attack by statistically analyzing the identification results of multiple models. However, in this approach, each model remains essentially independent, and the identification results of each model cannot be accurately utilized, resulting in limited improvement in identification effectiveness. Summary of the Invention

[0004] To address the problem of poor performance of existing identification schemes, the present invention aims to provide a method, apparatus, storage medium, and electronic device for detecting Web attacks.

[0005] In a first aspect, embodiments of the present invention provide a method for detecting web attacks, including:

[0006] Obtain a first training set, which includes multiple first training samples related to Web requests;

[0007] Based on the first training set, multiple different pre-level recognition models are trained to determine multiple trained pre-level recognition models.

[0008] Obtain a second training set comprising multiple second training samples, wherein the second training samples are related to the outputs of the multiple preceding recognition models;

[0009] The subsequent recognition model is trained based on the second training set to determine the trained subsequent recognition model; the input of the subsequent recognition model is the output of multiple previous recognition models.

[0010] The system detects whether a target web request is attacked based on multiple trained pre-level recognition models and trained post-level recognition models.

[0011] In one possible implementation, obtaining the second training set, which includes multiple second training samples, includes:

[0012] The first training set is divided into k training subsets, and each training subset includes multiple first training samples;

[0013] The k-1 training subsets other than the i-th training subset are used as the i-th new training set, and the j-th pre-level recognition model is trained based on the i-th new training set to determine the trained pre-level recognition sub-model M. j,i i = 1, 2, ..., k, j = 1, 2, ..., n, where n is the number of the preceding recognition models;

[0014] The u-th first training sample x in the i-th training subset i,u The inputs are respectively fed into the n trained pre-level recognition sub-models M obtained based on the i-th new training set. j,i Determine each of the trained pre-level recognition sub-models M j,i The output result y j,i,u ;

[0015] Generate the u-th first training sample x in the i-th training subset. i,u The corresponding second training sample X i,u X i,u =(y 1,i,u ,y 2,i,u ,…,y n,i,u ), and the second training sample X i,u With the first training sample x i,u The labels are consistent.

[0016] In one possible implementation, the method further includes:

[0017] Obtain a first test set containing multiple first test samples, and test each of the trained pre-level recognition models based on the first test set;

[0018] Obtain a second test set containing multiple second test samples, and test the trained post-level recognition model based on the second test set.

[0019] In one possible implementation, obtaining the second test set, which includes multiple second test samples, includes:

[0020] The v-th first test sample t in the first test set v The inputs are respectively fed into the j-th pre-level recognition sub-model M, which is trained based on k new training sets. j,i Determine each of the trained pre-level recognition sub-models M j,i The output result r j,i,u ;

[0021] Determine the total output r corresponding to the j-th trained pre-level recognition sub-model. j,u ,and

[0022] Based on the total output results corresponding to the n trained pre-level recognition sub-models, the first test sample t is determined. v The corresponding second test sample s v s v =(r 1,v ,r 2,v ,…,r n,v ), and the second test sample s v With the first test sample t v The labels are consistent.

[0023] In one possible implementation, the multiple pre-recognition models are text convolutional neural network models with different filter sizes.

[0024] In one possible implementation, the filter size used by any of the preceding recognition models is different from the filter size used by the other preceding recognition models.

[0025] In one possible implementation, the subsequent recognition model is an XGBoost model.

[0026] Secondly, embodiments of the present invention also provide an apparatus for detecting web attacks, comprising:

[0027] The first acquisition module is used to acquire a first training set, which includes multiple first training samples related to Web requests.

[0028] The pre-training module is used to train multiple different pre-recognition models based on the first training set, and to determine multiple trained pre-recognition models.

[0029] The second acquisition module is used to acquire a second training set including multiple second training samples, wherein the second training samples are related to the outputs of the multiple previous recognition models;

[0030] The post-training module is used to train the post-recognition model based on the second training set to determine the trained post-recognition model; the input of the post-recognition model is the output of multiple pre-recognition models.

[0031] The identification module is used to detect whether a target web request is attacked based on multiple trained pre-level identification models and trained post-level identification models.

[0032] Thirdly, embodiments of the present invention also provide a computer storage medium storing computer-executable instructions for use in any of the above-described methods for detecting web attacks.

[0033] Fourthly, embodiments of the present invention also provide an electronic device, comprising:

[0034] At least one processor; and,

[0035] A memory communicatively connected to the at least one processor; wherein,

[0036] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform any of the methods for detecting web attacks described above.

[0037] In the solution provided by the first aspect of the present invention, a holistic model formed by multiple pre-level recognition models and one post-level recognition model is used to detect Web requests. This method combines multiple pre-level recognition models, which can improve the recognition accuracy. Furthermore, this method does not simply perform statistics on the prediction results of the pre-level recognition models, but learns a weight for different prediction results, thereby better completing the classification and recognition task and better identifying Web attacks.

[0038] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 A flowchart of a method for detecting web attacks provided by an embodiment of the present invention is shown;

[0041] Figure 2 This diagram illustrates a structural schematic of the overall model in the method for detecting web attacks provided by an embodiment of the present invention.

[0042] Figure 3 A schematic diagram of the structure of a device for detecting web attacks provided in an embodiment of the present invention is shown;

[0043] Figure 4 A schematic diagram of the structure of an electronic device for performing a method for detecting web attacks, provided by an embodiment of the present invention, is shown. Detailed Implementation

[0044] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0045] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0046] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0047] This invention provides a method for detecting web attacks, see [link to relevant documentation]. Figure 1 As shown, the method includes:

[0048] Step 101: Obtain the first training set, which includes multiple first training samples related to Web requests.

[0049] In this embodiment of the invention, in order to train a model capable of identifying web attacks, a training set for training the model needs to be established. In this embodiment, features representing the characteristics of a web request can be extracted from the web request, and the web request can be labeled accordingly. If the web request is normal, its label indicates normal; if the web request contains attack behavior, its label indicates an attack. For example, web access requests can be decoded to extract host information, request paths, and request payloads, etc., and segmented into words based on symbols. For each word, the skip-gram method in methods such as Word2Vec is used to obtain a vectorized representation of each word, thereby representing the web request in a vectorized form. Each web request can generate a first training sample, and multiple web requests can generate a training set containing multiple first training samples, i.e., the first training set.

[0050] Step 102: Train multiple different pre-level recognition models based on the first training set to determine multiple trained pre-level recognition models.

[0051] In this embodiment of the invention, the overall model for identifying web attacks comprises two parts: a front-end and a back-end. The structure of this overall model can be found in [reference needed]. Figure 2 As shown, the overall model includes multiple front-end recognition models and one back-end recognition model. Figure 2 The diagram illustrates three pre-stage recognition models. Each pre-stage recognition model is distinct; specifically, these models can be of different types, such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), and Support Vector Machines (SVMs). Alternatively, different pre-stage recognition models can be of the same type but with different structures; for example, all pre-stage recognition models could be CNN models, differing only in the filters (convolutional kernels) they use. Optionally, multiple pre-stage recognition models can be TextCNN models with different filter sizes.

[0052] In this embodiment of the invention, each individual pre-level identification model can also achieve the function of identifying Web attacks. This embodiment combines multiple pre-level identification models to improve the accuracy of Web attack identification. Each pre-level identification model is trained based on the first training set. Training pre-level identification models based on the first training set is a mature technology in the field and will not be elaborated here. The output of each pre-level identification model represents the probability that its input Web request is an attack (or normal), and it is generally a value between 0 and 1.

[0053] Step 103: Obtain a second training set including multiple second training samples, which are related to the outputs of multiple previous recognition models.

[0054] In this embodiment of the invention, when training the subsequent recognition model, it is also possible to train the subsequent recognition model based on the first training set. However, if the preceding and subsequent recognition models are trained based on the same training set, it is easy to lead to overfitting. Therefore, this embodiment uses a different training set than the first training set, namely the second training set, to train the subsequent output model.

[0055] For example, to obtain the first training sample, other training samples besides the first training sample are generated based on multiple web requests, and labels are assigned to these other training samples. These other training samples are then input into the trained pre-level recognition model, yielding the output of each model. Each output represents the probability that the other training sample is attack-prone (or normal). The outputs of all pre-level recognition models are concatenated into a multi-dimensional vector, which is used as the second training sample, and its label is the label of the corresponding other training sample. Multiple second training samples can be obtained in the same way, thus forming a second training set.

[0056] Step 104: Train the subsequent recognition model based on the second training set to determine the trained subsequent recognition model; the input of the subsequent recognition model is the output of multiple previous recognition models.

[0057] In this embodiment of the invention, the second training sample contains the outputs of multiple pre-stage recognition models. The subsequent recognition model is trained using a training set (i.e., the second training set) containing multiple second training samples, so that the trained subsequent recognition model can recognize the outputs of multiple pre-stage recognition models, thereby realizing the detection and recognition of Web attacks.

[0058] Optionally, since the input of the subsequent recognition model is the output of multiple preceding recognition models, in order to reduce the complexity of the model, the number of preceding recognition models is generally not set to be large, such as 3 or 5. Therefore, the input of the subsequent recognition model is low-dimensional features (such as 3-dimensional features, 5-dimensional features, etc.). In this embodiment, the XGBoost model is used as the subsequent recognition model, which can achieve better classification of low-dimensional features.

[0059] Step 105: Detect whether the target web request is attacked based on multiple trained pre-level recognition models and trained post-level recognition models.

[0060] In this embodiment of the invention, after determining the pre-trained recognition model and the post-trained recognition model, the overall trained model is remembered, and its structure can still be referred to Figure 2As shown. When it is necessary to identify a certain web request, this web request is taken as the target web request and the target web request is taken as the input of the overall model. After being processed by the pre-level recognition model and the post-level recognition model after training, the output of the overall model (i.e. the output of the post-level recognition model after training) can represent the probability that the target web request is an attack (or normal), thus realizing the detection of web attacks.

[0061] The method for detecting Web attacks provided in this invention utilizes an overall model formed by multiple pre-level recognition models and one post-level recognition model to detect Web requests. This method combines multiple pre-level recognition models, which can improve the recognition accuracy. Furthermore, this method does not simply perform statistical analysis on the prediction results of the pre-level recognition models, but rather learns a weight for different prediction results, thereby better completing the classification and recognition task and enabling better identification of Web attacks.

[0062] Optionally, since the number of training samples generated based on Web requests is limited, dividing the training samples generated by Web requests into first training samples and other training samples used to generate second training samples would result in a small number of training samples. Simply increasing the number of training samples would increase the workload, especially the annotation workload. Therefore, this embodiment of the invention generates second training samples based on the first training samples. Step 103 above, "obtaining a second training set including multiple second training samples," includes:

[0063] Step A1: Divide the first training set into k training subsets, each training subset including multiple first training samples.

[0064] In this embodiment of the invention, the first training set contains multiple first training samples. This embodiment divides the first training set into more training sets, i.e., training subsets, so that a portion is selected from k training subsets to train the preceding recognition model. Each training subset has no overlap; that is, different training subsets do not contain the same first training samples. Optionally, the first training set is divided into k training subsets in an even distribution manner, so that the number of first training samples in each training subset is the same or similar. For example, if the first training set contains 20,000 first training samples, and k = 5, then the first training set can be divided into 5 training subsets, each containing 4,000 first training samples.

[0065] Step A2: Take the k-1 training subsets other than the i-th training subset as the i-th new training set, and train the j-th pre-level recognition model based on the i-th new training set to determine the trained pre-level recognition sub-model M. j,ii = 1, 2, ..., k, j = 1, 2, ..., n, where n is the number of previous recognition models.

[0066] In this embodiment of the invention, all training subsets are divided into two parts. One part is used to train the pre-level recognition model, and the other part is used to verify the effect of the trained recognition model, i.e., the other part is used as a test set. This embodiment utilizes the majority of the training subsets to train the pre-level recognition model. Specifically, if the k training subsets divided from the first training set are D1, D2, ..., Dk, and let i = 1, 2, ..., k, for the i-th training subset Di, the other training subsets (a total of k-1) are used as a new training set, i.e., the i-th new training set, denoted by D'i. For example, k = 5, meaning there are 5 training subsets, and the 5 new training sets are shown in Table 1:

[0067] Table 1

[0068]

[0069]

[0070] Furthermore, this embodiment of the invention involves a total of n pre-level recognition models, and each new training set D'i can train each pre-level recognition model. Taking the training of the first pre-level recognition model M1 (i.e., j=1) as an example, k new training sets can be used to train the pre-level recognition model M1 respectively, thereby obtaining k trained pre-level recognition models with different parameters. In order to distinguish it from the "trained pre-level recognition model" in step 102, this embodiment refers to the pre-level recognition model trained by the new training set in step A2 as the "trained pre-level recognition sub-model"; and the trained pre-level recognition sub-model obtained by training the j-th pre-level recognition model with the i-th new training set is denoted by M. j,i This is represented as follows. For example, training the preceding recognition model M1 with k new training sets yields k trained preceding recognition sub-models, named M in order. 1,1 M 1,2 M 1,3 M 1,4 M 1,5 .

[0071] It should be noted that the purpose of training the pre-level recognition model in step A2 of this embodiment is to generate a second training set in the future. The pre-level recognition sub-model trained in step A2 is not used in the recognition process of the subsequent step 105. That is, the pre-level recognition model used in step 105 is the pre-level recognition model trained in step 102.

[0072] Step A3: Take the u-th first training sample x from the i-th training subset.i,u The inputs are respectively fed into the n pre-level recognition sub-models M trained based on the i-th new training set. j,i Determine the pre-level recognition sub-model M after each training. j,i The output result y j,i,u .

[0073] In this embodiment of the invention, k new training sets are used to train one pre-level recognition model, resulting in k trained pre-level recognition sub-models. Correspondingly, a new training set is used to train n pre-level recognition models, resulting in n trained pre-level recognition sub-models. For example, the i-th new training set is used to train n pre-level recognition models, resulting in n trained pre-level recognition sub-models, numbered M in order. 1,i M 2,i M 3,i M n,i In this embodiment of the invention, the i-th training subset Di corresponding to the i-th new training set D'i is used as the test set, which can be used to test the above-mentioned n trained pre-level recognition sub-models M respectively. 1,i M 2,i M 3,i M n,i That is, the first training sample in the i-th training subset is input into the n trained pre-level recognition sub-models M. 1,i M 2,i M 3,i M n,i This yields the outputs of n models. For the u-th first training sample x in the i-th training subset... i,u The output results after inputting it into n models are y 1,i,u y 2,i,u ... y ,i,u That is, the first training sample x i,u Input to model M 1,i The output result y is obtained. 1,i,u ; the first training sample x i,u Input to model M 2,i The output result y is obtained. 2,i,u ...; the first training sample x i,u Input to model M n,i The output result y is obtained. n,i,u That is, y j,i,u =M j,i (x i,u ).

[0074] Step A4: Generate the u-th first training sample x in the i-th training subset. i,u The corresponding second training sample X i,u Xi,u =(y 1,i,u ,y 2,i,u ,…,y n,i,u ), and the second training sample X i,u With the first training sample x i,u The labels are consistent.

[0075] In this embodiment of the invention, the same first training sample is input into n different pre-trained recognition sub-models trained on the same new training set that does not contain the first training sample. This yields n output results. These n output results are concatenated into a vector, which serves as the second training sample corresponding to the first training sample, and both have the same label. As shown in step A4, for the first training sample x... i,u It corresponds to the n trained pre-level recognition sub-models M obtained from the i-th new training set. 1,i M 2,i M 3,i M n,i The outputs of the n models are y in sequence. 1,i,u ,y 2,i,u ,…,y n,i,u These outputs can be combined into an n-dimensional vector, i.e., (y 1,i,u ,y 2,i,u ,…,y n,i,u In this embodiment, the n-dimensional vector is used as the second training sample.

[0076] For each first training sample in the i-th training subset, a corresponding second training sample can be obtained based on the output results of n preceding recognition sub-models. When i takes different values, the preceding recognition sub-models used are different, but the process is the same. Therefore, through steps A1-A4 provided in this embodiment, a second training sample with the same number as the first training samples can be obtained. Furthermore, this second training sample is not the same as the first training sample, eliminating the need for setting a large number of additional training samples, making it suitable for scenarios with a small number of samples. Moreover, training the subsequent recognition model based on this second training sample can effectively avoid the problem of overfitting.

[0077] Optionally, the method also includes a process of testing the model, which includes:

[0078] Step B1: Obtain a first test set containing multiple first test samples, and test each trained pre-level recognition model based on the first test set.

[0079] Step B2: Obtain a second test set containing multiple second test samples, and test the trained subsequent recognition model based on the second test set.

[0080] In this embodiment of the invention, after obtaining the trained pre-level recognition model in step 102, the trained pre-level recognition model can be trained based on the first test set; the first test samples in the first test set have the same format as the first training samples. Similarly, after obtaining the trained post-level recognition model in step 104, the trained post-level recognition model can be trained based on the second test set; the second test samples in the second test set have the same format as the second training samples.

[0081] Optionally, to avoid repeatedly setting up multiple test sets, this embodiment generates a second test set based on the first test set. Specifically, step B2, "obtaining a second test set containing multiple second test samples," includes steps B21-B23:

[0082] Step B21: Take the v-th first test sample t from the first test set. v The inputs are respectively fed into the j-th pre-level recognition sub-model M, which is trained based on k new training sets. j,i Determine the pre-level recognition sub-model M after each training. j,i The output result r j,i,u .

[0083] In this embodiment of the invention, similar to determining multiple output results corresponding to a certain first training sample in step A3 above, the first test sample is input into the trained pre-level recognition sub-model to obtain the corresponding output result; the difference is that in step A3 above, the focus is on n pre-level recognition sub-models obtained by training multiple pre-level recognition models with a new training set; while in step B21, the focus is on k pre-level recognition sub-models obtained by training one pre-level recognition model with multiple new training sets.

[0084] Specifically, for a pre-level recognition model, in step B21 above, it will perform a training process based on k new training sets; taking the j-th pre-level recognition model as an example, the k trained pre-level recognition sub-models obtained by training the j-th pre-level recognition model based on the k new training sets are as follows: M j,1 M j,2 M j,k The first test sample t in the first test set v The inputs are respectively fed into k trained pre-level recognition sub-models M j,1 M j,2 M j,k The corresponding output result r is obtained. j,1,u r j,2,u 、、r j,k,u That is, r j,i,v =M j,i (t v ).

[0085] Step B22: Determine the total output r corresponding to the j-th trained pre-level recognition sub-model. j,u ,and

[0086] In this embodiment of the invention, the j-th trained pre-level recognition sub-model includes models trained on multiple (k) different new training sets, i.e., M j,1 M j,2 M j,k In this embodiment, the average of the output results of multiple models is used as the total output result r corresponding to the trained pre-level recognition sub-model. j,u ,Right now For other trained pre-level recognition sub-models, i.e., when taking different j values, the total output results corresponding to different trained pre-level recognition sub-models can also be determined. These total output results are as follows: r 1,v ,r 2,v ,…,r n,v .

[0087] Step B23: Determine the relationship between the total output of the n trained pre-level recognition sub-models and the first test sample t. v The corresponding second test sample s v s v =(r 1,v ,r 2,v ,…,r n,v ), and the second test sample s v Compared with the first test sample t v The labels are consistent.

[0088] In this embodiment of the invention, the total output results corresponding to all (n in total) trained pre-level recognition sub-models are concatenated together to obtain an n-dimensional vector (r). 1,v ,r 2,v ,…,r n,v ), and use this n-dimensional vector as the first test sample t v The corresponding second test sample s v Furthermore, both tests have the same label. For each first test sample in the first test set, a corresponding second test sample can be obtained by following the above process, thus obtaining the second test set. This second test set has the same number of samples as the first test set, that is, the number of first test samples is the same as the number of second test samples.

[0089] In this embodiment of the invention, a second test set is generated based on the first test set for testing the subsequent recognition model. This eliminates the need for setting up a large number of additional test samples and enables the simultaneous testing of both the preceding and subsequent recognition models based on a small number of test samples.

[0090] Optionally, the multiple pre-stage recognition models are text convolutional neural network models with different filter sizes. Furthermore, the filter size used by any one of the pre-stage recognition models is different from the filter sizes used by the other pre-stage recognition models.

[0091] In this embodiment of the invention, each pre-stage recognition model involves multiple filters, and the filter sizes are different for each filter; furthermore, the filter sizes involved in different pre-stage recognition models are also different. For example, this embodiment involves 5 TextCNNs, and the filter sizes used are: [10,11,12], [15,16,17], [20,21,22], [25,26,27], and [30,31,32]. This embodiment of the invention uses pre-stage recognition models with different filter sizes, which can comprehensively consider the local correlation of regions of different sizes, adapt to the complexities of Web attack detection scenarios, and result in more accurate recognition results.

[0092] The above details the method and process for detecting web attacks. This method can also be implemented using a corresponding device, the structure and function of which will be described in detail below.

[0093] Based on the same inventive concept, embodiments of the present invention also provide a device for detecting web attacks, see [link to relevant documentation]. Figure 3 As shown, the device includes:

[0094] The first acquisition module 31 is used to acquire a first training set, which includes multiple first training samples related to Web requests.

[0095] The pre-training module 32 is used to train multiple different pre-recognition models based on the first training set, and to determine multiple trained pre-recognition models.

[0096] The second acquisition module 33 is used to acquire a second training set including multiple second training samples, wherein the second training samples are related to the outputs of multiple previous recognition models;

[0097] The post-training module 34 is used to train the post-recognition model based on the second training set to determine the trained post-recognition model; the input of the post-recognition model is the output of multiple pre-recognition models.

[0098] The identification module 35 is used to detect whether a target Web request is attacked based on multiple trained pre-level identification models and trained post-level identification models.

[0099] Optionally, the second acquisition module 33 acquires a second training set including multiple second training samples, including:

[0100] The first training set is divided into k training subsets, and each training subset includes multiple first training samples;

[0101] The k-1 training subsets other than the i-th training subset are used as the i-th new training set, and the j-th pre-level recognition model is trained based on the i-th new training set to determine the trained pre-level recognition sub-model M. j,i i = 1, 2, ..., k, j = 1, 2, ..., n, where n is the number of the preceding recognition models;

[0102] The u-th first training sample x in the i-th training subset i,u The inputs are respectively fed into the n trained pre-level recognition sub-models M obtained based on the i-th new training set. j,i Determine each of the trained pre-level recognition sub-models M j,i The output result y j,i,u ;

[0103] Generate the u-th first training sample x in the i-th training subset. i,u The corresponding second training sample X i,u X i,u =(y 1,i,u ,y 2,i,u ,…,y n,i,u ), and the second training sample X i,u With the first training sample x i,u The labels are consistent.

[0104] Optionally, the first acquisition module 31 is further configured to: acquire a first test set containing multiple first test samples, and test each of the trained pre-level recognition models based on the first test set;

[0105] The second acquisition module 33 is further configured to: acquire a second test set containing multiple second test samples, and test the trained post-level recognition model based on the second test set.

[0106] Optionally, the second acquisition module 33 acquires a second test set containing multiple second test samples, including:

[0107] The v-th first test sample t in the first test set v The inputs are respectively fed into the j-th pre-level recognition sub-model M, which is trained based on k new training sets. j,i Determine each of the trained pre-level recognition sub-models M j,i The output result r j,i,u ;

[0108] Determine the total output r corresponding to the j-th trained pre-level recognition sub-model.j,u ,and

[0109] Based on the total output results corresponding to the n trained pre-level recognition sub-models, the first test sample t is determined. v The corresponding second test sample s v s v =(r 1,v ,r 2,v ,…,r n,v ), and the second test sample s v With the first test sample t v The labels are consistent.

[0110] Optionally, the multiple pre-stage recognition models are text convolutional neural network models with different filter sizes.

[0111] Optionally, the filter size used by any of the aforementioned pre-stage recognition models is different from the filter size used by the other aforementioned pre-stage recognition models.

[0112] Optionally, the subsequent recognition model is an XGBoost model.

[0113] This invention also provides a computer storage medium storing computer-executable instructions, including a program for performing the above-described method for detecting web attacks, wherein the computer-executable instructions can execute the method in any of the above-described method embodiments.

[0114] The computer storage medium can be any available medium or data storage device that a computer can access, including but not limited to magnetic storage (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical storage (e.g., CD, DVD, BD, HVD), and semiconductor storage (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).

[0115] Figure 4 A structural block diagram of an electronic device according to another embodiment of the present invention is shown. The electronic device 1100 may be a host server with computing capabilities, a personal computer (PC), or a portable computer or terminal, etc. The specific embodiments of the present invention do not limit the specific implementation of the electronic device.

[0116] The electronic device 1100 includes at least one processor 1110, a communications interface 1120, a memory array 1130, and a bus 1140. The processor 1110, the communications interface 1120, and the memory 1130 communicate with each other via the bus 1140.

[0117] The communication interface 1120 is used to communicate with network elements, including, for example, virtual machine management centers and shared storage.

[0118] Processor 1110 is used to execute programs. Processor 1110 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.

[0119] Memory 1130 is used for executable instructions. Memory 1130 may include high-speed RAM memory and may also include non-volatile memory, such as at least one disk storage device. Memory 1130 may also be a memory array. Memory 1130 may also be divided into blocks, and the blocks may be combined into virtual volumes according to certain rules. The instructions stored in memory 1130 can be executed by processor 1110 to enable processor 1110 to perform the method for detecting web attacks in any of the above method embodiments.

[0120] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for detecting web attacks, characterized in that, include: Obtain a first training set, which includes multiple first training samples related to Web requests; Based on the first training set, multiple different pre-level recognition models are trained to determine multiple trained pre-level recognition models. Obtain a second training set comprising multiple second training samples, wherein the second training samples are related to the outputs of the multiple preceding recognition models; The subsequent recognition model is trained based on the second training set to determine the trained subsequent recognition model. The input to the subsequent recognition model is the output of multiple preceding recognition models; The system detects whether a target web request is vulnerable to attack based on multiple trained pre-level and post-level recognition models. The acquisition of a second training set comprising multiple second training samples includes: The first training set is divided into k training subsets, and each training subset includes multiple first training samples; The k-1 training subsets other than the i-th training subset are used as the i-th new training set, and the j-th pre-level recognition model is trained based on the i-th new training set to determine the trained pre-level recognition sub-model M. j,i i = 1, 2, ..., k, j = 1, 2, ..., n, where n is the number of the preceding recognition models; The u-th first training sample x in the i-th training subset i,u The inputs are respectively fed into the n trained pre-level recognition sub-models M obtained based on the i-th new training set. j,i Determine each of the trained pre-level recognition sub-models M j,i The output result y j,i,u ; Generate the u-th first training sample x in the i-th training subset. i,u The corresponding second training sample X i,u X i,u =(y 1,i,u , y 2,i,u ,…, y n,i,u ), and the second training sample X i,u With the first training sample x i,u The labels are consistent.

2. The method according to claim 1, characterized in that, Also includes: Obtain a first test set containing multiple first test samples, and test each of the trained pre-level recognition models based on the first test set; Obtain a second test set containing multiple second test samples, and test the trained post-level recognition model based on the second test set.

3. The method according to claim 2, characterized in that, The step of obtaining a second test set containing multiple second test samples includes: The v-th first test sample t in the first test set v The inputs are respectively fed into the j-th pre-level recognition sub-model M, which is trained based on k new training sets. j,i Determine each of the trained pre-level recognition sub-models M j,i The output result r j,i,u ; Determine the total output r corresponding to the j-th trained pre-level recognition sub-model. j,u ,and ; Based on the total output results corresponding to the n trained pre-level recognition sub-models, the first test sample t is determined. v The corresponding second test sample s v s v =(r 1,v , r 2,v ,…, r n,v ), and the second test sample s v With the first test sample t v The labels are consistent.

4. The method according to any one of claims 1-3, characterized in that, The aforementioned pre-stage recognition models are text convolutional neural network models with different filter sizes.

5. The method according to claim 4, characterized in that, The filter size used by any of the aforementioned pre-level recognition models is different from the filter size used by the other aforementioned pre-level recognition models.

6. The method according to claim 4, characterized in that, The subsequent recognition model is the XGBoost model.

7. A device for detecting web attacks, characterized in that, include: The first acquisition module is used to acquire a first training set, which includes multiple first training samples related to Web requests. The pre-training module is used to train multiple different pre-recognition models based on the first training set, and to determine multiple trained pre-recognition models. The second acquisition module is used to acquire a second training set including multiple second training samples, wherein the second training samples are related to the outputs of the multiple previous recognition models; The post-training module is used to train the post-recognition model based on the second training set and determine the trained post-recognition model. The input to the subsequent recognition model is the output of multiple preceding recognition models; The identification module is used to detect whether a target Web request is attacked based on multiple trained pre-level identification models and the trained post-level identification model; The acquisition of a second training set comprising multiple second training samples includes: The first training set is divided into k training subsets, and each training subset includes multiple first training samples; The k-1 training subsets other than the i-th training subset are used as the i-th new training set, and the j-th pre-level recognition model is trained based on the i-th new training set to determine the trained pre-level recognition sub-model M. j,i i = 1, 2, ..., k, j = 1, 2, ..., n, where n is the number of the preceding recognition models; The u-th first training sample x in the i-th training subset i,u The inputs are respectively fed into the n trained pre-level recognition sub-models M obtained based on the i-th new training set. j,i Determine each of the trained pre-level recognition sub-models M j,i The output result y j,i,u ; Generate the u-th first training sample x in the i-th training subset. i,u The corresponding second training sample X i,u X i,u =(y 1,i,u , y 2,i,u ,…, y n,i,u ), and the second training sample X i,u With the first training sample x i,u The labels are consistent.

8. A computer storage medium, characterized in that, The computer storage medium stores computer-executable instructions for performing the method for detecting web attacks as described in any one of claims 1-6.

9. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method for detecting web attacks as described in any one of claims 1-6.

Citation Information

Patent Citations

  • A Web attack detection method based on collaborative training

    CN109831460A