Risk determination method, device, storage medium and electronic device
By building a target syntax attack library and calculating semantic similarity, identifying SQL injection attacks in web applications, the problem of difficulty in identifying SQL injection in the existing technology is solved, and the security of the application is improved.
Patent Information
- Application Number
- CN202210957666.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2042-08-10
AI Technical Summary
It is difficult for the prior art to accurately identify and prevent SQL injection attacks in web applications, resulting in security vulnerabilities and affect system security.
By obtaining the target request words in the resource request, building the target grammar attack library, converting the target attack words into the target grammar feature vector, converting the target request words into the target request feature vector, calculating the semantic similarity to determine the attack risk, and then judging the user Enter whether there is an SQL injection attack.
It realizes automatic judgment of user input, avoids inputs that carry system attacks to access applications, and improves the system security of web applications.
Smart Images

Figure CN115344869B_ABST
Abstract
Description
Background Art
[0002] With the rapid development of software and hardware, various websites are constantly being developed. There are security vulnerabilities in some websites. For example, SQL injection (SQL Injection, Structured Query Language) is a security vulnerability at the bottom of web (World Wide Web) applications. The reason for its occurrence is that web applications do not judge or filter the legitimacy of user input data strictly. Attackers can add additional SQL statements to the end of pre-defined query statements in web applications, and perform illegal operations without the knowledge of administrators, thereby deceiving the database server to execute unauthorized arbitrary queries, and further obtain corresponding data information. SQL injection has become one of the biggest risks of web applications.
[0003] Therefore, a solution is needed to identify SQL injection in user input to improve the security of web applications.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present disclosure is to provide a risk determination method, a risk determination device, a computer-readable storage medium, and an electronic device, which can solve the problem in the related art that the attack risk in the user input cannot be accurately identified.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to a first aspect of the present disclosure, a risk determination method is provided, comprising: obtaining a resource request; wherein the resource request includes a plurality of request words; extracting a target request word in the resource request; wherein the plurality of request words include a plurality of target request words, and the grammatical type of the target request word is a target grammatical type; constructing a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library includes a target attack word, converting the target attack word into a target grammar feature vector, and converting the target request word into a target request feature vector; obtaining the semantic similarity of the target grammar feature vector and the target request feature vector, and determining the attack risk of the resource request according to the semantic similarity.
[0008] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the target attack word is converted into a target grammatical feature vector, and the target request word is converted into a target request feature vector, including: converting a plurality of the target attack words into a plurality of target grammatical word feature vectors, and determining a target grammatical feature vector based on the plurality of target grammatical word feature vectors; converting a target request word into a plurality of target request word feature vectors, and obtaining a target request feature vector based on the plurality of target request word feature vectors.
[0009] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, a target grammatical feature vector is determined according to multiple target grammatical word feature vectors, including: encoding and then decoding multiple target grammatical word feature vectors to obtain a target grammatical feature vector; a target request feature vector is obtained according to multiple target request word feature vectors, including: encoding and then decoding multiple target request word feature vectors to obtain a target request feature vector.
[0010] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the semantic similarity of the target grammatical feature vector and the target request feature vector is obtained, including: obtaining the keyword weights corresponding to each target request feature sub-vector in the target request feature vector; wherein the target request feature vector includes multiple target request feature sub-vectors; determining the semantic similarity of the target grammatical feature vector and the target request feature vector according to the target request feature sub-vector, the keyword weights corresponding to the target request feature sub-vector, and the target grammatical feature vector.
[0011] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the keyword weights corresponding to each target request feature sub-vector in the target request feature vector are obtained, including: determining the keyword weights corresponding to the target request feature sub-vector according to the relevant information of the target request feature sub-vector; wherein the relevant information of the target request feature sub-vector includes one or more of occurrence frequency information, execution feasibility information, and attack impact degree information.
[0012] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the semantic similarity of the target grammatical feature vector and the target request feature vector is obtained, including: calculating the cosine distance of the target grammatical feature vector and the target request feature vector; determining the semantic similarity of the target grammatical feature vector and the target request feature vector according to the cosine distance.
[0013] In an exemplary embodiment of the present disclosure, based on the above scheme, the attack risk of the resource request is determined according to the semantic similarity, including: when the semantic similarity is greater than or equal to the similarity threshold, determining that the resource request has an attack risk.
[0014] According to a second aspect of the present disclosure, a risk determination device is provided, including: a resource request acquisition module, used to acquire a resource request; wherein the resource request includes a plurality of request words; a target request word acquisition module, used to extract a target request word in the resource request; wherein the plurality of request words include a plurality of target request words, and the grammatical type of the target request word is a target grammatical type; a feature vector conversion module, used to construct a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library includes a target attack word, converts the target attack word into a target grammar feature vector, and converts the target request word into a target request feature vector; a risk determination module, used to acquire the semantic similarity of the target grammar feature vector and the target request feature vector, and determine the attack risk of the resource request according to the semantic similarity.
[0015] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the risk determination method of the first aspect of the above embodiment is implemented.
[0016] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:
[0017] one or more processors; and
[0018] A storage device is used to store one or more programs. When the one or more programs are executed by one or more processors, the one or more processors implement the risk determination method of the first aspect of the above embodiment.
[0019] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0020] In a risk determination method provided by an embodiment of the present disclosure, a resource request can be obtained, a target request word in the resource request can be extracted (the grammatical type of the target request word is the target grammatical type), a target grammar attack library corresponding to the target grammar type is constructed, the target grammar attack library contains target attack words, the target attack words are converted into a target grammar feature vector, the target request word is converted into a target request feature vector, the semantic similarity of the target grammar feature vector and the target request feature vector is obtained, and the attack risk of the resource request is determined according to the semantic similarity. On the one hand, it can be determined whether the user input is risky based on the similarity between the user input and the target grammar, and it can automatically determine whether the user input contains a system attack of the target type; on the other hand, it can prevent user input carrying system attacks from accessing the application, and can improve the system security of the application.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0023] Figure 1 A schematic diagram schematically illustrates an exemplary system architecture of a risk determination method in an exemplary embodiment of the present disclosure;
[0024] Figure 2 A flow chart schematically illustrates a risk determination method in an exemplary embodiment of the present disclosure;
[0025] Figure 3 A flowchart schematically illustrates converting a target request word into a plurality of target request word feature vectors and obtaining a target request feature vector according to the plurality of target request word feature vectors in an exemplary embodiment of the present disclosure;
[0026] Figure 4 A schematic diagram schematically illustrates encoding and decoding based on a Transformer model in an exemplary embodiment of the present disclosure;
[0027] Figure 5 A flowchart schematically illustrates a method of determining the semantic similarity of a target grammatical feature vector and a target request feature vector according to a target request feature subvector, a keyword weight corresponding to the target request feature subvector, and a target grammatical feature vector in an exemplary embodiment of the present disclosure;
[0028] Figure 6 A schematic diagram schematically illustrates a module for determining a keyword weight corresponding to a target request feature sub-vector in an exemplary embodiment of the present disclosure;
[0029] Figure 7 A flowchart schematically illustrates determining the semantic similarity of a target grammatical feature vector and a target request feature vector according to a cosine distance in an exemplary embodiment of the present disclosure;
[0030] Figure 8 A flowchart schematically illustrates another risk determination method in an exemplary embodiment of the present disclosure;
[0031] Fig. 9 A schematic diagram schematically illustrates the components of a risk determination device in an exemplary embodiment of the present disclosure;
[0032] Fig.10 The structure diagram of a computer system suitable for implementing the electronic device of the exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In addition, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known structures, methods, devices, implementations, materials, or operations are not shown or described in detail to avoid blurring various aspects of the present disclosure.
[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or these functional entities or parts of functional entities may be implemented in one or more software hardened modules, or these functional entities may be implemented in different networks and / or processor devices and / or microcontroller devices.
[0035] Figure 1 A schematic diagram showing an exemplary system architecture to which the risk determination method according to an embodiment of the present disclosure can be applied.
[0036] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 1001, 1002, 1003, a network 1004, and a server 1005. The network 1004 is used to provide a medium for communication links between the terminal devices 1001, 1002, 1003 and the server 1005. The network 1004 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0037] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 1005 may be a server cluster composed of multiple servers.
[0038] Users can use terminal devices 1001, 1002, 1003 to interact with server 1005 through network 1004 to receive or send messages, etc. Terminal devices 1001, 1002, 1003 can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, portable computers, desktop computers, etc. In addition, server 1005 can be a server that provides various services.
[0039] In one embodiment, the executor of the risk determination method disclosed herein may be server 1005, which may obtain resource requests sent by terminal devices 1001, 1002, and 1003, extract target request words in the resource requests, convert the target grammar corresponding to the target grammar type into a target grammar feature vector, convert the target request words into a target request feature vector, obtain the semantic similarity of the target grammar feature vector and the target request feature vector, and determine the attack risk of the resource request based on the semantic similarity.
[0040] In addition, the risk determination method of the present disclosure can also be executed through terminal devices 1001, 1002, 1003, etc. to obtain resource requests, extract target request words in the resource requests (the grammatical type of the target request words is the target grammatical type), and construct a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converts the target attack words into target grammar feature vectors, converts the target request words into target request feature vectors, obtains the semantic similarity of the target grammar feature vector and the target request feature vector, and determines the attack risk of the resource request based on the semantic similarity.
[0041] In addition, the implementation process of the risk determination method of the present disclosure can also be implemented by the terminal devices 1001, 1002, 1003 and the server 1005. For example, the terminal devices 1001, 1002,
[0042] 1003 can obtain a resource request, extract a target request word in the resource request (the grammatical type of the target request word is the target grammatical type), and send the target request word in the obtained resource request to the server 1005, so that the server 1005 can build a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converts the target attack words into a target grammar feature vector, converts the target request word into a target request feature vector, obtains the semantic similarity of the target grammar feature vector and the target request feature vector, and determines the attack risk of the resource request according to the semantic similarity.
[0043] With the rapid development of software and hardware, various websites are constantly being developed. There are security vulnerabilities in some websites. For example, SQL injection is a security vulnerability at the bottom of web applications. The reason for its occurrence is that web applications do not judge or filter the legitimacy of user input data strictly. Attackers can add additional SQL statements to the end of pre-defined query statements in web applications, perform illegal operations without the knowledge of administrators, and thereby deceive the database server into executing unauthorized arbitrary queries, thereby further obtaining corresponding data information. SQL injection has become one of the biggest risks of web applications.
[0044] Therefore, a solution is needed to identify SQL injection in user input to improve the security of web applications.
[0045] According to the risk determination method provided in this exemplary embodiment, a resource request can be obtained, a target request word in the resource request can be extracted, the grammatical type of the target request word is the target grammatical type, a target grammar attack library corresponding to the target grammar type is constructed, the target grammar attack library contains target attack words, the target attack words are converted into target grammar feature vectors, the target request words are converted into target request feature vectors, the semantic similarity of the target grammar feature vector and the target request feature vector is obtained, and the attack risk of the resource request is determined according to the semantic similarity. Figure 2 As shown, the risk determination method may include the following steps:
[0046] Step S210, obtaining a resource request; wherein the resource request includes multiple request words;
[0047] Step S220, extracting a target request word in the resource request; wherein the multiple request words include multiple target request words, and the grammatical type of the target request word is the target grammatical type;
[0048] Step S230, constructing a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converting the target attack words into target grammar feature vectors, and converting target request words into target request feature vectors;
[0049] Step S240, obtaining the semantic similarity of the target grammatical feature vector and the target request feature vector, and determining the attack risk of the resource request according to the semantic similarity.
[0050] In a risk determination method provided by an embodiment of the present disclosure, a resource request can be obtained, a target request word in the resource request can be extracted (the grammatical type of the target request word is the target grammatical type), a target grammar attack library corresponding to the target grammar type is constructed, the target grammar attack library contains target attack words, the target attack words are converted into a target grammar feature vector, the target request word is converted into a target request feature vector, the semantic similarity of the target grammar feature vector and the target request feature vector is obtained, and the attack risk of the resource request is determined according to the semantic similarity. On the one hand, it can be determined whether the user input is risky based on the similarity between the user input and the target grammar, and it can automatically determine whether the user input contains a system attack of the target type; on the other hand, it can prevent user input carrying system attacks from accessing the application, and can improve the system security of the application.
[0051] Next, steps S210 to S240 of the risk determination method in this exemplary embodiment will be described in more detail with reference to the accompanying drawings and embodiments.
[0052] Step S210, obtaining a resource request; wherein the resource request includes multiple request words;
[0053] In an exemplary embodiment of the present disclosure, a resource request may be obtained. The resource request includes multiple request words. Specifically, the resource request may be used to obtain a resource. For example, the resource request may be an http request (Hyper Text Transfer Protocol), which refers to a request message from a client to a server, and includes a request method for a resource, an identifier of the resource, and a protocol used.
[0054] It should be noted that the present disclosure does not specifically limit the specific type of resource request and the specific method of obtaining the resource request.
[0055] In an exemplary embodiment of the present disclosure, a resource request may include multiple request words. Specifically, the request words may be used to form a resource request. For example, the resource request is Accept:image / gif.image / jpeg.* / *, where each item in the resource request is a request word.
[0056] It should be noted that the present disclosure does not specifically limit the specific form of the request word.
[0057] Step S220, extracting the target request word in the resource request;
[0058] In an exemplary embodiment of the present disclosure, after obtaining a resource request through the above method, a target request word in the resource request can be extracted. Among them, the multiple request words include multiple target request words, and the grammatical type of the target request word is the target grammatical type. Specifically, the grammatical type of each request word in the resource request can be obtained, and the target request word can be extracted from the resource request according to the grammatical type of the request word.
[0059] For example, the resource request is select user_name from user where id=1or 1=1, and the target syntax type is the SQL syntax type, wherein the syntax type of select, from, where, or 1=1 is the SQL syntax type. At this time, select, from, where, or 1=1 can be determined as the target request words, and these target request words can be extracted from the resource request.
[0060] It should be noted that the present disclosure does not specifically limit the specific type of the target grammar type and the specific method of extracting the target request word in the resource request.
[0061] Step S230, constructing a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converting the target attack words into target grammar feature vectors, and converting target request words into target request feature vectors;
[0062] In an exemplary embodiment of the present disclosure, after obtaining the target request word in the resource request through the above steps, considering that the grammatical type of the target request word is the target grammatical type, a target grammar attack library corresponding to the target grammar type can be constructed, the target grammar attack library contains target attack words, the target attack words are converted into target grammar feature vectors, and the target request word is converted into a target request feature vector. Specifically, the target grammar corresponding to the target grammar type refers to all grammars related to the target grammar type. For example, the target grammar type is SQL grammar, and the target grammar corresponding to the target grammar type can be all SQL grammars in the SQL grammar library.
[0063] In an exemplary embodiment of the present disclosure, a target grammar attack library corresponding to the target grammar type can be constructed by machine training, wherein the target grammar attack library contains target attack words, and the target attack words are converted into target grammar feature vectors, and the target request words are converted into target request feature vectors. Specifically, the target grammar feature vector is a vector representation of the target grammar corresponding to the target grammar type, and the target request feature vector is a vector identification form of the target request word. For example, the target grammar corresponding to the target grammar type can be converted into a target grammar feature vector by a character encoder, and the target request word can be converted into a target request feature vector by a character encoder.
[0064] It should be noted that the present disclosure does not specifically limit the specific method of constructing a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converting the target attack words into target grammar feature vectors, and converting target request words into target request feature vectors.
[0065] In an exemplary embodiment of the present disclosure, the target attack words may be converted into a plurality of target grammatical word feature vectors, a target grammatical feature vector may be determined based on the plurality of target grammatical word feature vectors, a target request word may be converted into a plurality of target request word feature vectors, and a target request feature vector may be obtained based on the plurality of target request word feature vectors. Figure 3 As shown, converting the target request word into a plurality of target request word feature vectors, and obtaining the target request feature vector according to the plurality of target request word feature vectors may include the following steps S310 to S320:
[0066] Step S310, converting the target grammar corresponding to the target grammar type into a plurality of target grammar word feature vectors, and determining a target grammar feature vector according to the plurality of target grammar word feature vectors;
[0067] In an exemplary embodiment of the present disclosure, the target grammar corresponding to the target grammar type can be converted into multiple target grammar word feature vectors, and the target grammar feature vector is determined based on the multiple target grammar word feature vectors. Specifically, after extracting the target request word in the resource request through the above steps, the target grammar type of the target request word can be determined, and the target grammar corresponding to the target grammar type can be obtained, and the target grammar corresponding to the target grammar type can be converted into multiple target grammar word feature vectors. Specifically, the target grammar corresponding to the target grammar type can include multiple target grammar words, and these target grammar words can be converted into multiple target request word feature vectors.
[0068] For example, the target grammar corresponding to the target grammar type can be first split into multiple target grammar words, and then the target grammar words can be converted into multiple target request word feature vectors through a word vector conversion model based on BERT (Bidirectional Encoder Representation from Transformers, language representation model); for another example, the target grammar words can be converted into multiple target request word feature vectors through a word vector conversion model based on word2vec (vector conversion model).
[0069] It should be noted that the present disclosure does not specifically limit the specific method of converting the target grammar corresponding to the target grammar type into multiple target grammar word feature vectors.
[0070] In an exemplary embodiment of the present disclosure, after obtaining multiple target grammatical word feature vectors through the above steps, a target grammatical feature vector can be determined based on the multiple target grammatical word feature vectors. For example, multiple target grammatical word feature vectors can be fused to obtain a target grammatical feature vector. It should be noted that the present disclosure does not specifically limit the specific method of determining the target grammatical feature vector based on multiple target grammatical word feature vectors.
[0071] In an exemplary embodiment of the present disclosure, multiple target grammar word feature vectors may be encoded and then decoded to obtain a target grammar feature vector. Specifically, after multiple target grammar word feature vectors are obtained through the above steps, multiple target grammar word feature vectors may be encoded and then decoded to obtain a more abstract feature vector corresponding to each target grammar word feature vector, i.e., a target grammar feature vector.
[0072] Step S320, converting the target request word into a plurality of target request word feature vectors, and obtaining a target request feature vector according to the plurality of target request word feature vectors.
[0073] In an exemplary embodiment of the present disclosure, after extracting the target request word in the resource request through the above steps, the target request word can be converted into multiple target request word feature vectors, and the target request feature vector can be obtained based on the multiple target request word feature vectors. Specifically, the target request word can include multiple target request words, and these target request words can be converted into multiple target request word feature vectors.
[0074] For example, the target request word can be first split into multiple target request words, and then the target request word can be converted into multiple target request word feature vectors through a BERT-based word vector conversion model; for another example, the target request word can be converted into multiple target request word feature vectors through a word2vec-based word vector conversion model.
[0075] Furthermore, a word vector conversion model for converting a target grammar corresponding to a target grammar type into a plurality of target grammar word feature vectors may be obtained, and the target request word may be converted into a plurality of target request word feature vectors using the word vector conversion model.
[0076] It should be noted that the present disclosure does not specifically limit the specific method of converting the target request word into multiple target request word feature vectors.
[0077] Furthermore, the target request word may be converted into a plurality of target request word feature vectors (two-dimensional arrays), and the target grammar corresponding to the target grammar type may be converted into a plurality of target grammar word feature vectors (two-dimensional arrays).
[0078] In an exemplary embodiment of the present disclosure, after obtaining multiple target request word feature vectors through the above steps, a target request feature vector can be determined based on the multiple target request word feature vectors. For example, multiple target request word feature vectors can be fused to obtain a target request feature vector. It should be noted that the present disclosure does not specifically limit the specific method for obtaining a target request feature vector based on multiple target request word feature vectors.
[0079] In an exemplary embodiment of the present disclosure, multiple target grammatical word feature vectors may be encoded and then decoded to obtain a target grammatical feature vector. Specifically, after obtaining multiple target request word feature vectors through the above steps, multiple target request word feature vectors may be encoded and then decoded to obtain a more abstract feature vector corresponding to each target request word feature vector, namely, a target request feature vector. Specifically, in the target request word, special characters may be URL (uniform resource locator, uniform resource locator system) encoded, for example, < may be encoded as %3C, \ may be encoded as %5C, % may be encoded as 25%, etc. Through the embodiments of the present disclosure, URL encoding anti-bypass can be avoided.
[0080] For example, Figure 4As shown, a Transformer-based model can be used to encode and then decode multiple target grammatical word feature vectors to obtain target grammatical feature vectors. For example, the Encoder in the Transformer model can be used to encode the target grammatical word feature vector, and then the Dncoder in the Transformer is used to decode it to obtain a more abstract feature vector corresponding to each target grammatical word feature vector, that is, a target grammatical feature vector; a Transformer-based structure can be used to encode and then decode multiple target request word feature vectors to obtain a target request feature vector. For example, the Encoder in the Transformer can be used to encode the target request word feature vector, and then the Dncoder in the Transformer is used to decode it to obtain a more abstract feature vector corresponding to each target request word feature vector, that is, a target grammatical feature vector.
[0081] Through the above steps S310 to S320, the target grammar corresponding to the target grammar type can be converted into multiple target grammar word feature vectors, the target grammar feature vector can be determined based on the multiple target grammar word feature vectors, the target request word can be converted into multiple target request word feature vectors, and the target request feature vector can be obtained based on the multiple target request word feature vectors.
[0082] Step S240, obtaining the semantic similarity of the target grammatical feature vector and the target request feature vector, and determining the attack risk of the resource request according to the semantic similarity.
[0083] In an exemplary embodiment of the present disclosure, after obtaining the target grammar feature vector and the target request feature vector through the above steps, the semantic similarity of the target grammar feature vector and the target request feature vector can be obtained. Specifically, the semantic similarity of the target grammar feature vector and the target request feature vector can be used to indicate the similarity between the target grammar corresponding to the target grammar type and the target request word, and the similarity between the target grammar corresponding to the target grammar type and the target request word can be represented by the semantic similarity.
[0084] Specifically, to obtain the semantic similarity of the target grammatical feature vector and the target request feature vector, the concepts of related words can be organized in a tree structure through a semantic dictionary for calculation; or, the context information of the words can be used to calculate using statistical methods. For example, the semantic similarity of the target grammatical feature vector and the target request feature vector can be obtained by using a WordNet semantic similarity algorithm; as another example, the semantic similarity of the target grammatical feature vector and the target request feature vector can be calculated based on a BERT model. It should be noted that the present disclosure does not specifically limit the specific method for obtaining the semantic similarity of the target grammatical feature vector and the target request feature vector.
[0085] In an exemplary embodiment of the present disclosure, after obtaining the semantic similarity of the target grammatical feature vector and the target request feature vector through the above steps, the attack risk of the resource request can be determined according to the semantic similarity. Specifically, the attack risk of the resource request can be used to indicate the risk of the system being attacked when the system receives the resource request.
[0086] It should be noted that the present disclosure does not specifically limit the specific form of the attack risk of resource requests.
[0087] Specifically, it is possible to determine whether a resource request has an attack risk based on whether the target request word exists in the resource request and the degree of similarity between the target request word and the target grammar corresponding to the target grammar type. For example, when the semantic similarity between the target grammar feature vector and the target request feature vector is high, it can be indicated that the resource request includes the target request word, wherein the grammar type of the target request word is the target grammar type, and the target request words have a high degree of similarity to the target grammar corresponding to the target grammar type. At this time, it can be determined that the resource request has a high risk of attack; when the semantic similarity between the target grammar feature vector and the target request feature vector is low, it can be indicated that the resource request includes the target request word, wherein the grammar type of the target request word is the target grammar type, and the target request words have a low degree of similarity to the target grammar corresponding to the target grammar type. At this time, it can be determined that the resource request has a low risk of attack.
[0088] It should be noted that the present disclosure does not specifically limit the specific method of determining the attack risk of a resource request based on semantic similarity.
[0089] In an exemplary embodiment of the present disclosure, when the semantic similarity is greater than or equal to the similarity threshold, it is determined that the resource request has an attack risk. Specifically, after obtaining the semantic similarity of the target grammatical feature vector and the target request feature vector through the above steps, the semantic similarity of the target grammatical feature vector and the target request feature vector can be compared with the similarity threshold, and when the semantic similarity is greater than or equal to the similarity threshold, it is determined that the resource request has an attack risk.
[0090] It should be noted that the present disclosure does not impose any special limitation on the specific value of the similarity threshold.
[0091] In an exemplary embodiment of the present disclosure, the keyword weight corresponding to each target request feature subvector in the target request feature vector is obtained, and the semantic similarity of the target grammatical feature vector and the target request feature vector is determined according to the target request feature subvector, the keyword weight corresponding to the target request feature subvector, and the target grammatical feature vector. Figure 5 As shown, determining the semantic similarity of the target grammatical feature vector and the target request feature vector according to the target request feature subvector, the keyword weight corresponding to the target request feature subvector, and the target grammatical feature vector may include the following steps S510-S520:
[0092] Step S510, obtaining the keyword weight corresponding to each target request feature sub-vector in the target request feature vector;
[0093] In an exemplary embodiment of the present disclosure, after obtaining the target request feature vector through the above steps, each target request feature sub-vector in the target request feature vector can be obtained, and the keyword weight corresponding to each target request feature sub-vector can be obtained. Among them, the target request feature vector includes multiple target request feature sub-vectors. Specifically, the target request feature vector is composed of multiple target request feature sub-vectors, and the target request feature sub-vector can be used to indicate each target request word. The keyword weight corresponding to the target request feature sub-vector can be used to indicate the importance of the target request feature sub-vector.
[0094] It should be noted that the present disclosure does not specifically limit the specific method of obtaining the keyword weight corresponding to each target request feature sub-vector in the target request feature vector.
[0095] In an exemplary embodiment of the present disclosure, the keyword weight corresponding to the target request feature subvector may be determined based on the relevant information of the target request feature subvector, wherein the relevant information of the target request feature subvector includes one or more of occurrence frequency information, execution feasibility information, and attack impact degree information.
[0096] Specifically, the frequency information can be used to indicate the frequency of occurrence of the target request word corresponding to the target request feature sub-vector. When the frequency of occurrence of the target request word corresponding to the target request feature sub-vector is high, a higher keyword weight can be assigned to the target request feature sub-vector. When the frequency of occurrence of the target request word corresponding to the target request feature sub-vector is low, a lower keyword weight can be assigned to the target request feature sub-vector. The execution feasibility information can be used to indicate the executable nature of the target request word corresponding to the target request feature sub-vector (i.e., whether the target request word is complete). When the execution feasibility of the target request word corresponding to the target request feature sub-vector is strong, a higher keyword weight can be assigned to the target request feature sub-vector. When the execution feasibility of the target request word corresponding to the target request feature sub-vector is weak, a lower keyword weight can be assigned to the target request feature sub-vector. The attack impact degree information can be used to indicate whether the target request word corresponding to the target request feature sub-vector obtains critical information.
[0097] For example, if select*from user where 1=1 obtains key information, the attack impact of each target request word is relatively high. In this case, a higher keyword weight can be assigned to the target request feature sub-vector corresponding to the target request word; if select*from user where user_name='zhangsan' obtains non-key information, the attack impact of each target request word is relatively low. In this case, a lower keyword weight can be assigned to the target request feature sub-vector corresponding to the target request word.
[0098] It should be noted that the present disclosure does not specifically limit the specific method of determining the keyword weight corresponding to the target request feature sub-vector according to the relevant information of the target request feature sub-vector.
[0099] In an exemplary embodiment of the present disclosure, Figure 6 As shown, a keyword weight calculation module can determine multiple types of target request words, such as keywords, conditional queries, encodings, transcodings, annotations, functions, etc., and determine the target request word occurrence frequency information, execution feasibility information, and attack impact information, and thereby determine the keyword weight corresponding to the target request feature sub-vector.
[0100] Step S520 , determining the semantic similarity between the target grammatical feature vector and the target request feature vector according to the target request feature subvector, the keyword weight corresponding to the target request feature subvector, and the target grammatical feature vector.
[0101] In an exemplary embodiment of the present disclosure, after obtaining the keyword weights corresponding to each target request feature subvector in the target request feature vector through the above steps, the semantic similarity of the target grammatical feature vector and the target request feature vector can be determined based on the target request feature subvector, the keyword weights corresponding to the target request feature subvector, and the target grammatical feature vector. Specifically, the keyword weights corresponding to the target request feature subvector can be used to indicate the importance of the target request feature subvector, and the importance of the target request feature subvector to the semantic similarity can be determined based on the keyword weights corresponding to the target request feature subvector, and the semantic similarity of the target grammatical feature vector and the target request feature vector can be determined accordingly.
[0102] It should be noted that the present disclosure does not specifically limit the specific method of determining the semantic similarity of the target grammatical feature vector and the target request feature vector based on the target request feature subvector, the keyword weight corresponding to the target request feature subvector, and the target grammatical feature vector.
[0103] Through the above steps S510 to S520, the keyword weights corresponding to each target request feature subvector in the target request feature vector can be obtained, and the semantic similarity of the target grammatical feature vector and the target request feature vector can be determined according to the target request feature subvector, the keyword weights corresponding to the target request feature subvector and the target grammatical feature vector.
[0104] In an exemplary embodiment of the present disclosure, the cosine distance between the target grammatical feature vector and the target request feature vector may be calculated, and the semantic similarity between the target grammatical feature vector and the target request feature vector may be determined according to the cosine distance. Figure 7 As shown, determining the semantic similarity of the target grammatical feature vector and the target request feature vector according to the cosine distance may include the following steps S710 to S720:
[0105] Step S710, calculating the cosine distance between the target grammatical feature vector and the target request feature vector;
[0106] Step S720: determining the semantic similarity between the target grammatical feature vector and the target request feature vector according to the cosine distance.
[0107] In an exemplary embodiment of the present disclosure, after obtaining the target grammatical feature vector and the target request feature vector through the above steps, the cosine distance between the target grammatical feature vector and the target request feature vector can be calculated. Specifically, the target grammatical feature vector and the target request feature vector can be taken as points in the vector space, and the cosine distance between the points can be calculated. The distance of the points can be determined by the cosine distance to judge the semantic similarity between the target grammatical feature vector and the target request feature vector. Specifically, the cosine value between the angle between two vectors in the vector space can be used as a measure of the difference between the two vectors. The closer the cosine value is to 1, the closer the angle is to 0, indicating that the two vectors are more similar. The closer the cosine value is to 0, the closer the angle is to 90 degrees, indicating that the two vectors are more dissimilar.
[0108] Furthermore, the dimension of the target syntax feature vector and the target request feature vector is 128.
[0109] Through the above steps S710 to S720, the cosine distance between the target grammatical feature vector and the target request feature vector can be calculated, and the semantic similarity between the target grammatical feature vector and the target request feature vector can be determined according to the cosine distance.
[0110] In an exemplary embodiment of the present disclosure, the cosine distance between the target grammar feature vector and the target request feature vector may be calculated, where Q is the resource request, D is the target grammar corresponding to the target grammar type, and y Q Request feature vector for target, y D is the target grammatical feature vector, q i Request feature subvector for target, d i is the target grammatical feature subvector, δ i is the keyword weight corresponding to the target request feature sub-vector, n is the number of features of the feature vector in the same dimension, consine() represents the cosine distance, and its expression is as follows:
[0111]
[0112] In an exemplary embodiment of the present disclosure, Figure 8As shown, the Http request can be obtained, and the target request word (SQL syntax type) in the Http request can be extracted, the syntax library corresponding to the SQL syntax type can be obtained, the target syntax in the syntax library can be obtained, the target syntax can be converted into a target syntax feature vector through the input layer in the DSSM (Deep Structured Semantic Model, deep semantic model) model, and the target request word can be converted into a target request feature vector. Then, the representation layer (based on the Transformer model) in the DSSM model is used to encode and decode multiple target syntax word feature vectors to obtain a target syntax feature vector, and multiple target request word feature vectors are encoded and decoded to obtain a target request feature vector. Then, the semantic similarity of the target syntax feature vector and the target request feature vector is calculated through the matching layer, and the relationship between the semantic similarity and the similarity threshold is determined. When the semantic similarity is less than the similarity threshold, the process ends. When the semantic similarity is greater than or equal to the similarity threshold, the resource request is determined to have an attack risk, and the resource request is stored in the SQL syntax attack library.
[0113] In a risk determination method provided by an embodiment of the present disclosure, a resource request can be obtained, a target request word in the resource request can be extracted, a target grammar corresponding to a target grammar type can be converted into a target grammar feature vector, a target request word can be converted into a target request feature vector, the semantic similarity of the target grammar feature vector and the target request feature vector can be obtained, and the attack risk of the resource request can be determined based on the semantic similarity. On the one hand, it can be determined whether the user input is risky based on the similarity between the user input and the target grammar, and it can automatically determine whether the user input contains a system attack of the target type; on the other hand, it can prevent user input carrying a system attack from accessing the application, and can improve the system security of the application.
[0114] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0115] In addition, in an exemplary embodiment of the present disclosure, a risk determination device is also provided. Fig. 9 As shown, a risk determination device 900 includes: a resource request acquisition module 910, a target request word acquisition module 920, a feature vector conversion module 930 and a risk determination module 940.
[0116] Among them, a resource request acquisition module is used to obtain a resource request; wherein the resource request includes multiple request words; a target request word acquisition module is used to extract the target request word in the resource request; wherein the multiple request words include multiple target request words, and the grammatical type of the target request word is a target grammatical type; a feature vector conversion module is used to construct a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converts the target attack words into a target grammar feature vector, and converts the target request words into a target request feature vector; a risk determination module is used to obtain the semantic similarity of the target grammar feature vector and the target request feature vector, and determine the attack risk of the resource request according to the semantic similarity.
[0117] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the target attack word is converted into a target grammatical feature vector, and the target request word is converted into a target request feature vector. The device also includes: a grammatical word feature vector acquisition unit, which is used to convert multiple target attack words into multiple target grammatical word feature vectors, and determine the target grammatical feature vector based on the multiple target grammatical word feature vectors; a request word feature vector acquisition unit, which is used to convert the target request word into multiple target request word feature vectors, and obtain the target request feature vector based on the multiple target request word feature vectors.
[0118] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, a target grammatical feature vector is determined according to multiple target grammatical word feature vectors, and the device also includes: a first encoding unit, used to encode and then decode multiple target grammatical word feature vectors to obtain a target grammatical feature vector; a target request feature vector is obtained according to multiple target request word feature vectors, and the device also includes: a second encoding unit, used to encode and then decode multiple target request word feature vectors to obtain a target request feature vector.
[0119] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the semantic similarity of the target grammatical feature vector and the target request feature vector is obtained, and the device also includes: a keyword weight acquisition unit, used to obtain the keyword weight corresponding to each target request feature subvector in the target request feature vector; wherein the target request feature vector includes multiple target request feature subvectors; a first semantic similarity determination unit, used to determine the semantic similarity of the target grammatical feature vector and the target request feature vector according to the target request feature subvector, the keyword weight corresponding to the target request feature subvector, and the target grammatical feature vector.
[0120] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the keyword weights corresponding to each target request feature sub-vector in the target request feature vector are obtained, and the device also includes: a keyword weight calculation unit, which is used to determine the keyword weights corresponding to the target request feature sub-vector based on the relevant information of the target request feature sub-vector; wherein the relevant information of the target request feature sub-vector includes one or more of occurrence frequency information, execution feasibility information, and attack impact degree information.
[0121] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the semantic similarity of the target grammatical feature vector and the target request feature vector is obtained, and the device also includes: a cosine distance calculation unit, which is used to calculate the cosine distance between the target grammatical feature vector and the target request feature vector; and a second semantic similarity determination unit, which is used to determine the semantic similarity of the target grammatical feature vector and the target request feature vector according to the cosine distance.
[0122] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the attack risk of a resource request is determined according to semantic similarity, and the device further includes: a similarity comparison unit, for determining that a resource request has an attack risk when the semantic similarity is greater than or equal to a similarity threshold.
[0123] Since the various functional modules of the risk determination device of the example embodiment of the present disclosure correspond to the steps of the example embodiment of the risk determination method described above, for details not disclosed in the embodiment of the device of the present disclosure, please refer to the embodiment of the risk determination method described above in the present disclosure.
[0124] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0125] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above-mentioned risk determination method is also provided.
[0126] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware embodiments, complete software embodiments (including firmware, microcode, etc.), or embodiments combining hardware and software aspects, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0127] Refer to the following Fig.10hereinafter, an electronic device 1000 according to such an embodiment of the present disclosure is described. Fig.10 The electronic device 1000 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0128] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.
[0129] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 2 In step S210 shown in the figure, a resource request is obtained; wherein the resource request includes multiple request words; in step S220, a target request word is extracted from the resource request; wherein the multiple request words include multiple target request words, and the grammatical type of the target request word is a target grammatical type; in step S230, a target grammar attack library corresponding to the target grammar type is constructed, wherein the target grammar attack library includes target attack words, the target attack words are converted into target grammar feature vectors, and the target request words are converted into target request feature vectors; in step S240, the semantic similarity of the target grammar feature vector and the target request feature vector is obtained, and the attack risk of the resource request is determined according to the semantic similarity.
[0130] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1021 and / or a cache memory unit 1022 , and may further include a read-only memory unit (ROM) 1023 .
[0131] The storage unit 1020 may also include a program / utility 1024 having a set (at least one) of program modules 1025, such program modules 1025 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0132] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, a graphics acceleration open port, a processing unit, or a local bus using any of a variety of bus architectures.
[0133] The electronic device 1000 may also communicate with one or more external devices 1070 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0134] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0135] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible embodiments, various aspects of the present disclosure can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of the present specification.
[0136] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0137] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0138] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0139] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0140] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
Claims
1. A risk determination method, characterized in that: The method comprises: Obtaining a resource request; wherein the resource request includes multiple request words; Extracting a target request word from the resource request; wherein the multiple request words include multiple target request words, and the grammatical type of the target request words is a target grammatical type; Constructing a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converting the target attack words into target grammar feature vectors, and converting the target request words into target request feature vectors; Obtaining keyword weights corresponding to each target request feature subvector in the target request feature vector; wherein the target request feature vector includes a plurality of target request feature subvectors; the obtaining keyword weights corresponding to each target request feature subvector in the target request feature vector comprises: determining the keyword weights corresponding to the target request feature subvector according to relevant information of the target request feature subvector; wherein the relevant information of the target request feature subvector comprises one or more of occurrence frequency information, execution feasibility information, and attack impact degree information; The semantic similarity of the target grammatical feature vector and the target request feature vector is determined according to the target request feature subvector, the keyword weight corresponding to the target request feature subvector and the target grammatical feature vector, and the attack risk of the resource request is determined according to the semantic similarity.
2. The method according to claim 1, characterized in that: The step of converting the target attack word into a target grammatical feature vector and converting the target request word into a target request feature vector comprises: Converting the plurality of target attack words into a plurality of target grammatical word feature vectors, and determining a target grammatical feature vector according to the plurality of target grammatical feature vectors; The target request word is converted into a plurality of target request word feature vectors, and the target request feature vector is obtained according to the plurality of target request word feature vectors.
3. The method according to claim 2, characterized in that The step of determining the target grammar feature vector according to the plurality of target grammar word feature vectors comprises: Encoding and then decoding the plurality of target grammatical word feature vectors to obtain the target grammatical feature vector; The step of obtaining the target request feature vector according to the plurality of target request word feature vectors comprises: The multiple target request word feature vectors are encoded and then decoded to obtain the target request feature vector.
4. The method according to claim 1, characterized in that: The obtaining of the semantic similarity of the target grammatical feature vector and the target request feature vector includes: Calculating a cosine distance between the target grammatical feature vector and the target request feature vector; The semantic similarity between the target grammatical feature vector and the target request feature vector is determined according to the cosine distance.
5. The method according to claim 1, characterized in that The determining the attack risk of the resource request according to the semantic similarity includes: When the semantic similarity is greater than or equal to a similarity threshold, it is determined that the resource request has an attack risk.
6. A risk determination device, characterized in that: The device comprises: A resource request acquisition module, used to acquire a resource request; wherein the resource request includes a plurality of request words; A target request word acquisition module, used to extract the target request word in the resource request; wherein the multiple request words include multiple target request words, and the grammatical type of the target request words is a target grammatical type; A feature vector conversion module, used to construct a target grammar attack library corresponding to the target grammar type, wherein the target grammar attack library contains target attack words, converts the target attack words into target grammar feature vectors, and converts the target request words into target request feature vectors; A risk determination module, used to obtain a keyword weight corresponding to each target request feature sub-vector in the target request feature vector; wherein the target request feature vector includes a plurality of target request feature sub-vectors; Determining a keyword weight corresponding to the target request feature subvector according to the relevant information of the target request feature subvector; wherein the relevant information of the target request feature subvector includes one or more of occurrence frequency information, execution feasibility information, and attack impact degree information; Furthermore, the semantic similarity of the target grammatical feature vector and the target request feature vector is determined according to the target request feature subvector, the keyword weight corresponding to the target request feature subvector and the target grammatical feature vector, and the attack risk of the resource request is determined according to the semantic similarity.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. An electronic device, characterized in that: include: one or more processors; as well as The memory is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Structured query language SQL injection detection method and device
CN110362597A
Vulnerability matching method and device, computer equipment and readable storage medium
CN112528294A
Vulnerability attack detection method and equipment based on deep learning
CN113596007A
