Malicious request detection model training method, malicious request identification method and device

By annotating malicious requests in web applications and training neural network models, a malicious request detection model is generated, which solves the problem that the existing technology cannot recognize variant attacks or new attacks, and achieves high-accuracy malicious request recognition and multi-scenario application sex.

CN115499222BActive Publication Date: 2024-11-22AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211144655.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-20
Publication Date
2024-11-22
Estimated Expiration
2042-09-20

AI Technical Summary

Technical Problem

The existing technology is difficult to identify variant attacks or new attacks, and it is impossible to effectively identify malicious requests in web applications, resulting in threats to user information security.

Method used

By obtaining malicious sample requests and non-malicious sample requests, annotating the request paths and parameters, generating the annotated sample requests, and using the neural network model for training, obtaining the malicious request detection model, which can identify variant attacks or new attacks.

Benefits of technology

It realizes effective identification of variant attacks or new attacks, improves identification accuracy, saves labor costs, and is suitable for a variety of application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115499222B_ABST
    Figure CN115499222B_ABST
Patent Text Reader

Abstract

The present application provides a training method for a malicious request detection model, a malicious request identification method and a device. In the training method for the malicious request detection model, the electronic device obtains malicious sample requests and non-malicious sample requests, annotates the request path and request parameters in the malicious sample requests, generates annotated malicious sample requests, and trains a neural network model through the annotated malicious sample requests and non-malicious sample requests to obtain a malicious request detection model. In this technical solution, the trained malicious request detection model has analysis and learning capabilities, can effectively identify variant attacks or new attacks, and improves the accuracy of identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and in particular to a training method for a malicious request detection model, a malicious request identification method and a device. Background Art

[0002] In recent years, with the popularity of World Wide Web (Web) applications, Web security issues have become increasingly serious. Since Web application attacks may come from any online user, even a verified user, Web application attacks are difficult to detect, which seriously threatens the information security of users.

[0003] At present, in order to deal with Web security issues, a blacklist rule library is mainly established in advance based on known attack features. After receiving a request, the request is matched with the known attack features in the blacklist rule library. If the match is successful, the request is considered to be a malicious request. Otherwise, if the match is unsuccessful, the request is considered to be a non-malicious request, thereby achieving the purpose of identifying malicious requests.

[0004] However, existing technologies can only identify existing Web application attacks, but cannot identify variant attacks or new attacks. Summary of the invention

[0005] The present application provides a training method for a malicious request detection model, a malicious request identification method and a device to solve the problem that the prior art can only identify existing Web application attacks but cannot identify variant attacks or new attacks.

[0006] In a first aspect, an embodiment of the present application provides a method for training a malicious request detection model, including:

[0007] Obtain malicious sample requests and non-malicious sample requests;

[0008] Annotating the request path and request parameters in the malicious sample request to generate an annotated malicious sample request;

[0009] The neural network model is trained by using the annotated malicious sample requests and the non-malicious sample requests to obtain a malicious request detection model.

[0010] In a possible design of the first aspect, the request parameter includes at least one of the following sub-parameters:

[0011] The type of the malicious sample request, the character length of the malicious sample request, the character length of the ciphertext string, the ratio of the character length of the ciphertext string to the malicious sample request, the number of first preset characters in the parameter value, the ratio of the first preset character to the total number of characters in the parameter value, the number of preset character strings, the ratio of the preset character string to the total number of character strings in the malicious sample request, and access resource information.

[0012] In another possible design of the first aspect, annotating the request path and request parameters in the malicious sample request to generate the annotated malicious sample request includes:

[0013] Decoding the request path in the malicious sample request, and converting the uppercase characters of the string obtained after decoding into lowercase characters, to generate a first malicious sample request;

[0014] Segmenting each sub-parameter in the first malicious sample request by using a second preset character, and connecting the segmented sub-parameters by using a third character to generate a second malicious sample request;

[0015] Annotate the processed request path and the sub-parameters in the second malicious sample request to generate the annotated malicious sample request.

[0016] In a second aspect, an embodiment of the present application provides a method for identifying malicious requests, including:

[0017] Get the request to be identified;

[0018] The request to be identified is input into a malicious request detection model to obtain a detection result, wherein the malicious request detection model is trained using the method described in any one of the first aspects, and the detection result is used to indicate whether the request to be identified is a malicious request.

[0019] In a possible design of the second aspect, the method further includes:

[0020] If the detection result indicates that the request to be identified is a malicious request, the request to be identified is intercepted, a corresponding error log is generated, and an error message is returned to the terminal device that sent the request to be identified, where the error message is used to indicate that the request to be identified has not been successfully sent to the corresponding server;

[0021] If the detection result indicates that the request to be identified is a non-malicious request, the request to be identified is forwarded to the corresponding server.

[0022] Optionally, inputting the request to be identified into a malicious request detection model to obtain a detection result includes:

[0023] Determining whether the terminal device has the authority to interact with the server;

[0024] If yes, then determine the type of the request to be identified;

[0025] If the type of the request to be identified is a GET request type, inputting the request header of the request to be identified into the malicious request detection model to obtain the detection result;

[0026] If the type of the request to be identified is a POST request type, the request header and request body of the request to be identified are input into the malicious request detection model to obtain the detection result.

[0027] In a third aspect, an embodiment of the present application provides a training device for a malicious request detection model, including:

[0028] An acquisition module, used to acquire malicious sample requests and non-malicious sample requests;

[0029] A processing module, used to annotate the request path and request parameters in the malicious sample request to generate an annotated malicious sample request;

[0030] The training module is used to train the neural network model through the annotated malicious sample requests and the non-malicious sample requests to obtain a malicious request detection model.

[0031] In a possible design of the third aspect, the request parameter includes at least one of the following sub-parameters:

[0032] The type of the malicious sample request, the character length of the malicious sample request, the character length of the ciphertext string, the ratio of the character length of the ciphertext string to the malicious sample request, the number of first preset characters in the parameter value, the ratio of the first preset character to the total number of characters in the parameter value, the number of preset character strings, the ratio of the preset character string to the total number of character strings in the malicious sample request, and access resource information.

[0033] In another possible design of the third aspect, the processing module is specifically configured to:

[0034] Decoding the request path in the malicious sample request, and converting the uppercase characters of the string obtained after decoding into lowercase characters, to generate a first malicious sample request;

[0035] Segmenting each sub-parameter in the first malicious sample request by using a second preset character, and connecting the segmented sub-parameters by using a third character to generate a second malicious sample request;

[0036] Annotate the processed request path and the sub-parameters in the second malicious sample request to generate the annotated malicious sample request.

[0037] In a fourth aspect, an embodiment of the present application provides a malicious request identification device, including:

[0038] An acquisition module, used for acquiring a request to be identified;

[0039] An input module is used to input the request to be identified into a malicious request detection model to obtain a detection result, wherein the malicious request detection model is trained using the method described in any one of the first aspects, and the detection result is used to indicate whether the request to be identified is a malicious request.

[0040] In a possible design of the fourth aspect, the device further includes:

[0041] a sending module, configured to intercept the request to be identified, generate a corresponding error log, and return an error message to the terminal device that sent the request to be identified, if the detection result indicates that the request to be identified is a malicious request, wherein the error message is used to indicate that the request to be identified has not been successfully sent to the corresponding server;

[0042] The sending module is further configured to forward the request to be identified to the corresponding server if the detection result indicates that the request to be identified is a non-malicious request.

[0043] Optionally, the input module is specifically used for:

[0044] Determining whether the terminal device has the authority to interact with the server;

[0045] If yes, then determine the type of the request to be identified;

[0046] If the type of the request to be identified is a GET request type, inputting the request header of the request to be identified into the malicious request detection model to obtain the detection result;

[0047] If the type of the request to be identified is a POST request type, the request header and request body of the request to be identified are input into the malicious request detection model to obtain the detection result.

[0048] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the first aspect and the methods provided by various possible designs when executing the computer program instructions.

[0049] In a sixth aspect, an embodiment of the present application may provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the first aspect and the methods provided by various possible designs.

[0050] The training method, malicious request identification method and device of the malicious request detection model provided in the embodiment of the present application, in the training method of the malicious request detection model, the electronic device obtains malicious sample requests and non-malicious sample requests, annotates the request path and request parameters in the malicious sample requests, generates annotated malicious sample requests, and trains the neural network model through the annotated malicious sample requests and non-malicious sample requests to obtain a malicious request detection model. In this technical solution, the trained malicious request detection model has analytical and learning capabilities, can effectively identify variant attacks or new attacks, and improves the accuracy of identification. At the same time, this technical solution does not require manual intervention, saves labor costs, can be applied to a variety of application scenarios, and has high applicability. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0052] Figure 1 A schematic diagram of a network architecture applicable to a training method for a malicious request detection model and a malicious request identification method provided in an embodiment of the present application;

[0053] Figure 2 A flowchart of a first embodiment of a method for training a malicious request detection model provided in an embodiment of the present application;

[0054] Figure 3 A flowchart of a second embodiment of a method for training a malicious request detection model provided in an embodiment of the present application;

[0055] Figure 4 A flowchart of a third embodiment of a method for training a malicious request detection model provided in an embodiment of the present application;

[0056] Figure 5 A flowchart of a first embodiment of a method for identifying malicious requests provided in an embodiment of the present application;

[0057] Figure 6 A flowchart of a second embodiment of a method for identifying malicious requests provided in an embodiment of the present application;

[0058] Figure 7 A flowchart of a third embodiment of a method for identifying malicious requests provided in an embodiment of the present application;

[0059] Figure 8 A flowchart of a fourth embodiment of a method for identifying malicious requests provided in an embodiment of the present application;

[0060] Fig. 9 A schematic diagram of the structure of a training device for a malicious request detection model provided in an embodiment of the present application;

[0061] Fig.10 A schematic diagram of the structure of a malicious request identification method and device provided in an embodiment of the present application;

[0062] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0063] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0065] Before introducing the embodiments of the present application, the terms involved in the embodiments of the present application are first explained:

[0066] Deep learning: Using the inherent rules and representation levels of learning sample data, the machine can have the same analytical and learning capabilities as humans. The learning sample data refers to the malicious sample requests and non-malicious sample requests in this application.

[0067] Attack: In information security technology, the planned act of eavesdropping, stealing, or destroying information or denying access to other authorized users.

[0068] Web application: An application that can be accessed through a browser. Users only need to install the browser and no other software is required.

[0069] Packet filtering: Use routers or other hardware devices to monitor and filter Internet Protocol (IP) packets flowing in and out of the network, and refuse to send suspicious packets.

[0070] Malicious requests: Requests that threaten the security of data or services, including obtaining sensitive data on the server, cross-site scripting (XSS) attacks, structured query language (SQL) injections, cross-site request forgery, etc.

[0071] Next, the application background of this application is introduced:

[0072] With the rapid development of information technology in modern society, information security technology has become one of the most important technologies in the field of data analysis. However, attackers' attack methods and techniques are becoming increasingly complex, making business systems face huge security challenges. In this case, how to effectively identify malicious Web requests has become an urgent problem to be solved.

[0073] Currently, malicious requests are mainly identified through the following methods:

[0074] (1) Detection method based on blacklist rule base: By manually summarizing the features of known attacks, a blacklist rule base is established. After receiving a request, the request is matched with the known attack features in the blacklist rule base. If the match is successful, the request is considered to be a malicious request. Otherwise, if the match is unsuccessful, the request is considered to be a non-malicious request. However, the development and maintenance of the blacklist rule base is difficult, and the rule writers need to have strong attack feature summary capabilities. At the same time, it is a lagging defense technology that can only identify existing Web application attacks, but cannot identify variant attacks or new attacks. It is even more impossible to take effective measures before or during an attack. It can only remedy the damage caused after the attack, and is powerless against unknown threats.

[0075] (2) Security policy-based detection method: only regular requests are allowed and all fuzzy requests are prohibited. Regular requests can be pre-configured by relevant staff. However, this method is prone to misjudging non-malicious requests in fuzzy requests as malicious requests; in addition, if the Web application is updated, the security policy also needs to be updated synchronously, so it is not suitable for application scenarios with high update frequency.

[0076] (3) Packet filtering detection method: Filter and restrict the Transmission Control Protocol (TCP) / IP packets at the network layer to filter out non-malicious requests. However, this method has complex implementation steps and is prone to network congestion and slow response in high-concurrency situations.

[0077] Based on the above problems, the present application proposes a training method for a malicious request detection model and a malicious request identification method, which can use malicious sample requests and non-malicious sample requests as training sets to train a neural network model, thereby obtaining a malicious request detection model. In this way, in actual application, the malicious request detection model can be used to identify whether the request sent by the terminal device is a malicious request. Since the malicious request detection model has analytical and learning capabilities, it can effectively identify variant attacks or new attacks, while saving labor costs, improving recognition accuracy and processing efficiency, and has high adaptability to application scenarios.

[0078] For example, the training method of the malicious request detection model and the malicious request identification method provided in the embodiments of the present application can be applied to Figure 1 The network structure diagram shown. Figure 1 A schematic diagram of a network architecture applicable to the training method of the malicious request detection model and the malicious request identification method provided in the embodiment of the present application. Figure 1 As shown, the network structure may include: a terminal device 11, an electronic device 12, and a server 13. Optionally, the network structure may also include a sample request database 14, in which a plurality of malicious sample requests and a plurality of non-malicious sample requests are stored, and the electronic device 12 is respectively connected to the terminal device 11, the server 13, and the sample request database 14 in a wireless communication manner.

[0079] For example, refer to Figure 1 As shown, the electronic device 12 can obtain malicious sample requests and non-malicious sample requests from the sample request database 14, and train the pre-stored neural network model according to the obtained malicious sample requests and non-malicious sample requests, thereby generating a malicious request detection model. Further, the electronic device 12 can also obtain a request sent by the terminal device 11 for data interaction with the server 13, and input the request into the malicious request detection model for identification, thereby obtaining a detection result indicating whether the request is a malicious request.

[0080] It should be noted that the attached Figure 1 This is only a schematic diagram of a network structure provided in the embodiment of the present application. Figure 1 does not limit the equipment included in Figure 1 The positional relationship between the devices in the Figure 1 In the embodiment, the sample request database 14 can be an external database relative to the electronic device 12. In other cases, the sample request database 14 can also be placed in the electronic device 12.

[0081] It is understandable that the execution subject of the embodiment of the present application can be a terminal device, such as a computer, a tablet computer, etc., or a server, such as a background processing platform, etc. Therefore, the present embodiment is explained by collectively referring to the terminal device and the server as an electronic device, and whether the electronic device is specifically a terminal device or a server can be determined according to actual conditions.

[0082] In an embodiment of the present application, the electronic device 12 may include a model generation module 121 and an attack detection module 122. The model generation module 121 includes a data flow parser 1211, a data flow processing annotator 1212, and a deep learning trainer 1213; the attack detection module 122 includes a data flow parser 1221 and an attack detector 1222.

[0083] The data stream parser 1211 may be used to obtain malicious sample requests and non-malicious sample requests.

[0084] The data stream processing annotator 1212 may be used to annotate the request path and request parameters in the malicious sample request to generate an annotated malicious sample request.

[0085] The deep learning trainer 1213 can be used to train the neural network model through the annotated malicious sample requests and non-malicious sample requests to obtain a malicious request detection model.

[0086] The data stream parser 1221 may be used to obtain a request to be identified.

[0087] The attack detector 1222 can be used to input the request to be identified into the malicious request detection model to obtain the detection result.

[0088] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0089] It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0090] Figure 2 The flowchart of the first embodiment of the training method of the malicious request detection model provided in the embodiment of the present application is as follows. Figure 2 As shown, the training method of the malicious request detection model may include the following steps:

[0091] S201. Obtain malicious sample requests and non-malicious sample requests.

[0092] Among them, the non-malicious sample request is a request transmitted during the normal data interaction between the terminal device and the server, and the malicious sample request and the non-malicious sample request can be requests sent by the attacker to the electronic device through the terminal device at a historical moment.

[0093] Optionally, the malicious sample request and the non-malicious sample request may be HTTP requests.

[0094] Optionally, malicious sample requests and non-malicious sample requests can be stored together in a sample request database; malicious sample requests and non-malicious sample requests can also exist in two different databases respectively, such as malicious sample requests are stored in a first database, and non-malicious sample requests are stored in a second database; malicious sample requests can also be partially stored in the first database and partially stored in the second database. Similarly, non-malicious sample requests can also be partially stored in the first database and partially stored in the second database. The electronic device can obtain malicious sample requests and non-malicious sample requests from the sample request database, and can also obtain malicious sample requests and non-malicious sample requests from the first database and the second database respectively. The present application does not specifically limit the acquisition path and method of malicious sample requests and non-malicious sample requests, which can be determined according to actual conditions.

[0095] Optionally, the number of malicious sample requests can be one or more, and the number of non-malicious sample requests can be one or more, which can be determined based on actual conditions. This application does not specifically limit the number of malicious sample requests and non-malicious sample requests.

[0096] S202: Annotate the request path and request parameters in the malicious sample request to generate an annotated malicious sample request.

[0097] Since the request parameters are diverse and semantically rich, it is not appropriate to directly use malicious sample requests for subsequent model training. Therefore, it is necessary to express the key information in the malicious sample requests in an appropriate way. Since the components of HTTP requests are relatively fixed and each part has good structural characteristics, the request path and request parameters can be annotated according to the structural characteristics of each part to facilitate the subsequent training of the neural network model.

[0098] Optionally, in order to avoid the sub-parameter dimension of the request parameter being too high, the sub-parameter of the request parameter may be set in advance, wherein the request parameter may include at least one of the following sub-parameters:

[0099] The type of malicious sample request, the character length of the malicious sample request, the character length of the ciphertext string, the ratio of the character length of the ciphertext string to the malicious sample request, the number of the first preset characters in the parameter value, the ratio of the first preset character to the total number of characters in the parameter value, the number of preset character strings, the ratio of the preset character strings to the total number of character strings in the malicious sample request, and access resource information.

[0100] Optionally, the request parameter includes at least one sub-parameter, and each sub-parameter in the request parameter may be first divided and then annotated.

[0101] Exemplarily, the first preset character may be “'”, “$”, “#”, etc., which may be preset according to actual needs, and the embodiments of the present application do not impose specific limitations on this.

[0102] Exemplarily, the preset character string may be "drop", "alert", "script", etc., which may be preset according to actual needs, and the embodiments of the present application do not impose specific limitations on this.

[0103] It should be understood that the first preset character and the preset character string are both related to malicious requests, that is, in actual applications, malicious requests usually contain the first preset character and the preset character string.

[0104] S203: Train the neural network model through the annotated malicious sample requests and non-malicious sample requests to obtain a malicious request detection model.

[0105] In the embodiment of the present application, the annotated malicious sample requests and non-malicious sample requests are the training set, and the neural network model is trained by the above training set so that the obtained malicious request detection model has the ability to identify malicious requests.

[0106] Optionally, the neural network model may be pre-stored in an electronic device by relevant staff, or may be obtained from a network or other database storing the neural network model. This application does not specifically limit the method for obtaining the neural network model.

[0107] The training method of the malicious request detection model provided in the embodiment of the present application is that the electronic device obtains malicious sample requests and non-malicious sample requests, annotates the request path and request parameters in the malicious sample requests, generates annotated malicious sample requests, and trains the neural network model through the annotated malicious sample requests and non-malicious sample requests to obtain a malicious request detection model. In this technical solution, the trained malicious request detection model has analytical and learning capabilities, can effectively identify variant attacks or new attacks, and improves the accuracy of identification. At the same time, this technical solution does not require manual intervention, saves labor costs, can be applied to a variety of application scenarios, and has high applicability.

[0108] Optionally, in some embodiments, before training the neural network model with the annotated malicious sample requests and non-malicious sample requests, the annotated malicious sample requests and non-malicious sample requests can also be converted into an expression that can be understood by the electronic device, for example, converted into binary, and then the neural network model is trained with the converted training set.

[0109] Optionally, in some embodiments, S201 can be implemented through the following steps: obtaining an initial malicious sample request and an initial non-malicious sample request, formatting the initial malicious sample request and the initial non-malicious sample request, retaining only the request path and request parameter parts in the initial malicious sample request and the initial non-malicious sample request, and deleting other redundant data, thereby obtaining malicious sample requests and non-malicious sample requests, thereby improving subsequent training efficiency.

[0110] Optional, Figure 3 The flowchart of the second embodiment of the training method of the malicious request detection model provided in the embodiment of the present application is as follows. Figure 3 As shown, combined Figure 2 In the embodiment shown, S202 can be implemented by the following steps:

[0111] S301. Decode the request path in the malicious sample request, and convert the uppercase characters of the string obtained after decoding into lowercase characters to generate a first malicious sample request.

[0112] For example, assuming that the string obtained after decoding the request path in the malicious sample request is: http: / / localhost:ABCD / 123ABcd, then the string obtained after converting its uppercase characters to lowercase is http: / / localhost:abcd / 123abcd.

[0113] S302: Segment each sub-parameter in the first malicious sample request by using a second preset character, and connect the segmented sub-parameters by using a third character to generate a second malicious sample request.

[0114] Exemplarily, the third character may be a space or other special characters, and may be pre-configured according to actual needs. The embodiments of the present application do not impose any specific restrictions on this.

[0115] S303: Annotate the processed request path and each sub-parameter in the second malicious sample request to generate an annotated malicious sample request.

[0116] In the above embodiment, since the attack payload of the malicious request is a command sequence with a certain structure composed of special symbols and attack keywords, by annotating each sub-parameter, the malicious request detection model can better pay attention to the first preset character and the preset character string equal to the sensitive characters related to the malicious request, thereby improving the recognition efficiency and accuracy.

[0117] In combination with the training method of the malicious request detection model in each of the above embodiments, the method is illustrated below by using a specific example.

[0118] Figure 4 The flowchart of the third embodiment of the training method of the malicious request detection model provided in the embodiment of the present application is as follows. Figure 4 As shown, the training method of the malicious request detection model may include the following steps:

[0119] The electronic device can obtain an initial malicious sample request and an initial non-malicious sample request, and format the initial malicious sample request and the initial non-malicious sample request through the data stream parser 1211 to obtain the malicious sample request and the non-malicious sample request. Afterwards, the request path and request parameters in the malicious sample request are annotated through the data stream processing annotator 1212 to generate an annotated malicious sample request. Finally, the neural network model is trained according to the annotated malicious sample request and the non-malicious sample request through the deep learning trainer 1213 to obtain a malicious request detection model.

[0120] After obtaining the above malicious request detection model, the malicious request detection model can be used to identify the request to be identified sent by the terminal device. The following is a detailed description of the method of using the malicious request detection model to identify the request to be identified in conjunction with a specific embodiment. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0121] In specific implementation, the execution subject of the malicious request identification method can also be an electronic device with processing capabilities such as a terminal or a server. It should be understood that the electronic device that executes the malicious request identification method and the electronic device that executes the training method of the malicious request detection model can be the same device or different devices.

[0122] Figure 5 The flowchart of the first embodiment of the malicious request identification method provided in the present application is as follows. Figure 5 As shown, the malicious request identification method may include the following steps:

[0123] S501: Obtain a request to be identified.

[0124] In the embodiment of the present application, the request to be identified is a request sent by the terminal device to the server for data interaction with the server. The electronic device can obtain the request before the request reaches the server and identify whether the request is a malicious request to protect the data security of the server.

[0125] Optionally, the request to be identified may be an HTTP request.

[0126] Optionally, the number of requests to be identified in this step may be one or more. When the number of requests to be identified is multiple, the multiple requests to be identified may be used for data interaction between the same terminal device and the same server, may be used for data interaction between the same terminal device and different servers, may be used for data interaction between different terminal devices and the same server, or may be used for data interaction between different terminal devices and different servers. This application does not impose any specific restrictions on this.

[0127] Optionally, the electronic device may also obtain an initial request to be identified, format the initial request to be identified, retain only the request path and request parameter portion of the initial request to be identified, and delete other redundant data, thereby obtaining the request to be identified.

[0128] S502: Input the request to be identified into a malicious request detection model to obtain a detection result.

[0129] The malicious request detection model is trained by using the method of the above embodiment, and the detection result is used to indicate whether the request to be identified is a malicious request.

[0130] Exemplarily, the detection result may be “the request to be identified is a malicious request” or “the request to be identified is a non-malicious request”.

[0131] In the malicious request identification method provided in the embodiment of the present application, an electronic device obtains a request to be identified, and inputs the request to be identified into a malicious request detection model, thereby obtaining a detection result. In this technical solution, before the request to be identified is sent to the server, the request is identified by the malicious request detection model, which effectively ensures the data security of the server. At the same time, the malicious request detection model has analytical and learning capabilities, which can effectively identify variant attacks or new attacks, and improve the accuracy of identification. At the same time, this technical solution does not require manual intervention, saves labor costs, can be applied to a variety of application scenarios, and has high applicability.

[0132] Optionally, in some embodiments, the malicious request identification method may further include the following steps:

[0133] If the detection result indicates that the request to be identified is a malicious request, the request to be identified is intercepted, a corresponding error log is generated, and an error message is returned to the terminal device that sent the request to be identified. If the detection result indicates that the request to be identified is a non-malicious request, the request to be identified is forwarded to the corresponding server.

[0134] The error message is used to indicate that the request to be identified has not been successfully sent to the corresponding server.

[0135] In the above embodiment, the request to be identified is processed differently according to the different contents indicated by the detection result, thereby ensuring the subsequent normal processing of non-malicious requests. When it is detected that the request to be identified is a malicious request, an error message is returned to the terminal device that sent the request to be identified, so that the relevant staff can repair the request in time if the request to be identified is misjudged.

[0136] Optionally, in some embodiments, combined with Figure 5 In the embodiment shown, S502 may be implemented by the following steps:

[0137] Determine whether the terminal device has the authority to interact with the server. If so, determine the type of the request to be identified. If the type of the request to be identified is a get (English: GET) request type, input the request header of the request to be identified into the malicious request detection model to obtain the detection result. If the type of the request to be identified is a send (English: POST) request type, input the request header and request body of the request to be identified into the malicious request detection model to obtain the detection result.

[0138] In the above embodiment, before identifying the request to be identified, by judging whether the terminal device has the authority to exchange information with the server, the data security of the server is effectively guaranteed. When the terminal device does not have the authority, no subsequent identification operation is performed, which reduces redundant operations and improves the identification efficiency. At the same time, according to the type of the request to be identified, different parts of the data are extracted and input into the malicious request detection model for identification processing, which reduces the processing of redundant data by the malicious request detection model, thereby improving the efficiency of the identification processing.

[0139] In combination with the training method of the malicious request identification method in each of the above embodiments, the method is illustrated below through three specific examples.

[0140] Example 1, Figure 6 The flowchart of the second embodiment of the malicious request identification method provided in the embodiment of the present application is as follows. Figure 6 As shown, the malicious request identification method may also include the following steps:

[0141] The electronic device obtains the initial request to be identified, formats the initial request to be identified through the data stream parser 1221, and obtains the initial request to be identified. Afterwards, the request to be identified is input into the malicious request detection model through the attack detector 1222 to obtain the detection result.

[0142] Example 2, Figure 7 The flowchart of the third embodiment of the method for identifying malicious requests provided in the present application is shown in FIG. Figure 7 As shown, the malicious request identification method may also include the following steps:

[0143] Step 1: Receive the HTTP request line.

[0144] Step 2: Receive the data stream through the buffer. If the reception is successful, execute step 3. If the reception fails, execute step 8.

[0145] The data stream is the initial request to be identified.

[0146] Step 3: Verify the integrity of the received data stream. If it passes, proceed to step 4; if it fails, proceed to step 8.

[0147] Step 4: parse the request header and request body of the data stream through the parser. If the parsing is normal, execute step 5; if the parsing fails, execute step 8.

[0148] Step 5: Obtain the request line parameter characteristics. If the protocol version of the data stream is HTTP 1.0 or higher, execute step 6. If the protocol version is lower than HTTP 1.0, treat the data stream as a request to be identified and execute step 7.

[0149] Step 6: parse the header field of the data stream and format it;

[0150] Step 7: Output the request to be identified. After completing this step, stop executing subsequent steps.

[0151] Step 8: Close the connection with the terminal device that sends the data stream.

[0152] Example 3, Figure 8 The flowchart of the fourth embodiment of the method for identifying malicious requests provided in the present application is as follows. Figure 8 As shown, the malicious request identification method may also include the following steps:

[0153] S801: Obtain a request to be identified.

[0154] S802, detecting whether the terminal device sending the request to be identified has the right to access the server corresponding to the request to be identified, if yes, executing S803, if no, ending.

[0155] S803: Obtain a request header of the request to be identified.

[0156] S804: Determine the type of request to be identified. If it is a POST request, execute S805; if it is a GET request, execute S806.

[0157] S805: Obtain the request body of the request to be identified.

[0158] S806. Identify whether the request header and / or request body has abnormal behavior through the malicious request detection model. If so, execute S807; otherwise, execute S808.

[0159] S807: intercept the request to be identified, generate a corresponding error log, and return error information to the terminal device.

[0160] S808: Forward the request to be identified to the corresponding server.

[0161] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0162] Fig. 9 A schematic diagram of the structure of a training device for a malicious request detection model provided in an embodiment of the present application. Fig. 9 As shown, the training device of the malicious request detection model includes:

[0163] The acquisition module 91 is used to acquire malicious sample requests and non-malicious sample requests.

[0164] The processing module 92 is used to annotate the request path and request parameters in the malicious sample request to generate an annotated malicious sample request.

[0165] The training module 93 is used to train the neural network model through the annotated malicious sample requests and non-malicious sample requests to obtain a malicious request detection model.

[0166] In a possible design of an embodiment of the present application, the request parameter includes at least one of the following sub-parameters:

[0167] The type of malicious sample request, the character length of the malicious sample request, the character length of the ciphertext string, the ratio of the character length of the ciphertext string to the malicious sample request, the number of the first preset characters in the parameter value, the ratio of the first preset character to the total number of characters in the parameter value, the number of preset character strings, the ratio of the preset character strings to the total number of character strings in the malicious sample request, and access resource information.

[0168] In another possible design of the embodiment of the present application, the processing module 92 is specifically configured to:

[0169] The request path in the malicious sample request is decoded, and the uppercase characters of the string obtained after decoding are converted to lowercase to generate a first malicious sample request.

[0170] Each sub-parameter in the first malicious sample request is divided by a second preset character, and the divided sub-parameters are connected by a third character to generate a second malicious sample request.

[0171] Annotate the processed request path and each sub-parameter in the second malicious sample request to generate an annotated malicious sample request.

[0172] Among them, the acquisition module 91 can be the above-mentioned data flow parser 1211, the processing module 92 can be the above-mentioned data flow processing annotator 1212, and the training module 93 can be the above-mentioned deep learning trainer 1213.

[0173] The training device for the malicious request detection model provided in the embodiment of the present application can be used to execute the training method for the malicious request detection model in any of the above embodiments. The implementation principle and technical effects are similar and will not be repeated here.

[0174] Fig.10 This is a schematic diagram of the structure of the malicious request identification method and device provided in the embodiment of the present application. Fig.10 As shown, the malicious request identification device includes:

[0175] The acquisition module 1001 is used to acquire the request to be identified.

[0176] The input module 1002 is used to input the request to be identified into the malicious request detection model to obtain a detection result. The malicious request detection model is trained using any method of the first aspect, and the detection result is used to indicate whether the request to be identified is a malicious request.

[0177] In a possible design of an embodiment of the present application, the device further includes:

[0178] The sending module is used to intercept the request to be identified if the detection result indicates that the request to be identified is a malicious request, generate a corresponding error log, and return an error message to the terminal device that sent the request to be identified. The error message is used to indicate that the request to be identified failed to be successfully sent to the corresponding server.

[0179] The sending module is also used to forward the request to be identified to the corresponding server if the detection result indicates that the request to be identified is a non-malicious request.

[0180] Optionally, the input module 1002 is specifically used for:

[0181] Determine whether the terminal device has the authority to exchange information with the server.

[0182] If yes, determine the type of request to be identified.

[0183] If the type of the request to be identified is a GET request type, the request header of the request to be identified is input into the malicious request detection model to obtain the detection result.

[0184] If the type of the request to be identified is a POST request type, the request header and request body of the request to be identified are input into the malicious request detection model to obtain the detection result.

[0185] Among them, the acquisition module 1001 can be the above-mentioned data flow parser 1221, and the input module 1002 can be the above-mentioned attack detector 1222.

[0186] The malicious request identification device provided in the embodiment of the present application can be used to execute the malicious request identification method in any of the above embodiments. Its implementation principle and technical effects are similar and will not be repeated here.

[0187] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0188] Fig.11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.11 As shown, the electronic device 12 may include: a processor 1101, a memory 1102, and computer program instructions stored in the memory 1102 and executable on the processor 1101. When the processor 1101 executes the computer program instructions, it implements the training method of the malicious request detection model and / or the malicious request identification method provided in any of the aforementioned embodiments.

[0189] Optionally, the above-mentioned components of the electronic device 12 may be connected via a system bus.

[0190] The memory 1102 may be a separate storage unit or a storage unit integrated in a processor. The number of processors may be one or more.

[0191] Optionally, the electronic device 12 may also include an interface for interacting with other devices.

[0192] The transceiver is used to communicate with other computers, and the transceiver constitutes a communication interface.

[0193] It should be understood that the processor 1101 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.

[0194] The system bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.

[0195] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The above-mentioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the above-mentioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.

[0196] The electronic device provided in the embodiment of the present application can be used to execute the training method of the malicious request detection model and / or the malicious request identification method provided in any of the above-mentioned method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.

[0197] An embodiment of the present application provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed on a computer, the computer executes the above-mentioned malicious request detection model training method and / or malicious request identification method.

[0198] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0199] Optionally, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0200] An embodiment of the present application also provides a computer program product, which includes a computer program, which is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when at least one processor executes the computer program, it can implement the above-mentioned malicious request detection model training method and / or malicious request identification method.

[0201] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A training method for a malicious request detection model, characterized in that: include: Obtaining an initial malicious sample request and an initial non-malicious sample request, formatting the initial malicious sample request and the initial non-malicious sample request, retaining only the request path and request parameter parts in the initial malicious sample request and the initial non-malicious sample request, deleting other redundant data, and obtaining the malicious sample request and the non-malicious sample request; Annotating the request path and request parameters in the malicious sample request to generate an annotated malicious sample request; The neural network model is trained by using the annotated malicious sample requests and the non-malicious sample requests to obtain a malicious request detection model; The step of annotating the request path and request parameters in the malicious sample request to generate an annotated malicious sample request includes: Decoding the request path in the malicious sample request, and converting the uppercase characters of the string obtained after decoding into lowercase characters, to generate a first malicious sample request; Segmenting each sub-parameter in the first malicious sample request by using a second preset character, and connecting the segmented sub-parameters by using a third character to generate a second malicious sample request; Annotate the processed request path and the sub-parameters in the second malicious sample request to generate the annotated malicious sample request.

2. The method according to claim 1, characterized in that The request parameter includes at least one of the following sub-parameters: The type of the malicious sample request, the character length of the malicious sample request, the character length of the ciphertext string, the ratio of the character length of the ciphertext string to the malicious sample request, the number of first preset characters in the parameter value, the ratio of the first preset character to the total number of characters in the parameter value, the number of preset character strings, the ratio of the preset character string to the total number of character strings in the malicious sample request, and access resource information.

3. A method for identifying malicious requests, characterized in that: include: Get the request to be identified; The request to be identified is input into a malicious request detection model to obtain a detection result, wherein the malicious request detection model is trained using the method described in claim 1 or 2, and the detection result is used to indicate whether the request to be identified is a malicious request.

4. The method according to claim 3, characterized in that The method further comprises: If the detection result indicates that the request to be identified is a malicious request, the request to be identified is intercepted, a corresponding error log is generated, and an error message is returned to the terminal device that sent the request to be identified, where the error message is used to indicate that the request to be identified has not been successfully sent to the corresponding server; If the detection result indicates that the request to be identified is a non-malicious request, the request to be identified is forwarded to the corresponding server.

5. The method according to claim 4, characterized in that The step of inputting the request to be identified into a malicious request detection model to obtain a detection result includes: Determining whether the terminal device has the authority to interact with the server; If yes, then determine the type of the request to be identified; If the type of the request to be identified is a GET request type, inputting the request header of the request to be identified into the malicious request detection model to obtain the detection result; If the type of the request to be identified is a POST request type, the request header and request body of the request to be identified are input into the malicious request detection model to obtain the detection result.

6. A training device for a malicious request detection model, characterized in that: include: An acquisition module, used to acquire an initial malicious sample request and an initial non-malicious sample request, format the initial malicious sample request and the initial non-malicious sample request, retain only the request path and request parameter parts in the initial malicious sample request and the initial non-malicious sample request, delete other redundant data, and acquire the malicious sample request and the non-malicious sample request; A processing module, used to annotate the request path and request parameters in the malicious sample request to generate an annotated malicious sample request; A training module, used for training a neural network model through the annotated malicious sample requests and the non-malicious sample requests to obtain a malicious request detection model; The processing module is specifically used to decode the request path in the malicious sample request, and convert the uppercase characters of the string obtained after decoding into lowercase characters, so as to generate a first malicious sample request; Segmenting each sub-parameter in the first malicious sample request by using a second preset character, and connecting the segmented sub-parameters by using a third character to generate a second malicious sample request; Annotate the processed request path and the sub-parameters in the second malicious sample request to generate the annotated malicious sample request.

7. A malicious request identification device, characterized in that: include: An acquisition module, used for acquiring a request to be identified; An input module is used to input the request to be identified into a malicious request detection model to obtain a detection result, wherein the malicious request detection model is trained using the method described in claim 1 or 2, and the detection result is used to indicate whether the request to be identified is a malicious request.

8. An electronic device, comprising: A processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the method according to any one of claims 1 to 5 when executing the computer program instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.