After you enable bot management, you can create custom access control and frequency control rules to protect against requests that match specific conditions. Advanced custom rules offer a wider range of match conditions, such as Client ID, JA3/JA4 fingerprints, and information collected by Web/App SDKs. Conditional deduplication for statistics is also supported. This topic describes how to create a custom bot rule template and add custom rules to it.
Background information
Custom rules are classified into the following types:
Custom rule | Description |
Access control rule | Define match conditions based on client IPs, request URLs, and common request header fields. WAF takes a specified action on requests that hit the match conditions. For example, you can use a custom rule to block requests that access a specific Client ID or verify requests that contain a specific web UMID or app UMID. |
Frequency control rule | Define access frequency detection conditions based on access control match conditions. WAF takes a specified action on statistical objects with unusual access frequencies. For example, if requests from the same IP address or session frequently hit the match conditions within a short period, you can enable frequency control to block requests from that IP address or session for a specified period. |
Step 1: Create a custom rule template
Log on to the Web Application Firewall 3.0 console. In the top navigation bar, select the resource group and region (Chinese Mainland or Outside Chinese Mainland) for your WAF instance.
Click Create Template. In the New Template - Advanced Custom Rules panel, configure the following settings and click OK.
Parameter
Description
Template Name
Enter a name for the template.
The name of the template must be 1 to 255 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-).
Rule Configuration
You can click Create Rule to create a custom rule for the current template. You can also skip this step and create rules for the template after the template is created.
Apply To
Select items to which you want to apply the template on the Protected Objects and Protected Object Groups tabs. For more information, see Configure protected objects and protected object groups.
By default, a newly created protection template is enabled. You can perform the following operations on the template in the template list:
View the numbers of protected objects and protected object groups that are associated with the template in the Protected Object/Group column.
Turn on or turn off the switch in the Status column to enable or disable the template.
Click Create Rule in the Actions column to create a protection rule for the template.
Click Edit, Delete, or Copy in the Actions column to manage the template.
Click the
icon to the left of the template name to view the protection rules in the template.
Step 2: Create a custom rule
A custom rule template does not take effect until you add protection rules. In the Create Rule dialog box, configure the following parameters and click OK.
If you already added a protection rule in Step 1, you can skip this step.
Parameter | Description | ||||||||||||||
Rule Name | Enter a name for the rule. The name of the rule can contain letters, digits, periods (.), underscores (_), and hyphens (-). | ||||||||||||||
Match Condition | Set the request features that you want to match. Click Add Condition to add a condition. You can add up to 10 conditions to a rule. If you define multiple conditions, a request must meet all the conditions to hit the rule. Each condition consists of a Match Field, a Logic, and a Match Content. The following are configuration examples:
| ||||||||||||||
Protection Rule Type | Access Control is selected by default. Click Rate Limiting to enable frequency control. Frequency control means that if requests from the same statistical object (such as an IP address or a session) frequently hit the rule, WAF takes a specified action on all access requests from the statistical object for a period of time. After you enable frequency control, you must configure the frequency control parameters.
| ||||||||||||||
Actions |
| ||||||||||||||
Rule Type | After you classify a custom rule, the traffic that hits the rule is recorded in the Malicious Bot and Suspected Bot trend charts on the traffic analysis page.
| ||||||||||||||
Advanced Settings |
|
By default, a newly created protection rule is enabled. You can perform the following operations on the rule in the rule list:
View the rule ID and action in the Rule ID and Action columns.
Turn on or turn off the switch in the Status column to enable or disable the rule.
Click Edit or Delete in the Actions column to modify or delete the rule.
Match field descriptions
Match Field | Description | Supported logic |
URI | The Uniform Resource Identifier (URI) of a request specifies the path to the requested resource. In general, URI = URI Path + Query String. The value must start with a forward slash ( |
|
IP | The source IP address of a request. This is the IP address of the client that initiates the request. The value must meet the following requirements:
| Does not belong to, Belongs to |
Referer | The source URL of a request. It indicates the page from which the request was redirected. |
|
User-Agent | The identifier of the client that initiates the request. It contains information about the browser, rendering engine, version, and other browser-related details. |
|
Query String | The query string of a request. This is the part of the URL that follows the question mark (?). |
|
Cookie | The cookie information in a request. |
|
Content-Type | The HTTP content type specified in a request, which is the Multipurpose Internet Mail Extensions (MIME) type. |
|
Content-Length | The length of the request body in bytes. The value can range from 0 to 2,147,483,648. | Equals, Value is less than, Value is greater than |
X-Forwarded-For | The originating IP address of the client. X-Forwarded-For (XFF) is an HTTP request header field that is used to identify the original IP address of a client that connects to a web server through an HTTP proxy or a load balancer. Only requests that are forwarded by an HTTP proxy or a load balancer contain this field. |
|
Body | The body of a request. |
|
Http-Method | The method of a request, such as GET, POST, DELETE, PUT, OPTIONS, CONNECT, HEAD, TRACE, or PATCH. |
|
Header | A header in a request. Custom header fields are supported. |
|
URI Path | The URI path of a request. |
|
Query String Parameter | The name of a request parameter. A request parameter refers to the part of the URL that follows the question mark (?). For example, in Note The parameter name is case-sensitive. |
|
Client-ID | The identifier of a client, such as a browser or an application. WAF identifies the client type based on features such as User-Agent information and traffic fingerprints. |
|
Server-Port | The server port. |
|
File Extension | The extension of the requested file. For example, |
|
Filename | The name of the file at the end of the request path. For example, in |
|
Host | The requested domain name. |
|
Cookie Name | The name of a cookie. For example, in the cookie Note The cookie name is case-sensitive. |
|
Body Parameter | The name of a parameter in the request body. For example, if the request body contains the string Note The parameter name is case-sensitive. |
|
JA3 Fingerprint | A string generated by performing an MD5 hash on key parameters of the TLS handshake, including the TLS version, cipher suites, compression algorithms, and TLS extensions. This string, known as the JA3 fingerprint, represents the TLS configuration of a client. JA3 fingerprints can be used to identify and differentiate between different types of TLS clients, such as web browsers, mobile applications, and malware. |
|
JA4 Fingerprint | A JA4 fingerprint includes more contextual information and uses additional algorithms, considering factors such as the browser version and operating system. This helps reduce the duplication issues that can occur with JA3 fingerprints. JA4 fingerprints can more accurately distinguish between real users and impostors, which reduces the false positive rate. |
|
HTTP/2 Fingerprint | An HTTP/2.0 fingerprint generated by applying the MD5 algorithm to the original fingerprint of the HTTP/2 client. It is used to analyze and identify different clients to enable more secure and efficient communication. |
|
IDC | Identifies the traffic source based on source IP address attribution data. Attackers in the cyber underground economy chain often use low-cost cloud servers to launch attacks. | Equals one of, Does not equal any of |
Web SDK | Identifies unusual traffic based on probe data collected by the Web SDK, such as the web UMID and the number of keyboard, mouse, or touch screen events. |
|
App SDK | Allows for fine-grained control based on probe data collected by the App SDK. |
|