Protection patch generation method, system, device and storage medium

By obtaining the attack request and source code, identifying code characteristics and generating parameter constraints, combined with the multi-level matching mechanism to intercept attacks, the problem of weak generalization ability of RASP engine protection patch rules is solved, the false negative rate is significantly reduced, and the application system is improved. security.

CN115455425BActive Publication Date: 2024-08-27CHINA TELECOM CORP LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202211111351.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-13
Publication Date
2024-08-27
Estimated Expiration
2042-09-13

AI Technical Summary

Technical Problem

The protection patch rules of the existing runtime application self-protection (RASP) engine have weak generalization capabilities, resulting in a high rate of missed attack interceptions and the inability to effectively identify and intercept attacks targeting vulnerable code.

Method used

By obtaining the attack request information and the source code of the target application, code feature identification and defect detection are performed, parameter constraints are generated, protection patches are generated based on the attack request information, and a multi-level matching mechanism (exact matching and fuzzy matching) is used to intercept attack requests.

Benefits of technology

It improves the accuracy of attack identification, reduces the false negative rate of RASP engine patch rule interception, and enhances the security of the application system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115455425B
    Figure CN115455425B
Patent Text Reader

Abstract

The present invention provides a protection patch generation method, system, device and storage medium, the method comprising the steps of: obtaining attack request information and source code of a target application corresponding to the attack request information; obtaining associated code information corresponding to the attack request information according to the source code; obtaining defect detection results of the source code according to the attack request information and the associated code information; generating parameter constraints according to the defect detection results; generating a protection patch according to the attack request information and the parameter constraints; the present invention reduces the underreporting rate of RASP engine patch rule interception, which is beneficial to ensuring the security of the web application system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a protection patch generation method, system, device and storage medium. Background Art

[0002] A common solution for web application security protection is to use the Runtime Application Self-Protection (RASP) engine. The weak generalization of patch rules is one of the difficulties in the detection of the Runtime Application Self-Protection (RASP) engine. The weak generalization of patch rules will lead to a high rate of missed attacks, threatening the security of the application system.

[0003] Currently, the generation of protective patches in runtime applications is usually achieved by considering the precise constraint configuration of the three fields of the URL (Uniform Resource Locator), Parameter, and Header of the identified attack request. However, when generating patches, a large number of application code features are often involved. This method cannot identify code features and comprehensively and accurately generate relevant patches for vulnerable codes, that is, for defective codes, resulting in a high underreporting rate of attack interception.

[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 application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] In view of the problems in the prior art, the purpose of the present invention is to provide a protection patch generation method, system, device and storage medium to reduce the false negative rate of RASP engine patch rule interception.

[0006] To achieve the above object, the present invention provides a method for generating a protective patch, the method comprising the following steps:

[0007] Obtaining attack request information and source code of a target application corresponding to the attack request information;

[0008] According to the source code, obtaining associated code information corresponding to the attack request information;

[0009] Acquire a defect detection result of the source code according to the attack request information and the associated code information;

[0010] generating parameter constraints according to the defect detection results;

[0011] A protection patch is generated according to the attack request information and the parameter constraint condition.

[0012] Optionally, generating a protection patch according to the attack request information and the parameter constraint condition includes:

[0013] Extracting attack parameter keywords according to the attack request information;

[0014] A protection patch is generated according to the attack parameter keywords and the parameter constraints.

[0015] Optionally, the protection patch includes a plurality of first reference fields; the method further includes the steps of:

[0016] Extracting a to-be-matched field combination according to the attack request information; the to-be-matched field combination includes a plurality of to-be-matched fields;

[0017] Performing a primary match between the to-be-matched field combination and the first reference field to determine whether the match is successful;

[0018] If the first-level match is successful, the corresponding attack request is intercepted.

[0019] Optionally, the protection patch further includes at least one second reference field; the method further includes the steps of:

[0020] If the primary matching fails, performing a secondary matching based on a target to-be-matched field in the to-be-matched field combination and a plurality of second reference fields in the protection patch;

[0021] If the secondary match is successful, the corresponding attack request is intercepted.

[0022] Optionally, performing secondary matching based on a target to-be-matched field in the to-be-matched field combination and a plurality of second reference fields in the protection patch includes:

[0023] Based on the constraint solver, it is determined whether the target field to be matched is a solution after the intersection operation of the multiple second reference fields; if so, the secondary matching is successful; otherwise, the secondary matching fails.

[0024] Optionally, acquiring, according to the source code, associated code information corresponding to the attack request information includes:

[0025] Extracting attack interface information according to the attack request information;

[0026] Extracting attack parameter keywords according to the attack request information includes:

[0027] Attack parameter keywords are extracted based on the attack interface information.

[0028] Optionally, extracting attack interface information according to the attack request information includes:

[0029] Obtain attack protection log data of the preset security protection engine;

[0030] Attack interface information associated with the attack request information is extracted from the attack protection log data.

[0031] Optionally, the attack interface information includes original request parameter information and attack execution call parameter information; and extracting attack parameter keywords according to the attack interface information includes:

[0032] Performing word segmentation processing on the original request parameter information to obtain a word segmentation list;

[0033] According to the attack execution call parameter information, the word list is screened to obtain the target word;

[0034] Extract keywords from the target word segmentation as attack parameter keywords.

[0035] Optionally, acquiring the defect detection result of the source code according to the attack request information and the associated code information includes:

[0036] Acquire target call chain information according to the attack request information and the associated code information;

[0037] Generate a code flow graph according to the associated code information;

[0038] According to the associated code information and the target call chain information, a path search is performed in the code flow graph to obtain a plurality of initial feasible path information;

[0039] According to the attack request information, a target feasible path is obtained by screening the multiple pieces of initial feasible path information, and a defective code fragment corresponding to the target feasible path is obtained.

[0040] Optionally, acquiring target call chain information according to the attack request information and the associated code information includes:

[0041] Extracting first call chain information according to the attack request information;

[0042] Extracting and obtaining second call chain information according to the associated code information;

[0043] Based on the first call chain information, target call chain information is obtained by matching from the second call chain information.

[0044] Optionally, each piece of initial feasible path information corresponds to an initial parameter constraint condition; the method includes:

[0045] Obtaining initial parameter constraints corresponding to the target feasible path as target parameter constraints;

[0046] The step of generating a protection patch according to the attack request information and the parameter constraint condition includes:

[0047] A protection patch is generated according to the attack request information and the target parameter constraint condition.

[0048] Optionally, acquiring, according to the source code, associated code information corresponding to the attack request information includes:

[0049] Extracting attack interface information according to the attack request information;

[0050] According to the source code, associated code information corresponding to the attack interface information is obtained.

[0051] Optionally, generating a protection patch according to the attack parameter keyword and the parameter constraint condition includes:

[0052] The attack parameter keywords and the parameter constraints are filled into a preset patch template to generate a protection patch.

[0053] The present invention also provides a protection patch generation system for implementing the above protection patch generation method, the system comprising:

[0054] An attack request analysis module, which obtains attack request information and source code of a target application corresponding to the attack request information;

[0055] An associated code information acquisition module, which acquires associated code information corresponding to the attack request information according to the source code;

[0056] A vulnerability analysis module, which obtains defect detection results of the source code according to the attack request information and the associated code information;

[0057] A parameter constraint condition generation module generates parameter constraint conditions according to the defect detection result;

[0058] The protection patch generation module generates a protection patch according to the attack request information and the parameter constraint condition.

[0059] The present invention also provides a protective patch generating device, comprising:

[0060] processor;

[0061] a memory in which an executable program of the processor is stored;

[0062] The processor is configured to execute any one of the steps of the above-mentioned protection patch generation method by executing the executable program.

[0063] The present invention also provides a computer-readable storage medium for storing a program, wherein the program, when executed by a processor, implements the steps of any one of the above-mentioned protection patch generation methods.

[0064] Compared with the prior art, the present invention has the following advantages and outstanding effects:

[0065] The protection patch generation method, system, device and storage medium provided by the present invention identify and fuse code features based on attack request information and associated code information to obtain code defect detection results; then obtain parameter constraints, and combine the analysis and processing of the attack request information to generate a protection patch, which can help improve the accuracy of attack identification, thereby reducing the underreporting rate of RASP engine patch rule interception. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Other features, objectives and advantages of the present invention will become more apparent from a reading of the detailed description of non-limiting embodiments made with reference to the following accompanying drawings.

[0067] Figure 1 A schematic diagram of a method for generating a protective patch in the prior art;

[0068] Figure 2 A schematic diagram of a method for generating a protective patch disclosed in an embodiment of the present invention;

[0069] Figure 3 A flowchart of obtaining defect detection results disclosed in an embodiment of the present invention;

[0070] Figure 4 A schematic diagram of step S230 in a method for generating a protective patch disclosed in an embodiment of the present invention;

[0071] Figure 5 A schematic diagram of a process of performing path search in a code flow graph in a protection patch generation method disclosed in an embodiment of the present invention;

[0072] Figure 6 The present invention is a flowchart of generating a protection patch in a protection patch generating method disclosed in an embodiment of the present invention.

[0073] Figure 7 A schematic diagram of step S250 in a method for generating a protective patch disclosed in an embodiment of the present invention;

[0074] Figure 8A schematic diagram of a method for generating a protective patch disclosed in another embodiment of the present invention;

[0075] Fig. 9 A schematic diagram of the structure of a protective patch generation system disclosed in an embodiment of the present invention;

[0076] Fig.10 A schematic diagram of the structure of a vulnerability analysis module in a protection patch generation system disclosed in an embodiment of the present invention;

[0077] Fig.11 A schematic diagram of the structure of a protection patch generation module in a protection patch generation system disclosed in an embodiment of the present invention;

[0078] Fig.12 A schematic diagram of a protective patch generation system disclosed in another embodiment of the present invention;

[0079] Fig.13 A schematic diagram of the structure of a protective patch generating device disclosed in an embodiment of the present invention; DETAILED DESCRIPTION

[0080] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in the present application. The present application can also be implemented or applied through other different specific implementation methods, and the details in the present application can also be modified or changed in various ways according to different viewpoints and application systems without departing from the spirit of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0081] The following is a detailed description of the embodiments of the present application with reference to the accompanying drawings so that those skilled in the art can easily implement the present application. The present application can be embodied in a variety of different forms and is not limited to the embodiments described herein.

[0082] In the representations of the present application, the representations with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" etc. mean that the specific features, structures, materials or characteristics represented in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the represented specific features, structures, materials or characteristics may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples represented in the present application and the features of the different embodiments or examples, unless they contradict each other.

[0083] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the representation of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0084] In order to clearly describe the present application, components irrelevant to the description are omitted, and the same reference symbols are given to the same or similar components throughout the specification.

[0085] Throughout the specification, when a device is said to be "connected" to another device, this includes not only the case of "direct connection" but also the case of "indirect connection" by placing other elements therebetween. In addition, when a device is said to "include" a certain component, unless otherwise stated, it does not exclude other components, but means that other components may be included.

[0086] When a device is said to be "on" another device, it may be directly on the other device, but there may also be other devices between it. In contrast, when a device is said to be "directly" on another device, there are no other devices between it.

[0087] Although the terms first, second, etc. are used to represent various elements in some examples, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, the first interface and the second interface, etc. are represented. Moreover, as used in this article, the singular forms "one", "one" and "the" are intended to also include plural forms, unless there is an opposite indication in the context. It should be further understood that the terms "comprising" and "including" indicate the existence of features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the existence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Therefore, "A, B or C" or "A, B and / or C" means "any of the following: A; B; C; A and B; A and C; B and C; A, B and C". Only when the combination of elements, functions, steps or operations is inherently mutually exclusive in some way, will there be an exception to this definition.

[0088] The technical terms used herein are only used to refer to specific embodiments and are not intended to limit the present application. The singular form used herein also includes the plural form unless the sentence clearly indicates the contrary meaning. The meaning of "including" used in the specification is to specify specific characteristics, regions, integers, steps, operations, elements and / or components, and does not exclude the existence or addition of other characteristics, regions, integers, steps, operations, elements and / or components.

[0089] Although not defined differently, all terms, including technical and scientific terms used herein, have the same meaning as those generally understood by those skilled in the art to which this application belongs. Terms defined in commonly used dictionaries are additionally interpreted as having meanings consistent with the relevant technical literature and the contents of the current disclosure, and unless defined, shall not be overly interpreted as ideal or very formal meanings.

[0090] Example embodiments will now be described more fully in conjunction with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated description will be omitted.

[0091] When a user accesses a web application, an access request is sent to it. At this time, it is necessary to determine whether the access request is an external attack to protect the security of the web application. If it is not an external attack, it is a normal behavior and is released. If it is an external attack, it is a malicious behavior and is intercepted. In this way, the application will only respond to normal requests, thereby achieving the purpose of protecting the application. In order to achieve this purpose, the present invention discloses the following protection patch generation method.

[0092] like Figure 1 As shown, the current existing protection patch generation method includes the steps of:

[0093] S110, obtaining historical attack request information, that is, obtaining information of attack requests that have been determined in historical accesses.

[0094] S120, extracting URL, Parameter, and Header field information, that is, extracting URL, Parameter, and Header field information of the determined attack request.

[0095] S130, configuring interception rules based on URL, Parameter, and Header field information.

[0096] S140, generating a rule base, that is, generating a rule base based on the interception rules configured above, and the rule base includes a plurality of patch rules generated by the configuration above.

[0097] S150, receiving a user request.

[0098] S160, based on the exact match of the rule base. That is, extract the URL, Parameter, and Header field information in the user request, and match these field information in the user request with each patch rule in the rule base. When the three field information of URL, Parameter, and Header in a patch rule are the same, it is a successful match. Otherwise, it is a failed match with the rule base.

[0099] S170, responding to the user request. When the exact match succeeds, the user request is intercepted. When the exact match fails, the user request is released.

[0100] On the one hand, the existing methods are only based on precise matching of the rule base, and do not generate relevant patches for the vulnerable code related to the attack entry, resulting in the inability to intercept other similar attacks and increasing the false negative rate. On the other hand, the existing methods only configure rules for the three fields of attack URL, Parameter, and Header, and the generalization ability of the rules is weak.

[0101] like Figure 2 As shown, an embodiment of the present invention discloses a method for generating a protective patch, the method comprising the following steps:

[0102] S210, obtain attack request information, and the source code of the target application corresponding to the above attack request information. Specifically, the attack request is identified by the RASP engine. After the attack request is identified, the corresponding attack request information is obtained. The attack request may be a request issued by a user to access a target web application. The attack request information may include information such as the request address and request parameters of the corresponding attack request. The above target application is the target web application that the user requests to access, and the request address is the address of the target web application. Exemplarily, the obtained partial fragment of the source code may be as follows:

[0103]

[0104] S220, according to the source code, obtain the associated code information corresponding to the attack request information. Specifically, S220 includes:

[0105] S221, extracting attack interface information according to the attack request information.

[0106] S222: Acquire associated code information corresponding to the attack interface information according to the source code.

[0107] Specifically, according to the above attack request information, the attack entry is obtained, that is, the API (Application Programming Interface) called by the attack request is obtained, and then the information associated with the called API is obtained, that is, the attack interface information, that is, the attack details. In specific implementation, the attack protection log data of the preset security protection engine can be obtained first. Then the attack interface information is directly extracted from the above attack protection log data.

[0108] In this embodiment, the attack interface information may include the first call chain information, the original request parameter information and the attack execution call parameter information, and may also include the attack URL, attack parameters, attack type, etc., which are not limited in this application. The first call chain information is the dynamic method call chain of the attack.

[0109] The above-mentioned associated code information is the static context information of the API called by the attack in the above-mentioned source code. In specific implementation, data flow and control flow analysis can be performed based on the source code of the application to obtain the above-mentioned code static context information. The associated code information may include API information, parameter information, method call chain information, etc. For example, the following Table 1 shows an example of attack interface information, as well as the field names and field values ​​it contains:

[0110] Table 1 Attack interface information

[0111] Attack URL Attack Parameters Attack call chain Attack Types .. / foo s="sh test.sh" Line 1-3-4 Command Execution

[0112] As shown in Table 1, in the attack interface information, the field value corresponding to the field attack URL is ".. / foo", the field value corresponding to the field attack parameter is s="sh test.sh", the field value corresponding to the field attack call chain is Line 1-3-4, and the field value corresponding to the field attack type is command execution. The field attack call chain is the first call chain information mentioned above.

[0113] S230, according to the above attack request information and the above associated code information, obtain the defect detection result of the above source code. Specifically, this step is to perform vulnerability analysis on the source code according to the attack interface information and the above associated code information, and obtain the vulnerable surface information of the source code, which is the defect detection result. Figure 3 As shown, the process of obtaining the above defect detection results is disclosed. According to the process, the above step S230 may include:

[0114] S231, obtaining attack request information 31.

[0115] S232, extract attack interface information 32 from the attack request information.

[0116] S233, obtaining the source code 33 of the target application.

[0117] S234, obtaining static context information 34 of the attack API, wherein the attack API is extracted from the attack request information.

[0118] S235 , performing vulnerability analysis in combination with the attack interface information 32 and the static context information 34 , and obtaining a defect detection result 35 .

[0119] like Figure 4 As shown, during specific implementation, in some embodiments, this step may include:

[0120] S236: Extract the first call chain information according to the attack request information.

[0121] S237: Extract and obtain second call chain information based on the above-mentioned associated code information.

[0122] S238, based on the first call chain information, obtain target call chain information by matching from the second call chain information.

[0123] S239, generating a code flow graph according to the above-mentioned associated code information.

[0124] S330, performing a path search in the code flow graph according to the associated code information and the target call chain information, and obtaining a plurality of initial feasible path information.

[0125] S331, according to the attack request information, a target feasible path is obtained from the multiple initial feasible path information, and a defective code fragment corresponding to the target feasible path is obtained.

[0126] Specifically, since the attack interface information and the associated code information both contain their own method call chain information, the first call chain information and the second call chain information can be extracted respectively. For example, the first call chain information can be one piece, and the second call chain information can be four pieces. Then, the two are matched, and the second call chain information that successfully matches the first call chain information is used as the target call chain information. Then, based on the attack URL, attack parameters, attack type, etc. contained in the attack interface information, multiple initial feasible path information is screened. The multiple initial feasible path information that are successfully matched are used as target feasible paths. Exemplarily, the flowchart for path search in the code flow graph can be referenced. Figure 5 . Figure 5 The left arrow in the diagram flows in one direction, and the right arrow in the diagram flows in another direction.

[0127] In this embodiment, the above defect detection result may include the above target feasible path, vulnerable URL, parameters, etc. in addition to the above defect code snippet. This application does not limit this. For example, the following Table 2 shows an example of a defect detection result, as well as the field names and field values ​​it contains:

[0128] Table 2 Defect detection results

[0129] Vulnerable URLs Fragile parameter constraints Vulnerable Path Is it a vulnerable path? .. / foo s.length>MAX Line 1-3-4 yes .. / foo s.length<MIN Line 1-3-6 yes .. / foo / Line 1-3-8 no

[0130] As shown in Table 2, the defect detection result includes four fields and their corresponding field values. The four fields are vulnerable URL, vulnerable parameter constraint, vulnerable path, and whether it is a vulnerable path.

[0131] S240, generating parameter constraints based on the above defect detection results. Specifically, each initial feasible path information corresponds to an initial parameter constraint. The initial parameter constraint corresponding to each initial feasible path information can be extracted from the above associated code information, i.e., the static context information. Then, the initial parameter constraint corresponding to the above target feasible path is used as the final parameter constraint, i.e., the target parameter constraint.

[0132] S250: Generate a protection patch based on the attack request information and the parameter constraints. Figure 6 As shown, the generation process of the above protection patch is disclosed. According to the process, it can be seen that: according to the attack interface information 36 in the attack request information, the attack parameter keyword 37 can be extracted. According to the defect detection result 35, the parameter constraint condition 38 is obtained. According to the attack parameter keyword 37 and the parameter constraint condition 38, the protection patch 39 can be obtained.

[0133] Accordingly, the above step S250 may include:

[0134] S251, obtaining attack interface information in the attack request information.

[0135] S252: Extract attack parameter keywords based on the above attack interface information.

[0136] S253: Generate a protection patch according to the above attack parameter keywords and target parameter constraints.

[0137] Specifically, this step can fill the above-mentioned attack parameter keywords and the above-mentioned parameter constraints into a preset patch template to generate a protection patch.

[0138] Exemplarily, the following Table 3 illustrates a generated protection patch, as well as the field names and field values ​​contained therein:

[0139] Table 3 Protective patches

[0140] URL Parameter Parameter Value Header Keywords Parameter constraints .. / foo s / / sh s.length>MAX or s.length<MIN

[0141] As shown in Table 3, the patch rule, i.e., the protection patch, includes six fields and their corresponding field values. The six fields are URL, Parameter, Parameter Value, Header, Keyword, and Parameter Constraint.

[0142] like Figure 7 As shown, in some embodiments, the above step S252 may include:

[0143] S2521, perform word segmentation processing on the original request parameter information in the attack interface information to obtain a word segmentation list.

[0144] S2522, filter the above word list according to the attack execution call parameter information in the attack interface information to obtain the target word.

[0145] S2523, extracting keywords from the above target word segmentation as attack parameter keywords.

[0146] In specific implementation, the token list obtained after word segmentation processing is the above-mentioned word segmentation list, and the word segmentation that successfully matches the above-mentioned attack execution call parameter information is used as the target word segmentation. Among them, the word segmentation algorithm used in the word segmentation processing can be implemented based on the existing technology, and this embodiment will not be repeated.

[0147] In another embodiment of the present application, another method for generating a protection patch is disclosed. The method can be used to intercept attacks. Figure 2 Based on the corresponding embodiment, the generated protection patch includes multiple first reference fields and at least one second reference field.

[0148] like Figure 8 As shown, in this embodiment, the disclosed method further includes the steps of:

[0149] S260: Extract a combination of fields to be matched based on the attack request information. The combination of fields to be matched includes multiple fields to be matched.

[0150] S270, the above-mentioned combination of fields to be matched and the above-mentioned first reference field are matched at the first level to determine whether the first level match is successful. That is, as long as the field value corresponding to each first reference field is the same as the field value corresponding to the corresponding field to be matched in the combination of fields to be matched, the match is successful. Otherwise, the match fails. The first level match is an exact match.

[0151] If the first-level match is successful, step S280 is executed: intercepting the corresponding attack request.

[0152] If the primary matching fails, step S290 is executed: performing secondary matching based on a target to-be-matched field in the to-be-matched field combination and a plurality of second reference fields in the protection patch to determine whether the secondary matching is successful.

[0153] If the secondary match is successful, the above step S280 is executed: intercepting the corresponding attack request.

[0154] If the secondary matching fails, step S300 is executed: the attack request is allowed.

[0155] That is, as long as the field value corresponding to the target to-be-matched field belongs to one of the solutions after a preset operation of the plurality of second reference fields, the match is successful. Otherwise, the match fails. This secondary match is a fuzzy match.

[0156] Exemplarily, in step S290, the constraint solver is used to determine whether the target field to be matched is a solution after the intersection operation of the multiple second reference fields is performed; if so, the secondary matching is successful; otherwise, the secondary matching fails.

[0157] Exemplarily, this embodiment provides an example: each of the to-be-matched fields in the above-mentioned to-be-matched field combination may be URL, Parameter, and Header, respectively. The second reference field also has these three fields: URL, Parameter, and Header. Then, the field values ​​of each of the same fields are compared to see if they are the same, that is, an exact match of the traditional rules is performed. If they are the same, the match is successful, and the attack request is directly intercepted.

[0158] Otherwise, fuzzy matching will be performed based on the obtained field value of the field Parameter to be matched, the field keyword in the protection patch, and the field value of the parameter constraint. For example, set Parameter to P, the keyword to K, and the parameter constraint to C, and use the constraint solver to determine whether P∈K∩ holds. If it holds, it means that P is a solution of K∩C, indicating that the fuzzy matching is successful. Otherwise, it means that P is not a solution of K∩C, indicating that the fuzzy matching fails.

[0159] Therefore, the present disclosure performs interception based on two-level matching, with a higher interception success rate and a lower false negative rate, which is beneficial to improving the security performance of the application system.

[0160] The present invention obtains code vulnerability information by performing code vulnerability analysis; obtains attack parameter keywords and parameter constraints through word segmentation processing and vulnerability surface information extraction, and generates patch rules in combination with the keywords and constraints; performs rule-based precise matching and fuzzy matching in succession for user-initiated requests; and improves the generalization capability of patch rules in the RASP engine, thereby solving the problem of high missed reporting rate of patch rule interception in the RASP engine.

[0161] It should be noted that all the above embodiments disclosed in this application can be freely combined, and the technical solutions obtained after the combination are also within the protection scope of this application.

[0162] like Fig. 9 As shown, an embodiment of the present invention further discloses a protective patch generation system 9, which includes:

[0163] The attack request analysis module 91 obtains the attack request information and the source code of the target application corresponding to the attack request information.

[0164] The associated code information acquisition module 92 acquires the associated code information corresponding to the attack request information according to the source code.

[0165] The vulnerability analysis module 93 obtains the defect detection result of the source code according to the attack request information and the associated code information.

[0166] The parameter constraint condition generating module 94 generates parameter constraint conditions according to the above defect detection results.

[0167] The protection patch generation module 95 generates a protection patch according to the attack request information and the parameter constraint conditions.

[0168] It can be understood that the protection patch generation system of the present invention also includes other existing functional modules that support the operation of the protection patch generation system. Fig. 9 The protective patch generation system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0169] The protection patch generation system in this embodiment is used to implement the above-mentioned protection patch generation method. Therefore, the specific implementation steps of the protection patch generation system can refer to the above-mentioned description of the protection patch generation method, which will not be repeated here.

[0170] Another embodiment of the present invention also discloses a protective patch generation system, such as Fig.10 As shown in the above Fig. 9 Based on the corresponding embodiment, the vulnerability analysis module 93 includes:

[0171] The first extraction unit 931 extracts the first call chain information according to the attack request information.

[0172] The second extraction unit 932 extracts the second call chain information according to the above-mentioned associated code information.

[0173] The call chain matching unit 933 matches the target call chain information from the second call chain information based on the first call chain information.

[0174] The code flow graph generating unit 934 generates a code flow graph according to the above-mentioned associated code information.

[0175] The initial feasible path acquisition unit 935 performs a path search in the code flow graph according to the associated code information and the target call chain information to obtain multiple pieces of initial feasible path information.

[0176] The target feasible path acquisition unit 936 selects a target feasible path from the multiple pieces of initial feasible path information according to the attack request information, and acquires a defective code fragment corresponding to the target feasible path.

[0177] Another embodiment of the present invention also discloses a protective patch generation system, such as Fig.11 As shown in the above Fig. 9 Based on the corresponding embodiment, the protection patch generation module 95 includes:

[0178] The attack interface acquisition unit 951 acquires the attack interface information in the attack request information.

[0179] The word segmentation list acquisition unit 952 performs word segmentation processing on the original request parameter information in the attack interface information to obtain a word segmentation list.

[0180] The target segmentation acquisition unit 953 filters the segmentation list according to the attack execution call parameter information in the attack interface information to obtain the target segmentation.

[0181] The parameter keyword acquisition unit 954 extracts the keywords in the target word segmentation as attack parameter keywords.

[0182] The patch acquisition unit 955 generates a protection patch according to the above attack parameter keywords and target parameter constraints.

[0183] like Fig.12 As shown, another embodiment of the present invention further discloses a protective patch generation system 12. Fig. 9 On the basis of the corresponding embodiment, it also includes:

[0184] The to-be-matched field combination acquisition module 96 extracts and obtains the to-be-matched field combination according to the above attack request information. The above to-be-matched field combination includes multiple to-be-matched fields.

[0185] The first-level matching module 97 performs a first-level matching on the above-mentioned combination of fields to be matched and the above-mentioned first reference field, and determines whether the first-level matching is successful. That is, as long as the field value corresponding to each first reference field is the same as the field value corresponding to the corresponding field to be matched in the combination of fields to be matched, the matching is successful. Otherwise, the matching fails. The first-level matching is an exact match.

[0186] If the first-level match is successful, the interception module 98 is executed to intercept the corresponding attack request.

[0187] If the primary matching fails, the secondary matching module 99 is executed: a secondary matching is performed based on a target to-be-matched field in the to-be-matched field combination and a plurality of second reference fields in the protection patch to determine whether the secondary matching is successful.

[0188] If the secondary match is successful, the above-mentioned interception module 98 is executed to intercept the corresponding attack request.

[0189] If the secondary matching fails, the release module 100 is executed to release the attack request.

[0190] That is, as long as the field value corresponding to the target to-be-matched field belongs to one of the solutions after a preset operation of the plurality of second reference fields, the match is successful. Otherwise, the match fails. This secondary match is a fuzzy match.

[0191] An embodiment of the present invention further discloses a protection patch generating device, comprising a processor and a memory, wherein the memory stores an executable program of the processor; the processor is configured to execute the steps in the above protection patch generating method by executing the executable program. Fig.13 Schematic diagram of the structure of the protective patch generating device disclosed in the present invention. Fig.13 The electronic device 600 according to this embodiment of the present invention is described. Fig.13 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0192] like Fig.13 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0193] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps according to various exemplary embodiments of the present invention described in the above protection patch generation method section of this specification. For example, the processing unit 610 can execute the following steps: Figure 2 Follow the steps shown in .

[0194] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0195] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 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.

[0196] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0197] The electronic device 600 may also communicate with one or more external devices 700 (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 600, and / or communicate with any device that enables the electronic device 600 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 650. Furthermore, the electronic device 600 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 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. 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 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.

[0198] The present invention also discloses a computer-readable storage medium for storing a program, which implements the steps in the above-mentioned protection patch generation method when executed. In some possible implementations, various aspects of the present invention 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 of various exemplary implementations of the present invention described in the above-mentioned protection patch generation method of this specification.

[0199] As shown above, when the program of the computer-readable storage medium of this embodiment is executed, code feature recognition and analysis are performed based on the attack request information and the associated code information to obtain code defect detection results; then parameter constraints are obtained, and protection patches are generated in combination with the analysis and processing of the attack request information, and user attack request interception is implemented by combining patch-based precise matching and fuzzy matching, thereby improving the generalization ability of protection patches in the RASP engine, thereby reducing the underreporting rate of patch rule interception in the RASP engine.

[0200] An embodiment of the present invention discloses a computer-readable storage medium. The storage medium is a program product for implementing the above method, which can be a portable compact disk read-only memory (CD-ROM) and includes program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0201] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0202] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium 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, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0203] Program code for performing the operations of the present invention 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 the case of 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).

[0204] The protection patch generation method, system, device and storage medium provided in the embodiments of the present invention, on the one hand, identify and fuse code features based on attack request information and associated code information to obtain code defect detection results; then obtain parameter constraints, and generate protection patches in combination with analysis and processing of the attack request information, which can help improve the accuracy of attack identification; on the other hand, after using multiple fields to be matched for precise matching, a target field to be matched and multiple second reference fields in the patch rule are used for fuzzy matching, which improves the generalization ability of the protection patch in the RASP engine; thereby reducing the underreporting rate of the RASP engine patch rule interception, which is beneficial to ensuring the security of the web application system.

[0205] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A method for generating a protective patch, It is characterized in that The following steps are involved: Obtaining attack request information and source code of a target application corresponding to the attack request information; According to the source code, obtaining associated code information corresponding to the attack request information; Acquire the defect detection result of the source code according to the attack request information and the associated code information, including acquiring target call chain information according to the attack request information and the associated code information; Generate a code flow graph according to the associated code information; According to the associated code information and the target call chain information, a path search is performed in the code flow graph to obtain a plurality of initial feasible path information; according to the attack request information, a target feasible path is screened from the plurality of initial feasible path information, and a defective code fragment corresponding to the target feasible path is obtained; generating parameter constraints according to the defect detection results; A protection patch is generated according to the attack request information and the parameter constraint condition.

2. The protective patch generation method according to claim 1, It is characterized in that The step of generating a protection patch according to the attack request information and the parameter constraint condition includes: Extracting attack parameter keywords according to the attack request information; A protection patch is generated according to the attack parameter keywords and the parameter constraints.

3. The protective patch generation method according to claim 1, It is characterized in that The protection patch includes a plurality of first reference fields; the method further includes the steps of: Extracting a to-be-matched field combination according to the attack request information; the to-be-matched field combination includes a plurality of to-be-matched fields; Performing a primary match between the to-be-matched field combination and the first reference field to determine whether the match is successful; If the first-level match is successful, the corresponding attack request is intercepted.

4. The protective patch generation method according to claim 3, It is characterized in that The protection patch also includes at least one second reference field; the method also includes the steps of: If the primary matching fails, performing a secondary matching based on a target to-be-matched field in the to-be-matched field combination and a plurality of second reference fields in the protection patch; If the secondary match is successful, the corresponding attack request is intercepted.

5. The protective patch generation method according to claim 4, It is characterized in that The performing secondary matching based on a target to-be-matched field in the to-be-matched field combination and a plurality of second reference fields in the protection patch includes: Based on the constraint solver, it is determined whether the target field to be matched is a solution after the intersection operation of the multiple second reference fields; if so, the secondary matching is successful; otherwise, the secondary matching fails.

6. The protective patch generation method according to claim 2, It is characterized in that The step of obtaining, according to the source code, associated code information corresponding to the attack request information includes: Extracting attack interface information according to the attack request information; Extracting attack parameter keywords according to the attack request information includes: Attack parameter keywords are extracted based on the attack interface information.

7. The protective patch generation method according to claim 6, It is characterized in that The step of extracting attack interface information according to the attack request information includes: Obtain attack protection log data of the preset security protection engine; Attack interface information associated with the attack request information is extracted from the attack protection log data.

8. The protective patch generation method according to claim 7, It is characterized in that The attack interface information includes original request parameter information and attack execution call parameter information; the attack parameter keywords are extracted according to the attack interface information, including: Performing word segmentation processing on the original request parameter information to obtain a word segmentation list; According to the attack execution call parameter information, the word list is screened to obtain the target word; Extract keywords from the target word segmentation as attack parameter keywords.

9. The protective patch generation method according to claim 1, It is characterized in that The step of acquiring target call chain information according to the attack request information and the associated code information includes: Extracting first call chain information according to the attack request information; Extracting and obtaining second call chain information according to the associated code information; Based on the first call chain information, target call chain information is obtained by matching from the second call chain information.

10. The protective patch generation method according to claim 1, It is characterized in that Each of the initial feasible path information corresponds to an initial parameter constraint condition; the method comprises: Obtaining initial parameter constraints corresponding to the target feasible path as target parameter constraints; The step of generating a protection patch according to the attack request information and the parameter constraint condition includes: A protection patch is generated according to the attack request information and the target parameter constraint condition.

11. The protective patch generation method according to claim 1, It is characterized in that The step of obtaining, according to the source code, associated code information corresponding to the attack request information includes: Extracting attack interface information according to the attack request information; According to the source code, associated code information corresponding to the attack interface information is obtained.

12. The protective patch generation method according to claim 2, It is characterized in that The step of generating a protection patch according to the attack parameter keyword and the parameter constraint condition comprises: The attack parameter keywords and the parameter constraints are filled into a preset patch template to generate a protection patch.

13. A protection patch generation system, used to implement the protection patch generation method according to claim 1, It is characterized in that The system comprises: An attack request analysis module, which obtains attack request information and source code of a target application corresponding to the attack request information; An associated code information acquisition module, which acquires associated code information corresponding to the attack request information according to the source code; The vulnerability analysis module obtains the defect detection result of the source code according to the attack request information and the associated code information, including obtaining target call chain information according to the attack request information and the associated code information; generating a code flow graph according to the associated code information; performing path search in the code flow graph according to the associated code information and the target call chain information to obtain multiple initial feasible path information; screening a target feasible path from the multiple initial feasible path information according to the attack request information, and obtaining a defect code fragment corresponding to the target feasible path; A parameter constraint condition generation module generates parameter constraint conditions according to the defect detection result; The protection patch generation module generates a protection patch according to the attack request information and the parameter constraint condition.

14. A protective patch generating device, It is characterized in that include: processor; a memory in which an executable program of the processor is stored; The processor is configured to execute the steps of the protection patch generation method according to any one of claims 1 to 12 by executing the executable program.

15. A computer-readable storage medium for storing a program, It is characterized in that When the program is executed by a processor, the steps of the protection patch generation method described in any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • Safety defect identification system and method based on multiple features

    CN107862327A

  • Source code defect detection method and device

    CN112131120A

  • Method for acquiring data of Githhub open source platform and source code defect repairing system

    CN113127339A

  • Attack protection system based on RASP and application equipment

    CN114091039A

  • Security remediation

    US20140096257A1