Configuring Basic Web Protection Rules

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 preset rules in basic web protection, such as webshell detection, search engines, scanners, script tools, and other crawlers.

Important

Basic web protection has two modes: Block and Log only.

Prerequisites

A website has been added to WAF.

Procedure

  1. Log in to the management console.

  2. Click image1 in the upper left corner of the management console and select a region or project.

  3. Click image2 in the upper left corner and choose Web Application Firewall under Security.

  4. In the navigation pane, choose Website Settings.

  5. In the Policy column of the row containing the domain name, click Configure Policy.

  6. In the Basic Web Protection configuration area, change Status and Mode as needed by referring to Table 1.

    Table 1 Parameter description

    Parameter

    Description

    Status

    Status of Basic Web Protection

    • image3: enabled.

    • image4: disabled.

    Mode

    • Block: WAF blocks and logs detected attacks.

    • Log only: WAF only logs detected attacks.

  7. In the Basic Web Protection configuration area, click Advanced Settings.

  8. Enable protection types you need by referring to Table 3.

    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 2 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

      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 false alarm masking rule and select High.

    2. Set the protection type.

      Important

      By default, General Check and Scanner are enabled. You can enable other protection types by referring to Table 3.

    Table 3 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. SQL injection attacks are mainly detected based on semantics.

    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.

    Search Engine

    Uses web crawlers, such as Googlebot and Baiduspider, to find pages for search engines.

    Note

    If you disable Search Engine, WAF does not block POST requests from the Googlebot or Baiduspider. If you want to block POST requests from Baiduspider, use the configuration described in Configuration Example - Blocking Baidu POST Requests.

    Scanner

    Scans for vulnerabilities, viruses, and performs other types of web scans, such as OpenVAS and Nmap.

    Note

    If you enable Scanner, WAF detects the scanner crawlers, such as OpenVAS and Nmap.

    Script Tool

    Executes automatic tasks and program scripts, such as HttpClient, OkHttp, and Python programs.

    Note

    If your application uses scripts such as HttpClient, OkHttp, and Python, disable Script Tool. Otherwise, WAF will identify such script tools as crawlers and block the application.

    Other

    Crawlers for other purposes, such as site monitoring, access proxy, and web page analysis.

    Note

    If you enable Other, WAF detects the crawler programs for various purposes.

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.

    • If the website is inaccessible, connect the website domain name to WAF by following the instructions in Step 1: Add a Website to WAF.

    • If the website is accessible, go to Step 2.

  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, choose Events. On the displayed page, view or download events data.

Configuration Example - Blocking Baidu POST Requests

To allow the search engine of Baidu or Google and block the POST request of Baidu:

  1. Set Status of Search Engine to image5 by referring to Procedure.

  2. Configure a rule by referring to Configuring a Precise Protection Rule.

    • Set Method to POST.

    • Configure the User Agent field to include Baiduspider.