A WAF bypass deployment system and method
By accurately extracting the message range and dynamic timeout mechanism of the WAF bypass deployment system that needs to be detected in traffic, the problem of excessive pressure on load-balanced WAF system and unstable service forwarding is solved, and efficient and independent WAF processing and service guarantee are achieved. .
Patent Information
- Application Number
- CN202211045771.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2042-08-30
AI Technical Summary
Load-balanced WAF causes excessive system pressure when mirroring all traffic to the WAF cluster and affects service forwarding when the WAF cluster fails.
By accurately extracting the range of messages that need to be detected in traffic, and using a dynamic timeout mechanism, it provides a WAF bypass deployment system, only the traffic required by users is handed over to WAF for processing, and through the timeout mechanism to ensure that service forwarding is not affected when the WAF cluster fails Influence.
It reduces the resource usage of WAF system, improves processing efficiency and independence, ensures that the service forwarding does not affect the failure of WAF cluster, and is suitable for a variety of scenarios.
Smart Images

Figure CN115529164B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of WAF deployment, and in particular to a WAF bypass deployment system and method. Background Art
[0002] There are currently two types of WAFs on the cloud: SaaS-type WAFs and load-balancing-type WAFs. The load-balancing WAF is configured by linking the domain name with the cloud vendor's seven-layer load balancing (listener) cluster to perform bypass threat detection and cleaning on the HTTP / HTTPS traffic that passes through the load balancing, thereby separating business forwarding and security protection. In this scenario, the LB needs to mirror the entire traffic to the WAF cluster and wait for the WAF cluster to feedback the trusted status to decide whether to release or intercept. In actual applications, the above methods have the following shortcomings: 1. For load-balancing WAFs, if the LB mirrors all traffic to the WAF cluster, it will bring huge pressure to the WAF system, and from the user's perspective, it may not be necessary for the WAF to process the traffic of all domain names, and not all message loads of the source station that needs to be protected need to be detected; 2. When there is a problem with the WAF cluster, it will affect business forwarding.
[0003] Therefore, how to provide a method to only hand over the traffic required by users to the WAF cluster for processing and not affect the normal forwarding of services when the WAF cluster fails has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] In view of this, in order to overcome the shortcomings of the prior art, the present invention provides a WAF bypass deployment system by accurately extracting the message range that needs to be detected in the traffic and setting a dynamic timeout mechanism that takes into account both large traffic and WAF detection, thereby improving the efficiency and independence of WAF bypass deployment.
[0005] In one aspect, the present invention provides a WAF bypass deployment system, comprising:
[0006] Client, used to send request messages to LB / Connector or receive response messages returned by LB / Connector;
[0007] LB / Connector, used to actively establish a TCP persistent connection with WAF, obtain the detection configuration of each domain name from WAF, directly forward or send the received request or response message to WAF according to the detection configuration of the domain name, and intercept or release the request or response message according to the time when the detection result is received and the detection result;
[0008] WAF is used to compile the detection rule set configured for domain name detection for the detection engine, detect the received request or response messages, and return the detection results to LB / Connector;
[0009] The source station is used to send the response message to the LB / Connector after receiving the request message.
[0010] Furthermore, in the WAF bypass deployment system of the present invention, LB / Connector is used to: generate a connection identifier after receiving a request message or a response message, extract the domain name from the request message, determine the domain name that needs to be detected according to the detection configuration of the domain name obtained from the WAF, extract the field to be detected at the corresponding position from the message that needs to be detected according to the corresponding domain name detection configuration, encapsulate the connection identifier and the field to be detected in the form of a private protocol and send them to the WAF, and use the API interface corresponding to the coroutine socket provided by OpenResty to set the timeout mechanism; directly release the request message that does not require domain name detection to the source station.
[0011] Furthermore, in the WAF bypass deployment system of the present invention, LB / Connector is also used for: if the detection result of the request message is received before the timeout, the request message is released to the source station or the request message is intercepted according to the detection result; if the detection result is not received before the timeout, the request message is released to the source station; if the detection result of the reply message is received before the timeout, the reply message is released to the client or the request message is intercepted according to the detection result; if the detection result is not received before the timeout, the reply message is released to the client.
[0012] Furthermore, in the WAF bypass deployment system of the present invention, the WAF is used to: receive and parse the encapsulated private protocol, extract the fields to be detected, use the detection engine to detect the fields to be detected, generate the detection results, encapsulate the connection identifier and the detection results in the form of a private protocol and return them to the LB / Connector.
[0013] Furthermore, in the WAF bypass deployment system of the present invention, extracting the field to be detected includes: extracting the domain name from the encapsulated private protocol, and corresponding the field to be detected to different detection rule sets according to different domain names.
[0014] 6. The WAF bypass deployment system according to claim 4 is characterized in that a detection engine is used to detect the field to be detected and generate a detection result, including: the detection engine matches the field to be detected through matching rules, returns a corresponding rule ID matching set according to the matched attack characteristics, and ANDs the returned rule ID matching set with the detection rule set configured by the domain name to generate a rule result set, and generates a corresponding attack log for each matching rule.
[0015] On the other hand, the present invention provides a WAF bypass deployment method, comprising:
[0016] Step S1: Send a request message to LB / Connector through the client;
[0017] Step S2: Obtain the detection configuration of each domain name from WAF through LB / Connector, and send the request message that needs to be detected by the domain name to WAF according to the detection configuration of the domain name;
[0018] Step S3: WAF detects the received request message and returns the detection result to LB / Connector;
[0019] Step S4: LB / Connector releases the request message to the source station or intercepts the request message according to the time and the detection result received;
[0020] Step S5: After receiving the request message, the source station returns a response message to the client.
[0021] Furthermore, step S2 of the method of the present invention comprises
[0022] Step S21: LB / Connector generates a connection identifier after receiving the request message;
[0023] Step S22: LB / Connector extracts the domain name from the request message, and determines the domain name to be detected according to the detection configuration of the domain name obtained from WAF;
[0024] Step S23: LB / Connector extracts the to-be-detected field at the corresponding position from the message that needs to be detected according to the corresponding domain name detection configuration;
[0025] Step S24: LB / Connector encapsulates the connection identifier and the field to be detected in the form of a private protocol and sends them to WAF, and sets a timeout mechanism.
[0026] Furthermore, in step S23 of the method of the present invention, a timeout mechanism is set using an API interface corresponding to the coroutine socket provided by OpenResty.
[0027] Furthermore, step S2 of the method of the present invention also includes: obtaining the detection configuration of each domain name from the WAF through the LB / Connector, and directly releasing the request message that does not require domain name detection to the source station according to the detection configuration of the domain name.
[0028] Furthermore, step S3 of the method of the present invention comprises:
[0029] Step S31: WAF receives and parses the encapsulated private protocol and extracts the fields to be detected;
[0030] Step S32: WAF uses the detection engine to detect the field to be detected and generates a detection result;
[0031] Step S33: WAF encapsulates the connection identifier and detection result in the form of a private protocol and returns it to LB / Connector.
[0032] Furthermore, in step S31 of the method of the present invention, extracting the field to be detected includes: first extracting the domain name from the encapsulated private protocol, and corresponding the field to be detected to different detection rule sets according to different domain names.
[0033] Furthermore, step S32 of the method of the present invention comprises:
[0034] Step S321: the detection engine matches the field to be detected by matching rules;
[0035] Step S322: Return the corresponding rule ID matching set according to the matched attack features;
[0036] Step S323: AND the returned rule ID matching set with the detection rule set configured by the domain name to generate a rule result set, and generate a corresponding attack log for each matching rule.
[0037] Furthermore, step S4 of the method of the present invention includes: if the LB / Connector receives the detection result before the timeout, the request message is released to the source station or the request message is intercepted according to the detection result; if the LB / Connector does not receive the detection result before the timeout, the request message is released to the source station.
[0038] Furthermore, step S5 of the method of the present invention comprises:
[0039] Step S51: After receiving the request message, the source station sends a response message to the LB / Connector;
[0040] Step S52: LB / Connector sends the received response message to WAF;
[0041] Step S53: WAF detects the received response message and returns the detection result to LB / Connector;
[0042] Step S54: LB / Connector releases the response message to the client or intercepts the response message according to the time when the detection result is received and the detection result.
[0043] The WAF bypass deployment system and method of the present invention has the following beneficial effects:
[0044] 1. Reduce resource usage and improve processing efficiency. WAF does not need to check all packets in the traffic, avoiding excessive system pressure caused by mirroring all traffic to the WAF cluster; LB / Connector can flexibly set the timing and content of detection, such as setting the number of detection packets for each connection for different source stations, the fields that need to be extracted, etc.; it can also merge and send multiple requests to reduce the number of interactions.
[0045] 2. Improve forwarding security. When a problem occurs in the WAF cluster, the timeout mechanism of LB / Connector waiting for WAF to feedback a reliable result can ensure that business forwarding is not affected. LB / Connector can dynamically adjust the timeout for waiting for WAF to feedback a reliable result based on the requested business volume, such as QPS. If WAF detection needs to be taken into account in a high-traffic scenario, the timeout can be appropriately increased, sacrificing some user experience to ensure that the source station can still be securely protected when accessed by large traffic.
[0046] 3. Applicable to a variety of scenarios. LB / Connector and WAF can be deployed in clusters according to business needs, and dynamically elastically scale in and out to meet user scenarios; Connector can also be deployed in other scenarios according to business needs, such as cloud scenarios, which means it does not need to be strongly bound to LB. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 This is an architecture diagram of a WAF bypass deployment system according to the first exemplary embodiment of the present invention.
[0049] Figure 2 The figure is a flow chart of a WAF bypass deployment method according to the second exemplary embodiment of the present invention.
[0050] Figure 3 The present invention is a flowchart of a WAF bypass deployment method according to the third exemplary embodiment of the present invention.
[0051] Figure 4 The figure is a flow chart of a WAF bypass deployment method according to the fourth exemplary embodiment of the present invention.
[0052] Figure 5 This is a flowchart of step S32 of a WAF bypass deployment method according to the fourth exemplary embodiment of the present invention.
[0053] Figure 6The present invention is a flowchart of a WAF bypass deployment method according to the fifth exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0054] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0055] It should be noted that the following embodiments and features in the embodiments may be combined with each other in the absence of conflict; and, based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making any creative work are within the scope of protection of the present disclosure.
[0056] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0057] The terms used in the following embodiments are explained as follows:
[0058] WAF: Web Application Firewall, a product that provides protection for Web applications by executing a series of security policies for HTTP / HTTPS.
[0059] LB: Load balancing, providing a secure, stable, and elastically scalable traffic distribution service.
[0060] Connector: Deployed on the load balancer to work with WAF to forward LB traffic to WAF for processing.
[0061] OpenResty: A high-performance web platform based on Nginx and Lua, used to easily build dynamic web applications, web services, and dynamic gateways that can handle ultra-high concurrency and high scalability.
[0062] Figure 1 FIG. 4 is an architecture diagram of a WAF bypass deployment system according to an exemplary first embodiment of the present invention. Figure 1 As shown, the system described in this embodiment includes:
[0063] Client, used to send request messages to LB / Connector or receive response messages returned by LB / Connector;
[0064] LB / Connector, used to actively establish a TCP persistent connection with WAF, obtain the detection configuration of each domain name from WAF, directly forward or send the received request or response message to WAF according to the detection configuration of the domain name, and intercept or release the request or response message according to the time when the detection result is received and the detection result;
[0065] WAF is used to compile the detection rule set configured for domain name detection for the detection engine, detect the received request or response messages, and return the detection results to LB / Connector;
[0066] The source station is used to send the response message to the LB / Connector after receiving the request message.
[0067] Specifically, the LB / Connector in the system of this embodiment is used to: generate a connection identifier after receiving a request message or a response message, extract the domain name from the request message, determine the domain name that needs to be detected according to the detection configuration of the domain name obtained from the WAF, extract the field to be detected at the corresponding position from the message that needs to perform domain name detection according to the corresponding domain name detection configuration, encapsulate the connection identifier and the field to be detected in the form of a private protocol and send them to the WAF, and use the API interface corresponding to the coroutine socket provided by OpenResty to set the timeout mechanism; directly release the request message that does not require domain name detection to the source station.
[0068] The LB / Connector in the system of this embodiment is also used for: if the detection result of the request message is received before the timeout, the request message is released to the source station or the request message is intercepted according to the detection result; if the detection result is not received before the timeout, the request message is released to the source station; if the detection result of the reply message is received before the timeout, the reply message is released to the client or the request message is intercepted according to the detection result; if the detection result is not received before the timeout, the reply message is released to the client.
[0069] In actual applications, when the LB / Connector in the system of this embodiment is started, it will actively establish a TCP long connection with the WAF, and actively obtain the detection configuration of each domain name from the WAF, including the maximum number of packets detected for each connection and the set of locations to be detected.
[0070] The WAF in the system of this embodiment is used to: receive and parse the encapsulated private protocol, extract the fields to be detected, use the detection engine to detect the fields to be detected, generate detection results, and encapsulate the connection identifier and the detection results in the form of a private protocol and return them to the LB / Connector. In actual applications, the fields to be detected are extracted, including: extracting the domain name from the encapsulated private protocol, and corresponding different detection rule sets to the fields to be detected according to different domain names. The detection engine is used to detect the fields to be detected and generate detection results, including: the detection engine matches the fields to be detected through matching rules, returns the corresponding rule ID matching set according to the matched attack features, and ANDs the returned rule ID matching set with the detection rule set configured by the domain name to generate a rule result set, and generates a corresponding attack log for each matching rule.
[0071] In actual applications, when the WAF of the system in this embodiment is started, all the detection rule sets of the domain name detection configuration will be compiled into the detection engine. The WAF of the system in this embodiment manages the detection configuration of the domain name in a unified manner. The settings of each source station to be protected include: the maximum number of messages detected for each connection, the set of rules to be detected, each detection rule locates the detection position and the feature string to be matched, and the set of locations to be detected for this domain name can be generated based on it. When the user modifies the configuration of the domain name, WAF will push the latest configuration of the domain name to LB / Connector.
[0072] Figure 2 This is a flow chart of a WAF bypass deployment method according to an exemplary second embodiment of the present invention. The method of this embodiment includes:
[0073] Step S1: Send a request message to LB / Connector through the client;
[0074] Step S2: Obtain the detection configuration of each domain name from WAF through LB / Connector, and send the request message that needs to be detected by the domain name to WAF according to the detection configuration of the domain name;
[0075] Step S3: WAF detects the received request message and returns the detection result to LB / Connector;
[0076] Step S4: LB / Connector releases the request message to the source station or intercepts the request message according to the time and the detection result received;
[0077] Step S5: After receiving the request message, the source station returns a response message to the client.
[0078] Step S2 of the method of this embodiment also includes: obtaining the detection configuration of each domain name from the WAF through the LB / Connector, and directly releasing the request message that does not require domain name detection to the source station according to the detection configuration of the domain name.
[0079] Step S4 of the method of this embodiment includes: if the LB / Connector receives the detection result before the timeout, the request message is released to the source station or the request message is intercepted according to the detection result; if the LB / Connector does not receive the detection result before the timeout, the request message is released to the source station.
[0080] Figure 3 A flowchart of a WAF bypass deployment method for cloud native according to an exemplary third embodiment of the present invention. This embodiment is Figure 2 The preferred embodiment of the method shown is as follows Figure 3 As shown, step S2 of the method of this embodiment includes:
[0081] Step S21: LB / Connector generates a connection identifier after receiving the request message;
[0082] Step S22: LB / Connector extracts the domain name from the request message, and determines the domain name to be detected according to the detection configuration of the domain name obtained from WAF;
[0083] Step S23: LB / Connector extracts the to-be-detected field at the corresponding position from the message that needs to be detected according to the corresponding domain name detection configuration;
[0084] Step S24: LB / Connector encapsulates the connection identifier and the field to be detected in the form of a private protocol and sends them to WAF, and sets a timeout mechanism.
[0085] In step S23 of the method of this embodiment, the timeout mechanism is set using the API interface corresponding to the coroutine socket provided by OpenResty.
[0086] Figure 4 FIG. 1 is a flowchart of a WAF bypass deployment method according to an exemplary fourth embodiment of the present invention. Figure 2 The preferred embodiment of the method shown is as follows Figure 4 As shown, step S3 of the method of this embodiment includes:
[0087] Step S31: WAF receives and parses the encapsulated private protocol and extracts the fields to be detected;
[0088] Step S32: WAF uses the detection engine to detect the field to be detected and generates a detection result;
[0089] Step S33: WAF encapsulates the connection identifier and detection result in the form of a private protocol and returns it to LB / Connector.
[0090] In step S31 of the method of this embodiment, extracting the field to be detected includes: extracting the domain name from the encapsulated private protocol, and corresponding the field to be detected to different detection rule sets according to different domain names.
[0091] like Figure 5 As shown, step S32 of the method of this embodiment includes:
[0092] Step S321: the detection engine matches the field to be detected by matching rules;
[0093] Step S322: Return the corresponding rule ID matching set according to the matched attack features;
[0094] Step S323: AND the returned rule ID matching set with the detection rule set configured by the domain name to generate a rule result set, and generate a corresponding attack log for each matching rule.
[0095] Figure 6 is a flowchart of a WAF bypass deployment method according to an exemplary fifth embodiment of the present invention. Figure 2 The preferred embodiment of the method shown is as follows Figure 5 As shown, step S5 of the embodiment method includes:
[0096] Step S51: After receiving the request message, the source station sends a response message to the LB / Connector;
[0097] Step S52: LB / Connector sends the received response message to WAF;
[0098] Step S53: WAF detects the received response message and returns the detection result to LB / Connector;
[0099] Step S54: LB / Connector releases the response message to the client or intercepts the response message according to the time when the detection result is received and the detection result.
[0100] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A WAF bypass deployment system, It is characterized in that The system comprises: Client, used to send request messages to LB / Connector or receive response messages returned by LB / Connector; LB / Connector, used to actively establish a TCP persistent connection with WAF, obtain the detection configuration of each domain name from WAF, directly forward or send the received request or response message to WAF according to the detection configuration of the domain name, and intercept or release the request or response message according to the time when the detection result is received and the detection result; WAF is used to compile the detection rule set configured for domain name detection for the detection engine, detect the received request or response messages, and return the detection results to LB / Connector; The source station is used to send the response message to the LB / Connector after receiving the request message; LB / Connector is used to: generate a connection identifier after receiving a request message or a response message, extract the domain name from the request message, determine the domain name that needs to be detected according to the detection configuration of the domain name obtained from WAF, extract the corresponding position of the to-be-detected field from the message that needs to be detected according to the corresponding domain name detection configuration, encapsulate the connection identifier and the to-be-detected field in the form of a private protocol and send them to WAF, and use the API interface corresponding to the coroutine socket provided by OpenResty to set the timeout mechanism; directly release the request message that does not need to be detected to the origin station; LB / Connector is also used to: if the detection result of the request message is received before the timeout, the request message is released to the source station or the request message is intercepted according to the detection result; if the detection result is not received before the timeout, the request message is released to the source station; if the detection result of the reply message is received before the timeout, the reply message is released to the client or the request message is intercepted according to the detection result; if the detection result is not received before the timeout, the reply message is released to the client; WAF is used to: receive and parse the encapsulated private protocol, extract the fields to be detected, use the detection engine to detect the fields to be detected, generate detection results, encapsulate the connection identifier and detection results in the form of a private protocol and return them to the LB / Connector.
2. The WAF bypass deployment system according to claim 1, It is characterized in that Extracting the fields to be detected includes: extracting the domain name from the encapsulated private protocol, and corresponding the fields to be detected to different detection rule sets according to different domain names.
3. The WAF bypass deployment system according to claim 1, It is characterized in that The detection engine is used to detect the fields to be detected and generate detection results, including: the detection engine matches the fields to be detected through matching rules, returns the corresponding rule ID matching set according to the matched attack characteristics, and ANDs the returned rule ID matching set with the detection rule set configured by the domain name to generate a rule result set, and generates a corresponding attack log for each matching rule.
4. A WAF bypass deployment method based on the system according to any one of claims 1 to 3, It is characterized in that The method comprises: Step S1: Send a request message to LB / Connector through the client; Step S2: Obtain the detection configuration of each domain name from WAF through LB / Connector, and send the request message that needs to be detected by the domain name to WAF according to the detection configuration of the domain name; Step S3: WAF detects the received request message and returns the detection result to LB / Connector; Step S4: LB / Connector releases the request message to the source station or intercepts the request message according to the time and the detection result received; Step S5: After receiving the request message, the source station returns a response message to the client; Step S2 includes: Step S21: LB / Connector generates a connection identifier after receiving the request message; Step S22: LB / Connector extracts the domain name from the request message, and determines the domain name to be detected according to the detection configuration of the domain name obtained from WAF; Step S23: LB / Connector extracts the to-be-detected field at the corresponding position from the message that needs to be detected according to the corresponding domain name detection configuration; Step S24: LB / Connector encapsulates the connection identifier and the field to be detected in the form of a private protocol and sends them to WAF, and sets a timeout mechanism; Step S2 also includes: obtaining the detection configuration of each domain name from WAF through LB / Connector, and directly releasing the request message that does not require domain name detection to the source station according to the detection configuration of the domain name; Step S3 includes: Step S31: WAF receives and parses the encapsulated private protocol and extracts the fields to be detected; Step S32: WAF uses the detection engine to detect the field to be detected and generates a detection result; Step S33: WAF encapsulates the connection identifier and detection result in the form of a private protocol and returns it to LB / Connector.
5. The WAF bypass deployment method according to claim 4, It is characterized in that In step S23, the timeout mechanism is set using the API interface corresponding to the coroutine socket provided by OpenResty.
6. The WAF bypass deployment method according to claim 4, It is characterized in that In step S31, extracting the field to be detected includes: extracting the domain name from the encapsulated private protocol, and corresponding the field to be detected to different detection rule sets according to different domain names.
7. The WAF bypass deployment method according to claim 4, It is characterized in that Step S32 includes: Step S321: the detection engine matches the field to be detected by matching rules; Step S322: Return the corresponding rule ID matching set according to the matched attack features; Step S323: AND the returned rule ID matching set with the detection rule set configured by the domain name to generate a rule result set, and generate a corresponding attack log for each matching rule.
8. The WAF bypass deployment method according to claim 4, It is characterized in that Step S4 includes: if the LB / Connector receives the detection result before the timeout, the request message is released to the source station or the request message is intercepted according to the detection result; if the LB / Connector does not receive the detection result before the timeout, the request message is released to the source station.
9. The WAF bypass deployment method according to claim 4, It is characterized in that Step S5 includes: Step S51: After receiving the request message, the source station sends a response message to the LB / Connector; Step S52: LB / Connector sends the received response message to WAF; Step S53: WAF detects the received response message and returns the detection result to LB / Connector; Step S54: LB / Connector releases the response message to the client or intercepts the response message according to the time when the detection result is received and the detection result.
