Configuring Basic Web Protection to Defend Against Common Web Attacks
After a website is connected to WAF, General Check (with Default rule set (medium) selected and Log only configured for Protective Action) is enabled by default. Basic web protection can defend against common web attacks, such as SQL injection, XSS, remote overflow attacks, file inclusion, Bash vulnerability exploits, remote command execution, directory traversal, sensitive file access, command injection, and code injection. You can also enable Deep Inspection, Header Inspection, and Shiro Decryption Check to detect bypass attempts, and enable Web Shell Detection to detect web shells implanted through upload interfaces.
Prerequisites
- You have connected a website to WAF.
- You have created a policy and added the domain name to it. For details, see Creating a Protection Policy and Adding a Domain Name to a Policy.
- If you use a dedicated WAF instance, make sure it has been upgraded to the latest version. For details, see Managing Dedicated WAF Engines.
Constraints
- Currently, Shiro decryption detection is not available in regions CN East-Qingdao and AP-Manila.
- HTTP/2 packets do not support web shell detection.
Enabling Basic Web Protection Rules
- Log in to the WAF console.
- Click
in the upper left corner and select a region or project.
- (Optional) If you have enabled the enterprise project function, in the upper part of the navigation pane on the left, select your enterprise project from the Filter by enterprise project drop-down list. Then, WAF will display the related security data in the enterprise project on the page.
- In the navigation pane on the left, click Policies.
- Click the name of the target policy to go to the protection rule configuration page.
Before configuring protection rules, ensure that the target protection policy has been applied to a domain name. A protection policy can be applied to multiple protected domain names, but a protected domain name can have only one protection policy.
- Click the Basic Web Protection configuration box and ensure that the basic web protection rules are enabled.
: enabled.
- Configuring Basic Web Protection
Figure 2 Configuring protection rules
Table 1 Basic web protection parameters Parameter
Description
Example Value
General Check
Function switch
General Check is enabled by default. WAF defends against attacks such as SQL injections, XSS, 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.
Protection level
You can select the protection level of basic web protection based on your service requirements. The options are as follows:
- Default rule set (loose): Only requests with obvious attack characteristics are blocked.
If a large number of false alarms are reported, the loose one is recommended.
- Default rule set (medium) (default): meets web protection requirements in most scenarios.
If basic web protection is enabled, the protection level is medium by default.
- Default rule set (strict): At this level, WAF provides the finest granular protection and can block 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 the tight level.
You can click View Rule Set Details to view the details of all rules in the rule sets at the three protection levels. Table 2 describes the protection rules.- You can set Start Date and End Date to search for the protection rules released within a specified period.
- You can select filter CVE ID, Rule ID, or Rule Description and enter a keyword to search for a specific protection rule.
- You can click
next to CVE ID, Risk Severity, Application Type, or Protection Type to filter specified rules.
Default rule set (medium)
Check scope
You can enable or disable a specific check in basic web protection. The options are as follows:- Deep Inspection (disabled by default): If you enable this, WAF 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.
- Header Inspection (disabled by default): If you enable this, WAF checks all header fields in received requests.
- Shiro decryption check (disabled by default): If you enable this, WAF uses AES and Base64 to decrypt the rememberMe field in cookies and checks whether this field is attacked, with hundreds of known leaked keys included and checked for.
NOTE:
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.
- Deep Inspection:
- Header Inspection:
- Shiro Decryption Check:
Webshell Detection
You can enable or disable webshell detection. If you enable it, WAF can protect web applications from web shells that are implanted through upload APIs.
NOTE:HTTP/2 packets do not support web shell detection.
Protective Action
You can select the action taken by WAF if a web basic protection rule is triggered.- Log only (default): WAF logs the request that triggers the rule but does not block it.
- Block: WAF logs and blocks the request that triggers the rule.
Before changing the protective action to block, view the historical logs and confirm that no normal requests trigger the protection rule.
If the protective action is set to Block, you can configure a known attack source. Then, WAF will block requests matching the configured IP address, Cookie, or Params for a length of time configured as part of the rule.
Log only
Table 2 Protection rule description 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
Risk severity of a vulnerability. The value can be High, Medium, or 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.
After the preceding configurations are complete, you can simulate SQL injection attacks to verify the protection effect. For details, see Configuration Example - Blocking SQL Injection Attacks in 4.
- Default rule set (loose): Only requests with obvious attack characteristics are blocked.
Configuration Example - Blocking SQL Injection Attacks
The following example shows how to configure WAF rules to protect domain name www.example.com from SQL injection attacks.
- Click the Basic Web Protection configuration box and ensure that the basic web protection rules are enabled.
: enabled.
- Enable General Check in Basic Web Protection and set the protection mode to Block.
Figure 3 Enabling General Check
- Enable WAF basic web protection.
Figure 4 Enabling WAF basic web protection
- Clear the browser cache and enter a simulated SQL injection (for example, http://www.example.com?id=' or 1=1) in the address box.
WAF blocks the access request. Figure 5 shows an example block page.
- Go to the WAF console. In the navigation pane on the left, choose Events. View the event on the Events page.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot