Help Center> Web Application Firewall> User Guide> Rule Configuration> Configuring Basic Web Protection Rules

Configuring Basic Web Protection Rules

Basic web protection defends against common web attacks, such as SQL injection, XSS attacks, remote buffer overflow attacks, file inclusion, Bash vulnerability exploits, remote command execution, directory traversal, sensitive file access, and command and code injections. Basic web protection also detects web shells and evasion attacks.

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

If you have enabled enterprise projects, you can select your enterprise project from the Enterprise Project drop-down list and add protection policies for the domain names in the project.

Prerequisites

A website has been added to WAF.

Constraints

  • Basic web protection has two modes: Block and Log only. However, the basic web protection in the detection edition supports only 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 a known attack source rule. After a known attack source rule is configured, WAF blocks requests matching the configured IP address, Cookie, or Params based on the blocking duration set in the rule. For details, see Configuring a Known Attack Source Rule

Procedure

  1. Log in to the management console.
  2. Go to the protection policy configuration page by following the steps shown in Figure 1.

    Figure 1 Access to the protection policy configuration page

  3. In the Basic Web Protection configuration area, change Status and Mode as needed by referring to Table 1. Figure 2 shows an example.

    Figure 2 Basic Web Protection configuration area
    Table 1 Parameter description

    Parameter

    Description

    Status

    Status of Basic Web Protection

    • : enabled.
    • : disabled.

    Mode

    • Block: WAF blocks and logs detected attacks.
    • Log only: WAF only logs detected attacks.
    NOTICE:

    In the detection edition, only Log only is available.

  4. In the Basic Web Protection configuration area, click Advanced Settings.
  5. Click the Protection Status tab, and enable protection types one by one by referring to Table 2. Figure 3 shows an example.

    Figure 3 Basic web protection

    If you select Mode for Block on the Protection Status tab, you can select a known attack source rule so that WAF can block requests accordingly.

    Table 2 Protection types

    Type

    Description

    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.

    NOTE:

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

    Webshell Detection

    Protects against web shells from upload interface.

    NOTE:

    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.

    NOTE:

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

    Header Detection

    Detects all header fields in requests. This function is disabled by default. If this function is disabled, only some of the header fields in requests are checked against General Check.

    NOTE:

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

    1. 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 3 Protection levels

      Protection Level

      Description

      Low

      WAF only blocks the requests with obvious attack signatures.

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

      Medium

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

      High

      WAF blocks the requests even if they have no attack signature if the requests have certain attack patterns.

      High is recommended if you want to block SQL injection, XSS, and command injection attacks.

    2. Set the protection type.

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

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

    Figure 4 Viewing protection rules

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

    Table 4 Protection rules

    Parameter

    Description

    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 type of applications to which the protection rule applies, for example, WordPress.

    Protection Type

    The type of attack the protection rule is configured for, for example, command injections.

Protection Effect

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

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

  2. Clear the browser cache and enter http://www.example.com?id=1%27%20or%201=1 in the address box of the browser to simulate an SQL injection attack.
  3. Return to the WAF console. In the navigation pane, click Events. On the displayed page, view or download events data.

Example - Blocking SQL Injection Attacks

Simulate an SQL injection attack to see if WAF blocks the requests that match the conditions in the rule.

Run the following command on the web host to simulate SQL injection and check whether the request is blocked:

curl -kv "http://www.example.com?id=1 or 1=1"

If the WAF blocked the request, the following page is displayed and status code 418 is returned.