Request text processing method and device, electronic equipment and storage medium
By augmenting the command injection text and non-attack request text with data, a rich sample dataset is generated. Multi-scale feature extraction and feature fusion are performed using an attack detection model, which solves the problem of false negatives and false positives of command injection attacks in servers, and achieves more accurate attack detection and defense.
Patent Information
- Application Number
- CN202310298404.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-03-24
AI Technical Summary
In existing technologies, servers have difficulty effectively identifying and defending against HTTP request text for command injection attacks, which can easily lead to missed or false positives.
By augmenting the command attack text and non-attack request text with data, a rich sample request dataset is generated. Multi-scale feature extraction and feature fusion are performed using an attack detection model, and the model is trained with loss values to improve detection accuracy.
It enhances the detection of attacks on request text, reduces false detections, and can defend against command injection attacks in a timely manner.
Smart Images

Figure CN118694547A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a method, device, electronic device and storage medium for processing request text in the field of computer technology. Background Art
[0002] With the continuous development of network technology, network security issues are increasing. Generally, network users can obtain various network resources from a server by sending a hypertext transfer protocol (HTTP) request text to the server. However, if the network user is a hacker, the hacker can inject command attacks into the HTTP request to obtain some network resources from the server that may cause data security risks to the server, which is extremely dangerous to the server.
[0003] In the related art, the server often matches the HTTP request text to be detected with multiple HTTP request texts containing command injection attacks, and if the match is successful, it is determined that the HTTP request text to be detected is an attack request text, and then an alarm signal of command injection attack is issued. However, in the actual network environment, the HTTP request text to be detected is complex and diverse. Therefore, under this method, there may be a phenomenon of missed reports or false reports. Summary of the invention
[0004] The present application provides a method, device, electronic device and storage medium for processing request text, and the method is capable of.
[0005] In a first aspect, a method for processing a request text is provided, the method comprising: obtaining a target request text from a sample request data set, the sample request data set comprising an attack request text and a non-attack request text, the attack request text being obtained by data enhancement of a command attack text and the non-attack request text; inputting the target request text into an attack detection model, the attack detection model performing multi-scale feature extraction based on the target request text to obtain features of multiple scales; performing feature fusion on the multiple features of different scales to obtain a fused feature, and determining a detection result of the target request text based on the fused feature; and training the attack detection model based on a loss value between the detection result and a labeling result of the target request text, the labeling result being used to indicate whether the target request text is an attack request text.
[0006] In the above technical solution, the attack request text in the sample request data set is obtained by data enhancement of the command attack text and the non-attack request text, that is, the attack request text in the sample request data set can be enriched based on the command attack text and the non-attack request text. To a certain extent, the attack detection effect of the attack detection model on the request text to be detected can be enhanced. The target request text is obtained from the sample request data set; the attack detection model performs multi-scale feature extraction based on the target request text to obtain features of multiple different scales, which can characterize most of the features of the target request text. The features of the multiple different scales are subjected to feature fusion to obtain fusion features, which can achieve the complementary advantages of the features of the multiple different scales, so that the attack detection model obtains more robust and accurate detection results. The detection result of the target request text is determined based on the fusion feature; the attack detection model is trained based on the loss value between the detection result and the annotation result of the target request text. Therefore, in the process of actual application, the request text can be attacked based on the trained attack detection model, and the problem of misdetection of the request text can be avoided; and when the request text is detected as an attack request text by the attack detection model, corresponding measures can be taken to prevent further attacks of the request text, etc.
[0007] In combination with the first aspect, in some possible implementations, the method of performing data enhancement on the command attack text and the non-attack request text includes: performing data enhancement on the command attack text to obtain command attack enhanced text; and performing data enhancement on the non-attack request text based on the command attack enhanced text to obtain the attack request text.
[0008] In the above technical solution, since in actual applications, the command attack text exists in the request text, that is, the reason why the request text is offensive is that the command attack text exists in the request text; furthermore, since in actual applications, there are relatively few attack request texts that can be directly used, and the collection cost is huge. In this regard, the command attack text can be data enhanced to obtain the command attack enhanced text to enrich the number of command attack texts; based on the command attack enhanced text, the non-attack request text (multiple non-attack request texts) is data enhanced to obtain the attack request text, that is, multiple command attack texts are made to exist in multiple non-attack request texts, which can enrich the number of attack request texts.
[0009] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, data enhancement is performed on the command attack text to obtain the command attack enhanced text, including at least one of the following: adding a first command field to the command attack text to obtain the command attack enhanced text; updating the parameters of at least one command field in the command attack text to obtain the command attack enhanced text; deleting the second command field in the command attack text to obtain the command attack enhanced text.
[0010] In the above technical solution, it should be understood that the text data enhancement technology includes but is not limited to random addition and deletion of words, synonym replacement, text truncation and splicing and other technologies. However, for attack detection scenarios, these technologies mentioned above cannot be used directly. This is because in order to make the attack request text effective, it is necessary to maintain the integrity of the command attack text in the attack request text, and it cannot be arbitrarily cut and spliced. For example, most command attack texts are parameterized and have their own grammatical structure. It is necessary to maintain the coherence and integrity of the attack command and its parameters. In this regard, in the above technical solution, a first command field is added to the command attack text; the parameters of at least one command field in the command attack text are updated; and the second command field is deleted in the command attack text to achieve data enhancement of the command attack text and obtain a command attack enhanced text.
[0011] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, data enhancement is performed on the non-attack request text based on the command attack enhancement text to obtain the attack request text, including at least one of the following: nesting the command field in the command attack enhancement text in the non-attack request text to obtain the attack request text; replacing the request text in the non-attack request text with the command field in the command attack enhancement text to obtain the attack request text.
[0012] In the above technical solution, the command attack text (command attack enhanced text) is implemented in two ways in the request text (non-attack request text). Specifically, the command field in the command attack enhanced text is nested in the non-attack request text; the request text in the non-attack request text is replaced with the command field in the command attack enhanced text to obtain a larger number of attack request texts and enrich the attack request texts in the sample request data set.
[0013] In summary, the present application proposes a method for processing request texts, wherein the attack request texts in the sample request data set are obtained by data enhancement of command attack texts and non-attack request texts, that is, the attack request texts in the sample request data set can be enriched based on command attack texts and non-attack request texts. To a certain extent, the attack detection effect of the attack detection model on the request text to be detected can be enhanced. The target request text is obtained from the sample request data set; the attack detection model performs multi-scale feature extraction based on the target request text to obtain features of multiple different scales, which can characterize most of the features of the target request text. The features of the multiple different scales are subjected to feature fusion to obtain fused features, which can realize the complementary advantages of the features of the multiple different scales, so that the attack detection model obtains more robust and accurate detection results. The detection result of the target request text is determined based on the fused feature; the attack detection model is trained based on the loss value between the detection result and the annotation result of the target request text. Therefore, in the process of actual application, the request text can be subjected to attack detection based on the trained attack detection model, thereby avoiding the problem of misdetection of the request text; and when the request text is detected as an attack request text by the attack detection model, corresponding measures can be taken to prevent further attacks on the request text.
[0014] In addition, in actual applications, the command attack text exists in the request text, that is, the reason why the request text is offensive is that the command attack text exists in the request text; furthermore, in actual applications, there are relatively few attack request texts that can be directly used, and the collection cost is huge. In this regard, the command attack text can be data enhanced to obtain the command attack enhanced text to enrich the number of command attack texts; based on the command attack enhanced text, the non-attack request text (multiple non-attack request texts) is data enhanced to obtain the attack request text, that is, multiple command attack texts are made to exist in multiple non-attack request texts, which can enrich the number of attack request texts.
[0015] In a second aspect, a method for processing a request text is provided, the method comprising: inputting a request text to be detected into an attack detection model, the attack detection model being trained by a target request text in a sample request data set, the sample request data set comprising an attack request text and a non-attack request text, the attack request text being obtained by data enhancement of a command attack text and the non-attack request text; performing multi-scale feature extraction on the request text to be detected by the attack detection model to obtain features of multiple different scales; performing feature fusion on the features of the multiple different scales by the attack detection model to obtain fused features, and performing attack detection on the request text to be detected based on the fused features to determine whether the request text to be detected is an attack request text.
[0016] In the above technical solution, in actual application, the process of using the attack detection model to perform attack detection on the request text (the request text to be detected). The attack detection model is trained based on non-attack request text and data-enhanced attack request text (the target request text in the sample request data set). Therefore, the trained attack detection model has a better attack detection effect. The process of using the attack detection model to perform attack detection on the request text to be detected is as follows: the attack detection model performs multi-scale feature extraction on the request text to be detected to obtain features of multiple different scales; the features of multiple different scales are subjected to feature fusion to obtain fused features, and attack detection is performed on the request text to be detected based on the fused features to determine whether the request text to be detected is an attack request text.
[0017] In combination with the second aspect, in some possible implementations, the method also includes: when the request text to be detected is an attack request text, determining a first response message to the request text to be detected; based on the first response message and a reference response message of the attack request text, determining that the request text to be detected successfully attacks a response device, the reference response message being a message obtained when the attack request text successfully attacks the response device, and the response device being a device that generates the first response message.
[0018] In the above technical solution, only when the request text to be detected is an attack request text, the attack request text may successfully attack the response device. In this regard, when the request text to be detected is an attack request text, the request text to be detected may be further processed. Specifically, a first response message of the request text to be detected is determined, and a detection is performed on whether the attack is successful based on a reference response message of the attack request text that successfully attacks the response device.
[0019] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, based on the first response message and the reference response message of the attack request text, determining that the request text to be detected successfully attacks the response device includes at least one of the following: determining that the request text to be detected successfully attacks the response device when searching the first response message using a regular expression for multiple fields in a specified format, and the multiple fields in the specified format are obtained from the reference response message; extracting the attack semantic vector of the reference response message and the first semantic vector of the first response message; determining the similarity between the first semantic vector and the attack semantic vector; and when the similarity is greater than a preset similarity, determining that the request text to be detected successfully attacks the response device.
[0020] In the above technical solution, two methods are used to determine whether the request text to be detected successfully attacks the response device. Specifically, when the format of the request text to be detected is relatively simple, a regular expression is used to search for multiple fields in a specified format contained in the first response message of the request text to be detected (the multiple fields in the specified format are obtained from the reference response message) to determine whether the request text to be detected successfully attacks the response device; when the format of the request text to be detected is relatively complex, the similarity between the attack semantic vector of the reference response message and the first semantic vector of the first response message is used, and when the similarity is greater than a preset similarity, it is determined that the request text to be detected successfully attacks the response device.
[0021] In summary, the present application proposes a method for processing request text, and describes the process of using an attack detection model to perform attack detection on a request text (request text to be detected) in a practical application. The attack detection model is trained based on non-attack request text and data-enhanced attack request text (target request text in the sample request data set). Therefore, the trained attack detection model has a better attack detection effect. The process of using the attack detection model to perform attack detection on the request text to be detected is as follows: the attack detection model performs multi-scale feature extraction on the request text to be detected to obtain features of multiple different scales; the features of multiple different scales are subjected to feature fusion to obtain fused features, and attack detection is performed on the request text to be detected based on the fused features to determine whether the request text to be detected is an attack request text.
[0022] In addition, since the request text to be detected is an attack request text, the attack request text may successfully attack the response device. In this regard, when the request text to be detected is an attack request text, the request text to be detected is further processed. Specifically, the first response message of the request text to be detected is determined, and the request text to be detected is detected based on the reference response message of the attack request text that successfully attacks the response device to see whether the attack is successful.
[0023] In a third aspect, a device for processing a request text is provided, the device comprising: an acquisition module, used to acquire a target request text from a sample request data set, the sample request data set comprising an attack request text and a non-attack request text, the attack request text being obtained by data enhancement of a command attack text and the non-attack request text; a processing module, used to: input the target request text into an attack detection model, the attack detection model performing multi-scale feature extraction based on the target request text to obtain features of multiple different scales; performing feature fusion on the multiple different scale features to obtain fused features, and determining a detection result of the target request text based on the fused features; and training the attack detection model based on a loss value between the detection result and a labeling result of the target request text, the labeling result being used to indicate whether the target request text is an attack request text.
[0024] In combination with the third aspect, in some possible implementations, the device also includes: a data enhancement module, used to: perform data enhancement on the command attack text to obtain command attack enhanced text; perform data enhancement on the non-attack request text based on the command attack enhanced text to obtain the attack request text.
[0025] In combination with the third aspect and the above-mentioned implementation methods, in some possible implementation methods, the data enhancement module is specifically used for at least one of the following: adding a first command field to the command attack text to obtain the command attack enhanced text; updating the parameters of at least one command field in the command attack text to obtain the command attack enhanced text; deleting the second command field in the command attack text to obtain the command attack enhanced text.
[0026] In combination with the third aspect and the above-mentioned implementation methods, in some possible implementation methods, the data enhancement module is specifically used for at least one of the following: nesting the command field in the command attack enhancement text in the non-attack request text to obtain the attack request text; replacing the request text in the non-attack request text with the command field in the command attack enhancement text to obtain the attack request text.
[0027] In a fourth aspect, a device for processing a request text is provided, the device comprising: an input module, used to input a request text to be detected into an attack detection model, the attack detection model is trained by a target request text in a sample request data set, the sample request data set includes an attack request text and a non-attack request text, the attack request text is obtained by data enhancement of a command attack text and the non-attack request text; an extraction module, used to perform multi-scale feature extraction on the request text to be detected by the attack detection model to obtain features of multiple different scales; a detection module, used to perform feature fusion on the features of the multiple different scales by the attack detection model to obtain a fused feature, and perform attack detection on the request text to be detected based on the fused feature to determine whether the request text to be detected is an attack request text.
[0028] In combination with the fourth aspect, in some possible implementations, the device also includes: a determination module, used to: when the request text to be detected is an attack request text, determine a first response message to the request text to be detected; based on the first response message and a reference response message of the attack request text, determine that the request text to be detected successfully attacks a response device, the reference response message is a message obtained by the attack request text successfully attacking the response device, and the response device is a device that generates the first response message.
[0029] In combination with the fourth aspect and the above-mentioned implementation methods, in some possible implementation methods, the determination module is specifically used for at least one of the following: determining that the request text to be detected successfully attacks the response device when searching the first response message for multiple fields in a specified format using a regular expression, and the multiple fields in the specified format are obtained from the reference response message; extracting the attack semantic vector of the reference response message and the first semantic vector of the first response message; determining the similarity between the first semantic vector and the attack semantic vector; and determining that the request text to be detected successfully attacks the response device when the similarity is greater than a preset similarity.
[0030] In a fifth aspect, a computer-readable storage medium is provided, which stores instructions. When the instructions are executed on a computer or a processor, the computer or the processor executes the method in the first aspect or any possible implementation of the first aspect, and the computer or the processor executes the method in the second aspect or any possible implementation of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a structural diagram of a network system provided in an embodiment of the present application;
[0032] Figure 2is a schematic flow chart of a method for processing a request text provided in an embodiment of the present application;
[0033] Figure 3 is a schematic diagram of a first feature provided by an embodiment of the present application;
[0034] Figure 4 is a schematic diagram of determining fusion features provided in an embodiment of the present application;
[0035] Figure 5 is another schematic diagram of determining fusion features provided in an embodiment of the present application;
[0036] Figure 6 is a schematic flow chart of another method for processing a request text provided in an embodiment of the present application;
[0037] Figure 7 It is a structural diagram of a device for processing a request text provided in an embodiment of the present application;
[0038] Figure 8 It is a structural schematic diagram of another device for processing a request text provided in an embodiment of the present application;
[0039] Fig. 9 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The technical solutions in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, "multiple" means two or more than two. The terms "first" and "second" are used for descriptive purposes only and should not be understood as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0041] Figure 1 It is a structural diagram of a network system provided in an embodiment of the present application.
[0042] For example, Figure 1 As shown, the network system includes multiple access devices, third-party devices and servers. The server is a response device that can respond to request texts of multiple access devices, including a first access device, a second access device and a third access device; the third-party device (electronic device) is used to perform attack detection on the request texts of multiple access devices accessing the server; and if the request text is an attack request text, the request text is further detected to see whether it successfully attacks the server.
[0043] Taking the first access device accessing the server as an example, the process of processing the request text is described. The first access device needs to obtain the first resource from the server, so the first access device can send an http request text to the server, and the http request text carries the source address (the address of the first access device), the destination address (the address of the server) and the content to be requested. When the server receives the http request text, the server processes the http request text and sends the http request text to the electronic device.
[0044] The server responds to the http request text based on the content of the request to be requested, and obtains a response message. The electronic device performs attack detection on the http request text; if the http request text is not an attack request text, the electronic device sends a first signal to the server, and the first signal is used to indicate that the http request text is not an attack request text, and the server does not take any defensive measures against the first access device. If the http request text is an attack request text, the electronic device sends a second signal to the server, and detects the response message of the http request text to determine whether the http request text successfully attacks the server, wherein the second signal is used to indicate that the http request text is an attack request text. If the http request text successfully attacks the server, the electronic device sends a third signal to the server, and the third signal is used to indicate that the http request text successfully attacks the server, and the server may not respond to other http request texts when it receives other http request texts sent by the first access device next time.
[0045] Figure 2 It is a schematic flowchart of a method for processing a request text provided in an embodiment of the present application.
[0046] It should be understood that the method for processing a request text provided in the embodiment of the present application can be applied to Figure 1 Alternatively, the method for processing a request text may also be applied to a third-party device (electronic device) that is in communication with the server, and the electronic device may perform attack detection on the request text for accessing the server, and if the request text is an attack request text, detect whether the request text successfully attacks the server.
[0047] For example, Figure 2 As shown, the method 200 includes:
[0048] 201. The electronic device obtains a target request text from a sample request data set, where the sample request data set includes an attack request text and a non-attack request text, where the attack request text is obtained by data enhancement of a command attack text and the non-attack request text.
[0049] It should be understood that the "attack request text" in the above step 201 can be understood as a request text with a command attack text. For example, an http request for an injection command attack; "non-attack request text" can be understood as a request text without a command attack text; "command attack text" can be understood as an offensive or destructive command text, which can be a command text for a Windows system and / or a Linux system. For example, ping-l 6550-t server's ip address. Among them, "-l" is the size of the data packet sent, and "-t" means continuously sending data packets to the server. The command attack text means continuously sending data packets of 6550 bytes to the server, which will cause the server system to crash.
[0050] It should also be understood that the sample request data set includes positive samples and negative samples, wherein the positive sample is the attack request text and the negative sample is the non-attack request text. In this way, the attack detection model trained based on the attack request text and the non-attack request text can accurately perform attack detection on the request text to be detected. Since in practical applications, there are relatively few attack request texts that can be directly used and the collection cost is huge. In this regard, in this implementation, the command attack text and the non-attack request text are data enhanced to obtain the attack request text, and then the sample request data set is formed based on the non-attack request text and the attack request text obtained by data enhancement, so that when the trained attack detection model performs attack detection on the request text to be detected, more accurate detection results can be obtained.
[0051] In one possible implementation, the method for an electronic device to perform data enhancement on a command attack text and the non-attack request text includes: the electronic device performs data enhancement on the command attack text to obtain a command attack enhanced text; and the electronic device performs data enhancement on the non-attack request text based on the command attack enhanced text to obtain the attack request text.
[0052] It should be understood that in actual applications, the command attack text exists in the request text, that is, the reason why the request text is offensive is that it contains the command attack text; in addition, in actual applications, there are relatively few attack request texts that can be directly used, and the collection cost is huge. Therefore, it is necessary to enrich the number of attack request texts.
[0053] In the above technical solution, data enhancement can be performed on the command attack text to obtain command attack enhanced text to enrich the number of command attack texts; based on the command attack enhanced text, data enhancement can be performed on the non-attack request text (multiple non-attack request texts) to obtain attack request text, that is, multiple command attack texts are present in multiple non-attack request texts, which can enrich the number of attack request texts.
[0054] The process of "performing data enhancement on the command attack text, and performing data enhancement on the non-attack request text based on the command attack enhancement text" is discussed in detail as follows.
[0055] In one possible implementation, the electronic device performs data enhancement on the command attack text to obtain the command attack enhanced text, including at least one of the following: the electronic device adds a first command field to the command attack text to obtain the command attack enhanced text; the electronic device updates the parameters of at least one command field in the command attack text to obtain the command attack enhanced text; the electronic device deletes the second command field in the command attack text to obtain the command attack enhanced text.
[0056] It should be understood that text data enhancement techniques include but are not limited to random addition and deletion of words, synonym replacement, and text truncation and splicing. However, for attack detection scenarios, these techniques mentioned above cannot be used directly. This is because in order to make the attack request text effective, the integrity of the command attack text must be maintained in the attack request text, and it cannot be arbitrarily cut or spliced. For example, most command attack texts have parameters and their own grammatical structure, and the coherence and integrity of the attack command and its parameters must be maintained.
[0057] In the above technical solution, based on the above explanations and descriptions, in this solution, a first command field can be added to the command attack text; the parameters of at least one command field in the command attack text are updated; and the second command field is deleted from the command attack text to achieve data enhancement of the command attack text and obtain a command attack enhanced text.
[0058] Exemplarily, the command attack text is ping -1 6550 -t -4 server's IP address, where -4 indicates that an IPv4 address is used in the command attack text. The command attack text indicates that 6550-byte data packets are continuously sent to the server, which may cause the server's system to crash.
[0059] The first type is to add the first command field "-r count" to the command attack text, and the command attack enhanced text is ping-l 6550-tr count-4. Among them, "-r count" indicates the number of routers that the command attack enhanced text passes through when it is sent to the server (IPv4 server address). The command attack enhanced text indicates that 6550-byte data packets are continuously sent to the server and the number of routers passed through is recorded; the second type is to change "6550" in the command attack text to "6520", and the command attack enhanced text is ping-l 6520-t-4, and the command attack enhanced text indicates that 6520-byte data packets are continuously sent to the server (IPv4 server address); the third type is to delete "-4" in the command attack text, and the command attack enhanced text is ping-l 6550-t, and the command attack enhanced text indicates that 6550-byte data packets are continuously sent to the server (IPv4 server address or IPv6 server address).
[0060] In one possible implementation, the electronic device performs data enhancement on the non-attack request text based on the command attack enhancement text to obtain the attack request text, including at least one of the following: the electronic device embeds the command field in the command attack enhancement text in the non-attack request text to obtain the attack request text; the electronic device replaces the request text in the non-attack request text with the command field in the command attack enhancement text to obtain the attack request text.
[0061] It should be understood that, first, the command field in the command attack enhancement text is nested in the non-attack request text, and the content of the request text in the non-attack request text is not changed, but the command field in the command attack enhancement text is added to the non-attack request text, so that the non-attack request text will carry the command field in the attack command text, so that the non-attack request text becomes an attack request text; second, the request text in the non-attack request text is replaced with the command field in the command attack enhancement text, and the content of the request text in the non-attack request text is changed, so that the non-attack request text includes the command field in the attack command text, and the non-attack request text becomes an attack request text.
[0062] In the above technical solution, the command attack text (command attack enhanced text) is implemented in two ways in the request text (non-attack request text). Specifically, the command field in the command attack enhanced text is nested in the non-attack request text; the request text in the non-attack request text is replaced with the command field in the command attack enhanced text to obtain a larger number of attack request texts and enrich the attack request texts in the sample request data set.
[0063] 202, the electronic device inputs the target request text into the attack detection model, and the attack detection model performs multi-scale feature extraction based on the target request text to obtain features of multiple scales; performs feature fusion on the multiple scales to obtain fused features, and determines a detection result of the target request text based on the fused features.
[0064] Among them, the architecture of the "attack detection model" in the above step 202 is a convolutional neural network architecture based on the Text CNN (Convolutional Neural Networks) model.
[0065] In one possible implementation, the attack detection model performs multi-scale feature extraction based on the target request text to obtain features of multiple scales, including: the attack detection model converts the target request text into a target word vector, and uses convolution kernels of different sizes to perform multi-scale feature extraction on the target word vector to obtain the multiple features of different scales.
[0066] It should be understood that converting the target request text into the target word vector is to represent the target request text as a series of vectors that can express the text semantics, so that the subsequent attack detection model can extract features from the target request text. Using convolution kernels of different sizes to extract multi-scale features from the target word vector means using convolution kernels of different lengths and widths to extract multi-scale features from the target word vector. Usually, convolution kernels of [1*1], [3*3], [5*5] and [7*7] are used to extract multi-scale features from the target word vector respectively, so as to obtain features of multiple different scales.
[0067] In the above technical solution, the target request text is converted into a target word vector to facilitate the processing of the target request text; multi-scale feature extraction of the target word vector is performed using convolution kernels of different sizes to obtain more comprehensive features of target request texts of different scales. This feature has a stronger ability to characterize the target request text, which makes the attack detection model have a better attack detection effect.
[0068] Optionally, the attack detection model includes an embedding layer and a convolution layer, and the attack detection model converts the target request text into a target word vector, and uses convolution kernels of different sizes to perform multi-scale feature extraction on the target word vector to obtain the multiple features of different scales, including: the embedding layer converts the target request text into a target word vector, and the convolution layer uses convolution kernels of different sizes to perform multi-scale feature extraction on the target word vector to obtain the multiple features of different scales.
[0069] Among them, the embedding layer can be regarded as the Embedding layer; the convolutional layer can be regarded as the Encoder layer.
[0070] Among them, the process of determining whether the convolutional layer training is completed is as follows.
[0071] In one possible implementation, the method 200 also includes: when the convolution layer performs multi-scale feature extraction on multiple positive sample word vectors using convolution kernels of different sizes, and the first distance value between the features of different scales obtained is less than the first preset distance, when the convolution layer performs multi-scale feature extraction on multiple negative sample word vectors using convolution kernels of different sizes, and the second distance value between the features of different scales obtained is less than the second preset distance, and the difference between the first distance value and the second distance value is greater than the first value, the electronic device determines that the convolution layer training is successful; wherein the multiple positive sample word vectors are obtained by converting multiple positive samples, and the multiple negative sample word vectors are obtained by converting multiple negative samples.
[0072] Optionally, the first distance value and the second distance value are both Euclidean distance values or cosine distance values.
[0073] In the above technical solution, the features between positive samples are similar, the features between negative samples are similar, and the features between positive samples and negative samples are quite different. Therefore, the feature extraction capability of the convolution layer can be measured by the first distance value between the features of different scales obtained by the positive sample, the second distance value between the features of different scales obtained by the negative sample, and the difference between the first distance value and the second distance value. In this way, the convolution layer can have better feature extraction capability.
[0074] The process of "fusing the multiple features of different scales to obtain fused features" is discussed in two ways as follows.
[0075] In a possible implementation, the attack detection model performs feature fusion on the multiple features of different scales to obtain a fused feature, including: the attack detection model performs feature splicing on the multiple features of different scales in the channel direction to obtain the fused feature, and the number of channels of the fused feature is the sum of the number of channels of the multiple features of different scales.
[0076] In the above technical solution, features of multiple scales are concatenated to obtain fused features with multiple channels, which realizes the complementary advantages of features of multiple scales and enables the attack detection model to obtain more robust and accurate attack detection results.
[0077] It should be understood that before the attack detection model performs feature splicing on the multiple features of different scales, the method further includes: the attack detection model performs upsampling on the multiple features of different scales to obtain multiple sampled features, and then performs feature splicing on the multiple sampled features. "Upsampling" refers to performing element interpolation in features of each scale so that the features of each scale in the multiple features of different scales become features of the same scale (same in length and width), which is conducive to subsequent feature splicing. The upsampling in this embodiment mainly refers to zero padding.
[0078] It should also be understood that the size of each feature can be characterized by the length, width and number of channels of the feature, where the number of channels is also called depth.
[0079] Figure 3 It is a schematic diagram of a first feature provided in an embodiment of the present application.
[0080] For example, Figure 3 The first feature shown in the figure has a channel number of 3, which means that the first feature is composed of features of three channels (feature a, feature b, and feature c). The length and width of features a, b, and c are all 2, which means that the size of each of these three features is 2*2, that is, each feature is composed of 4 elements, specifically feature a is composed of elements 5, 3, 1, and 2; feature b is composed of elements 2, 6, 3, and 1; feature c is composed of elements 8, 3, 4, and 7.
[0081] It should also be understood that the feature splicing of the multiple features of different scales in the channel direction can be simply understood as connecting the multiple features of different scales in the channel direction. Before and after feature fusion, the number of channels will change.
[0082] Figure 4 It is a schematic diagram of determining fusion features provided in an embodiment of the present application.
[0083] For example, Figure 4 The second feature shown in (a) in the figure has a length, a width and a number of channels of 2, 2 and 3 respectively; the features on the three channels of the second feature are feature a, feature b and feature c respectively, wherein feature a is composed of elements 5, 3, 1 and 2; feature b is composed of elements 2, 6, 3 and 1; feature c is composed of elements 8, 3, 4 and 7. Figure 4 The third feature shown in (b) has a length, width and number of channels of 2, 3 and 2 respectively; the features on the two channels of the third feature are feature d and feature e respectively, where feature d is composed of elements 6, 3, 1, 2, 7 and 3; feature e is composed of elements 2, 4, 1, 8, 4 and 9. The fourth feature is obtained by splicing the second and third features in the channel direction. Figure 4As shown in (c) in the figure. Figure 4 It can be seen from (c) that after the features a, b and c constituting the second feature are padded with zeros in the width direction, the third feature and the second feature after zero padding are spliced on the channel to obtain the fourth feature.
[0084] In another possible implementation, the attack detection model performs feature fusion on the multiple features of different scales to obtain a fused feature, including: the attack detection model performs feature addition on the multiple features of different scales in length and width directions to obtain the fused feature, and the number of channels of the fused feature is the maximum value of the number of channels among the multiple features of different scales.
[0085] In the above technical solution, features of multiple scales are fused in another way. Specifically, the features of the multiple scales are added in the length and width directions to obtain the fused features. This achieves the complementary advantages of features of multiple scales, so that the attack detection model obtains more robust and accurate attack detection results.
[0086] It should be understood that before the attack detection model performs feature addition on the multiple features of different scales, the method further includes: the attack detection model performs upsampling on the multiple features of different scales to obtain multiple sampled features, and then performs feature addition on the multiple sampled features. "Upsampling" refers to performing element interpolation on features of each scale so that features of each different scale among the multiple features of different scales become features of the same scale (same in length, width and height), which is conducive to subsequent feature addition. Upsampling in this embodiment mainly refers to zero padding.
[0087] It should also be understood that adding the features of the multiple different scales in the length and width directions can be simply understood as adding the elements of the features of the multiple different scales in the features of the multiple different scales correspondingly. The number of channels does not change before and after feature fusion.
[0088] Figure 5 It is another schematic diagram of determining fusion features provided in an embodiment of the present application.
[0089] For example, Figure 5 The second feature shown in (a) and Figure 5 Taking the third feature shown in (b) as an example, the process of adding features is described. By comparing the length, width, and number of channels of the second feature (2, 2, and 3, respectively) and the length, width, and number of channels of the third feature (2, 3, and 2, respectively), it is concluded that the elements of the second and third features need to be padded with zeros. Then, the fifth feature is obtained (see Figure 5 (c)) and the sixth feature (see Figure 5Then, add the elements of feature a and feature d, add the elements of feature b and feature e, and add the elements of feature c and feature f to obtain the seventh feature (see Figure 5 (e) in the figure). The seventh feature is composed of feature h, feature i and feature c, wherein feature h is composed of elements 11, 6, 2, 4, 7 and 3; feature i is composed of elements 4, 10, 4, 9, 4 and 9; feature c is composed of elements 8, 3, 4, 7, 0 and 0.
[0090] Optionally, the attack detection model also includes a splicing layer, and the attack detection model performs feature splicing on the multiple features of different scales in the channel direction to obtain the fused feature, including: the splicing layer performs feature splicing on the multiple features of different scales in the channel direction to obtain the fused feature.
[0091] Among them, the splicing layer can be regarded as the Concat layer (feature splicing layer).
[0092] Optionally, the attack detection model also includes an addition layer, and the attack detection model adds the multiple features of different scales in the length and width directions to obtain the fused feature, including: the addition layer adds the multiple features of different scales in the length and width directions to obtain the fused feature.
[0093] Among them, the addition layer can be regarded as the Add layer (feature addition layer).
[0094] Optionally, the attack detection model further includes a classification layer, and determining a detection result of the target request text based on the fusion feature includes: determining, by the classification layer, a detection result of the target request text based on the fusion feature.
[0095] Among them, the classification layer can be regarded as the Classifier layer.
[0096] 203, the electronic device trains the attack detection model based on the loss value between the detection result and the annotation result of the target request text, where the annotation result is used to indicate whether the target request text is an attack request text.
[0097] It should be understood that the annotation result is the result of annotating the target request text manually or by an electronic device before training the attack detection model. During the training of the attack detection model, the attack detection result of the attack detection model on the target request text should be as close to the annotation result as possible, that is, the loss value should be as small as possible, so that the attack detection model obtained will have a better attack detection effect.
[0098] In a possible implementation, the method 200 further includes: when the loss value is less than a preset loss value, the electronic device determines that the attack detection model training is successful; when the loss value is greater than or equal to the preset loss value, the electronic device continues to train the attack detection model.
[0099] In the above technical solution, the loss value is used to measure whether to continue training the attack detection model. When the loss value is less than the preset loss value, it indicates that the attack detection model already has a good attack detection effect, and the attack detection model does not need to be further trained. Therefore, the electronic device determines that the attack detection model is successfully trained. When the loss value is greater than or equal to the preset loss value, it indicates that the attack detection effect of the attack detection model cannot meet the requirements, and the attack detection model needs to be further trained.
[0100] It should be understood that the above steps 201 to 203 are the training process of the attack detection model. The actual use process of the attack detection model is described below, and the details can be found in steps 601 to 603.
[0101] Figure 6 It is a schematic flowchart of another method for processing request text provided in an embodiment of the present application.
[0102] It should be understood that, like the above-mentioned method for processing a request text, another method for processing a request text provided in an embodiment of the present application can be applied to Figure 1 Alternatively, the method for processing the request text can also be applied to a third-party device (electronic device) that is in communication with the server, and the third-party device can perform attack detection on the request text for accessing the server, and if the request text is an attack request text, detect whether the request text successfully attacks the server.
[0103] For example, Figure 6 As shown, the method 600 includes:
[0104] 601, the electronic device inputs the request text to be detected into the attack detection model, where the attack detection model is trained by the target request text in the sample request data set, where the sample request data set includes the attack request text and the non-attack request text, where the attack request text is obtained by data enhancement of the command attack text and the non-attack request text.
[0105] 602, the attack detection model performs multi-scale feature extraction on the request text to be detected to obtain features of multiple different scales.
[0106] 603, the attack detection model fuses the features of the multiple different scales to obtain a fused feature, and performs attack detection on the request text to be detected based on the fused feature to determine whether the request text to be detected is an attack request text.
[0107] It should be understood that steps 601 to 603 are the process of actually using the attack detection model, and the specific implementation methods in the steps belong to the same inventive concept as steps 201 to 203, which will not be repeated here.
[0108] In one possible implementation, the method 600 also includes: when the request text to be detected is an attack request text, the electronic device determines a first response message to the request text to be detected; the electronic device determines, based on the first response message and a reference response message of the attack request text, that the request text to be detected successfully attacks a response device, the reference response message being a message obtained when the attack request text successfully attacks the response device, and the response device being a device that generates the first response message.
[0109] It should be understood that only when the request text to be detected is an attack request text, the request text to be detected is likely to successfully attack the response device. In this regard, when the request text to be detected is an attack request text, the request text to be detected can be further detected, so that after detecting that the request text to be detected successfully attacks the response device, the electronic device can store the address of the access device of the request text to be detected, so that when the access device subsequently accesses the response device again, the server will not respond to the request text of the access device, etc.
[0110] In the above technical solution, based on the above explanation or description, when the request text to be detected is an attack request text, the request text to be detected can be further processed. Specifically, the first response message of the request text to be detected is determined, and the request text to be detected is detected to see whether the attack is successful based on the reference response message of the attack request text that successfully attacks the response device.
[0111] It should also be understood that since the reference response message of the attack request text is an attack request text that has been verified to successfully attack the response device, the reference response message can be used to detect a successful attack on the request text to be detected. Specifically, the process of using the reference response message to detect a successful attack on the request text to be detected is as follows.
[0112] In one possible implementation, the electronic device determines that the request text to be detected successfully attacks the response device based on the first response message and the reference response message of the attack request text, including at least one of the following: when using a regular expression to search the first response message for multiple fields in a specified format, the electronic device determines that the request text to be detected successfully attacks the response device, and the multiple fields in the specified format are obtained from the reference response message; the electronic device extracts the attack semantic vector of the reference response message and the first semantic vector of the first response message; the electronic device determines the similarity between the first semantic vector and the attack semantic vector; when the similarity is greater than a preset similarity, the electronic device determines that the request text to be detected successfully attacks the response device.
[0113] Optionally, the similarity in the above technical solution is cosine similarity or Euclidean distance.
[0114] In the above technical solution, the above two methods are used to determine whether the request text to be detected successfully attacks the response device. Specifically, when the format of the request text to be detected is relatively simple, a regular expression is used to search for multiple fields in a specified format contained in the first response message of the request text to be detected (the multiple fields in the specified format are obtained from the reference response message) to determine whether the request text to be detected successfully attacks the response device; when the format of the request text to be detected is relatively complex, the similarity between the attack semantic vector of the reference response message and the first semantic vector of the first response message is used, and when the similarity is greater than a preset similarity, it is determined that the request text to be detected successfully attacks the response device.
[0115] It should be understood that the "regular expression" in the above technical solution can be understood as using a single string to describe and match a series of strings that match a certain syntactic rule, and is usually used to retrieve and replace some texts that conform to a certain pattern (rule). Since the response message (reference response message) that successfully attacks the response device conforms to certain rules (has a specified format), a regular expression can be used to search whether the first response message of the request text to be detected contains multiple fields in a specified format. In the case where the first response message contains multiple fields in a specified format, it is determined that the request text to be detected successfully attacks the response device.
[0116] In a possible implementation, the electronic device extracts the attack semantic vector of the reference response message and the first semantic vector of the first response message, including: the electronic device extracts the attack semantic vector of the reference response message and the first semantic vector of the first response message through a semantic model.
[0117] Among them, the semantic model can be regarded as a Sentence-Transformer model, which converts texts of different lengths (reference response messages or first response messages) into embedded vectors of fixed length; the semantic model can also be regarded as an Embedding model.
[0118] Figure 7 It is a structural diagram of a device for processing request text provided in an embodiment of the present application.
[0119] For example, Figure 7 As shown, the device 700 includes:
[0120] An acquisition module 701 is used to acquire a target request text from a sample request data set, where the sample request data set includes an attack request text and a non-attack request text, where the attack request text is obtained by performing data enhancement on the command attack text and the non-attack request text;
[0121] The processing module 702 is used to:
[0122] The target request text is input into an attack detection model, and the attack detection model performs multi-scale feature extraction based on the target request text to obtain features of multiple scales; the features of the multiple scales are fused to obtain fused features, and a detection result of the target request text is determined based on the fused features; the attack detection model is trained based on a loss value between the detection result and a labeling result of the target request text, and the labeling result is used to indicate whether the target request text is an attack request text.
[0123] Optionally, the device 700 further includes: a data enhancement module, configured to: perform data enhancement on the command attack text to obtain a command attack enhanced text; and perform data enhancement on the non-attack request text based on the command attack enhanced text to obtain the attack request text.
[0124] Optionally, the data enhancement module is specifically used for at least one of the following: adding a first command field to the command attack text to obtain the command attack enhanced text; updating the parameters of at least one command field in the command attack text to obtain the command attack enhanced text; deleting the second command field in the command attack text to obtain the command attack enhanced text.
[0125] Optionally, the data enhancement module is also specifically used for at least one of the following: nesting the command field in the command attack enhancement text in the non-attack request text to obtain the attack request text; replacing the request text in the non-attack request text with the command field in the command attack enhancement text to obtain the attack request text.
[0126] Figure 8It is a structural diagram of a device for processing request text provided in an embodiment of the present application.
[0127] For example, Figure 8 As shown, the device 800 includes:
[0128] An input module 801 is used to input a request text to be detected into an attack detection model, where the attack detection model is trained by a target request text in a sample request data set, where the sample request data set includes an attack request text and a non-attack request text, where the attack request text is obtained by performing data enhancement on a command attack text and the non-attack request text;
[0129] An extraction module 802 is used to perform multi-scale feature extraction on the request text to be detected by the attack detection model to obtain features of multiple different scales;
[0130] The detection module 803 is used to perform feature fusion on the features of the multiple different scales by the attack detection model to obtain a fusion feature, and perform attack detection on the request text to be detected based on the fusion feature to determine whether the request text to be detected is an attack request text.
[0131] Optionally, the device 800 also includes: a determination module, used to: when the request text to be detected is an attack request text, determine a first response message to the request text to be detected; based on the first response message and a reference response message of the attack request text, determine that the request text to be detected successfully attacks a response device, the reference response message is a message obtained by the attack request text successfully attacking the response device, and the response device is a device that generates the first response message.
[0132] Optionally, the determination module is specifically used for at least one of the following: determining that the request text to be detected successfully attacks the response device when searching the first response message for multiple fields in a specified format using a regular expression, and the multiple fields in the specified format are obtained from the reference response message; extracting the attack semantic vector of the reference response message and the first semantic vector of the first response message; determining the similarity between the first semantic vector and the attack semantic vector; and determining that the request text to be detected successfully attacks the response device when the similarity is greater than a preset similarity.
[0133] Fig. 9 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0134] For example, Fig. 9As shown, the electronic device 900 includes: a memory 901, a processor 902, and a computer program 903 stored in the memory 901 and running on the processor 902, wherein when the processor 902 executes the computer program 903, the electronic device can execute any one of the methods for processing request texts introduced above.
[0135] In this embodiment, the electronic device can be divided into functional modules according to the above method example. For example, each functional module can be corresponded to, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0136] In the case of dividing each functional module according to each function, the electronic device may include: an acquisition module, a processing module, an input module, an extraction module, a detection module, a data enhancement module, and a determination module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0137] The electronic device provided in this embodiment is used to execute the above-mentioned method for processing a request text, and thus can achieve the same effect as the above-mentioned implementation method.
[0138] In the case of an integrated unit, the electronic device may include a processing module and a storage module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used for the electronic device to execute mutual program codes and data.
[0139] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits disclosed in the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.
[0140] This embodiment provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a computer or a processor, the computer or the processor executes any one of the aforementioned methods for processing a request text.
[0141] This embodiment also provides a computer program product including instructions. When the computer program product is executed on a computer or a processor, the computer or the processor executes the above-mentioned related steps to implement any one of the methods for processing a request text described above.
[0142] Among them, the electronic device, computer-readable storage medium, computer program product or chip containing instructions provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0143] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0144] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0145] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for processing a request text, characterized in that: The method comprises: Acquire a target request text from a sample request data set, wherein the sample request data set includes an attack request text and a non-attack request text, wherein the attack request text is obtained by performing data enhancement on the command attack text and the non-attack request text; Inputting the target request text into an attack detection model, the attack detection model extracts multi-scale features based on the target request text to obtain features of multiple different scales; fusing the features of the multiple different scales to obtain fused features, and determining a detection result of the target request text based on the fused features; The attack detection model is trained based on a loss value between the detection result and a labeling result of the target request text, wherein the labeling result is used to indicate whether the target request text is an attack request text.
2. The method according to claim 1, characterized in that The method for performing data enhancement on the command attack text and the non-attack request text comprises: Performing data enhancement on the command attack text to obtain a command attack enhanced text; The non-attack request text is data enhanced based on the command attack enhancement text to obtain the attack request text.
3. The method according to claim 2, characterized in that The step of performing data enhancement on the command attack text to obtain the command attack enhanced text includes at least one of the following: Adding a first command field to the command attack text to obtain the command attack enhanced text; Updating the parameters of at least one command field in the command attack text to obtain the command attack enhanced text; The second command field is deleted from the command attack text to obtain the command attack enhanced text.
4. The method according to claim 2, characterized in that: The step of performing data enhancement on the non-attack request text based on the command attack enhancement text to obtain the attack request text includes at least one of the following: The command field in the command attack enhancement text is embedded in the non-attack request text to obtain the attack request text; The request text in the non-attack request text is replaced with the command field in the command attack enhancement text to obtain the attack request text.
5. A method for processing a request text, characterized in that: The method comprises: Inputting the request text to be detected into an attack detection model, wherein the attack detection model is trained by the target request text in the sample request data set, wherein the sample request data set includes the attack request text and the non-attack request text, wherein the attack request text is obtained by performing data enhancement on the command attack text and the non-attack request text; The attack detection model performs multi-scale feature extraction on the request text to be detected to obtain features of multiple different scales; The attack detection model performs feature fusion on the features of the multiple different scales to obtain a fusion feature, and performs attack detection on the request text to be detected based on the fusion feature to determine whether the request text to be detected is an attack request text.
6. The method according to claim 5, characterized in that The method further comprises: In a case where the request text to be detected is an attack request text, determining a first response message to the request text to be detected; Based on the first response message and the reference response message of the attack request text, it is determined that the request text to be detected successfully attacks the response device, the reference response message is the message obtained when the attack request text successfully attacks the response device, and the response device is the device that generates the first response message.
7. The method according to any one of claim 6, characterized in that The step of determining, based on the first response message and the reference response message of the attack request text, that the request text to be detected successfully attacks the response device comprises at least one of the following: In the case of searching the first response message for a plurality of fields in a specified format using a regular expression, determining that the request text to be detected successfully attacks the response device, the plurality of fields in the specified format being obtained from the reference response message; Extracting the attack semantic vector of the reference response message and the first semantic vector of the first response message; determining the similarity between the first semantic vector and the attack semantic vector; and determining that the request text to be detected successfully attacks the response device when the similarity is greater than a preset similarity.
8. A device for processing a request text, characterized in that: The device comprises: An acquisition module, used to acquire a target request text from a sample request data set, wherein the sample request data set includes an attack request text and a non-attack request text, wherein the attack request text is obtained by performing data enhancement on the command attack text and the non-attack request text; Processing modules for: Inputting the target request text into an attack detection model, the attack detection model extracts multi-scale features based on the target request text to obtain features of multiple different scales; fusing the features of the multiple different scales to obtain fused features, and determining a detection result of the target request text based on the fused features; The attack detection model is trained based on a loss value between the detection result and a labeling result of the target request text, wherein the labeling result is used to indicate whether the target request text is an attack request text.
9. A device for processing a request text, characterized in that: The device comprises: An input module, used for inputting a request text to be detected into an attack detection model, wherein the attack detection model is trained by a target request text in a sample request data set, wherein the sample request data set includes an attack request text and a non-attack request text, wherein the attack request text is obtained by performing data enhancement on a command attack text and the non-attack request text; An extraction module, configured to perform multi-scale feature extraction on the request text to be detected by the attack detection model to obtain features of multiple different scales; The detection module is used to obtain a fusion feature by fusing the features of the multiple different scales through the attack detection model, and perform attack detection on the request text to be detected based on the fusion feature to determine whether the request text to be detected is an attack request text.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the method for processing a request text as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Network intrusion detection method and device
CN106656981A
Text backdoor attack method and system
CN113779986A
Attack behavior detection method and device
CN113965377A
Network attack result detection method and device, computing equipment and storage medium
CN114338202A
Malicious request detection model training method, malicious request identification method and equipment
CN115499222A
