Help Center> Web Application Firewall> User Guide> Policies> Configuring Basic Protection Rules to Defend Against Common Web Attacks
Updated on 2024-04-17 GMT+08:00

Configuring Basic Protection Rules to Defend Against Common Web Attacks

After this function is enabled, WAF can defend against common web attacks, such as SQL injections, XSS, remote overflow vulnerabilities, file inclusions, Bash vulnerabilities, remote command execution, directory traversal, sensitive file access, and command/code injections. You can also enable other checks in basic web protection, such as web shell detection, deep inspection against evasion attacks, and header inspection.

For details about how to configure basic web protection rules, see Basic Web Protection.

If you have enabled enterprise projects, ensure that you have all operation permissions for the project where your WAF instance locates. Then, you can select the project from the Enterprise Project drop-down list and configure protection policies for the domain names in the project.


You have added your website to a policy.


  • Basic web protection has two modes: Block and Log only.
  • It takes several minutes for a new rule to take effect. After the rule takes effect, protection events triggered by the rule will be displayed on the Events page.
  • If you select Block for Basic Web Protection, you can configure access control criteria for a known attack source. WAF will block requests matching the configured IP address, cookie, or params for a length of time configured as part of the rule.
  • Currently, the deep inspection and header inspection are supported in CN-Hong Kong, CN North-Beijing1, CN North-Beijing4, CN East-Shanghai1, CN East-Shanghai2, CN South-Guangzhou, CN South-Shenzhen, CN Southwest-Guiyang1, and AP-Bangkok.
  • Currently, Shiro decryption check is supported in CN North-Beijing4 and CN-Hong Kong.


  1. Log in to the management console.
  2. Click in the upper left corner of the management console and select a region or project.
  3. Click in the upper left corner and choose Web Application Firewall under Security & Compliance.
  4. In the navigation pane on the left, choose Policies.
  5. Click the name of the target policy to go to the protection configuration page.
  6. Click the Basic Web Protection configuration area and toggle it on or off if needed.

    • : enabled.
    • : disabled.

  7. Click the Protection Status tab, and enable protection types one by one by referring to Table 2.

    Figure 1 Basic web protection
    1. Set the protective action.
    2. Set the protection level.

      In the upper part of the page, set Protection Level to Low, Medium, or High. The default value is Medium.

      Table 1 Protection levels

      Protection Level



      WAF only blocks the requests with obvious attack signatures.

      If a large number of false alarms are reported, Low is recommended.


      The default level is Medium, which meets a majority of web protection requirements.


      At this level, WAF provides the finest granular protection and can intercept attacks with complex bypass features, such as Jolokia cyber attacks, common gateway interface (CGI) vulnerability detection, and Druid SQL injection attacks.

      To let WAF defend against more attacks but make minimum effect on normal requests, observe your workloads for a period of time first. Then, configure a global protection whitelist rule and select High.

    3. Set the protection type.

      By default, General Check is enabled. You can enable other protection types by referring to Table 2.

    Table 2 Protection types



    General Check

    Defends against attacks such as SQL injections, XSS, remote overflow vulnerabilities, file inclusions, Bash vulnerabilities, remote command execution, directory traversal, sensitive file access, and command/code injections. SQL injection attacks are mainly detected based on semantics.


    If you enable General Check, WAF checks your websites based on the built-in rules.

    Webshell Detection

    Protects against web shells from upload interface.


    If you enable Webshell Detection, WAF detects web page Trojan horses inserted through the upload interface.

    Deep Inspection

    Identifies and blocks evasion attacks, such as the ones that use homomorphic character obfuscation, command injection with deformed wildcard characters, UTF7, data URI scheme, and other techniques.


    If you enable Deep Inspection, WAF detects and defends against evasion attacks in depth.

    Header Inspection

    This function is disabled by default. When it is disabled, General Check will check some of the header fields, such as User-Agent, Content-type, Accept-Language, and Cookie.


    If you enable this function, WAF checks all header fields in the requests.

    Shiro Decryption Check

    This function is disabled by default. After this function is enabled, WAF uses AES and Base64 to decrypt the rememberMe field in cookies and checks whether this field is attacked. There are hundreds of known leaked keys included and checked for.


    If your website uses Shiro 1.2.4 or earlier, or your website uses Shiro 1.2.5 or later but no AES keys are not configured, it is strongly recommended that you enable Shiro decryption detection to prevent attackers from using leaked keys to construct attacks.

  8. Click the Protection Rules tab to view details. Figure 2 shows an example. For more details about the parameters, see Table 3.

    Figure 2 Viewing protection rules

    Click to search for a rule by CVE ID, Risk Severity, Application Type, or Protection Type.

    Table 3 Protection rules



    Rule ID

    The protection rule ID, which is generated automatically.

    Rule Description

    Details of attacks the protection rule is configured for.

    CVE ID

    Common Vulnerabilities & Exposures (CVE) ID, which corresponds to the protection rule. For non-CVE vulnerabilities, a double dash (--) is displayed.

    Risk Severity

    The severity of the vulnerability, including:

    • High
    • Medium
    • Low

    Application Type

    The application type the protection rule is used for. For details about applications types WAF can protect, see Application Types WAF Can Protect.

    Protection Type

    The type of the protection rule. WAF can discover SQL injection, command injection, XSS attacks, XML external entity (XXE) injection, Expression Language (EL) Injection, SSRF, local file inclusion, remote file inclusion, website Trojans, malicious crawlers, session fixation attacks, deserialization vulnerabilities, remote command execution, information leakage, DoS attacks, source code/data leakage.

Protection Effect

If General Check is enabled and Mode is set to Block for your domain name, to verify WAF is protecting your website ( against general check items:

  1. Clear the browser cache and enter the domain name in the address bar to check whether the website is accessible.

    • If the website is inaccessible, connect the website domain name to WAF by following the instructions in Website Settings.
    • If the website is accessible, go to 2.

  2. Clear the browser cache and enter in the address box of the browser to simulate an SQL injection attack.
  3. Return to the WAF console. In the navigation pane, choose Events. On the displayed page, view or download events data.

Example - Blocking SQL Injection Attacks

If domain name has been connected to WAF, perform the following steps to verify that WAF can block SQL injection attacks.

  1. Enable General Check in Basic Web Protection and set the protection mode to Block.

    Figure 3 Enabling General Check

  2. Enable WAF basic web protection.

    Figure 4 Basic Web Protection configuration area

  3. Clear the browser cache and enter a simulated SQL injection (for example,' or 1=1) in the address box.

    WAF blocks the access request. Figure 5 shows an example block page.

    Figure 5 Block page

  4. Go to the WAF console. In the navigation pane on the left, choose Events. View the event on the Events page.