| title | pcx_content_type | sidebar | ||
|---|---|---|---|---|
Concepts |
concept |
|
import { GlossaryTooltip, Render, DashButton } from "~/components";
:::note[What is a Web Application Firewall?]
A Web Application Firewall or WAF creates a shield between a web app and the Internet. This shield can help mitigate many common attacks. For a more thorough definition, refer to Web Application Firewall explained in the Learning Center. :::
A rule defines a filter and an action to perform on the incoming requests that match the filter.
A ruleset is an ordered set of rules that you can apply to traffic on the Cloudflare global network. Rules within a ruleset are evaluated in sequence. The first matching rule with a terminating action (such as Block, Challenge, or Redirect) stops evaluation — later rules do not run for that request.
The Cloudflare WAF includes:
- Managed Rules (for example, the Cloudflare Managed Ruleset), which are signature-based rules created by Cloudflare that provide immediate protection against known attacks.
- Traffic detections (for example, bot score and attack score) that enrich requests with metadata.
- User-defined rules for your specific needs, including custom rules and rate limiting rules.
The two main roles of the Cloudflare WAF are the following:
-
Detection: Run incoming requests through one or more traffic detections to find malicious or potentially malicious activity. The scores from enabled detections are available in the Security Analytics dashboard, where you can analyze your security posture and determine the most appropriate mitigation rules.
-
Mitigation: Blocks, challenges, or throttles requests through different mitigation features such as custom rules, Managed Rules, and rate limiting rules. Rules that mitigate traffic can include scores from traffic scans in their expressions to better address possibly malicious requests.
:::caution Detections only score traffic. They do not block or challenge requests on their own. Use those scores in custom rules or rate limiting rules to act on the findings. :::
The WAF currently provides the following detections for finding security threats in incoming requests:
- Attack score: Checks for known attack variations and malicious payloads. Scores traffic on a scale from 1 (likely to be malicious) to 99 (unlikely to be malicious).
- Leaked credentials: Scans incoming requests for credentials (usernames and passwords) previously leaked from data breaches.
- Malicious uploads: Scans content objects, such as uploaded files, for malicious signatures like malware.
- AI Security for Apps: Helps protect your services powered by large language models (LLMs) against abuse.
- Bot score: Scores traffic on a scale from 1 (likely to be a bot) to 99 (likely to be human).
To enable traffic detections in the Cloudflare dashboard, go to the Security Settings page.
:::note Currently, you cannot manage the bot score and attack score detections from the Settings page. Refer to the documentation of each feature for availability details. :::
Cloudflare evaluates different types of rules when processing incoming requests. The first rule with a terminating action (such as Block, Managed Challenge, or Redirect) stops all further evaluation. For example, an IP Access rule that blocks a request prevents custom rules from running. The rule execution order is the following:
- IP Access rules
- Firewall rules (deprecated)
- Custom rules
- Rate limiting rules
- Managed Rules
- Cloudflare Rate Limiting (previous version, deprecated)
Rules are evaluated in order. If there is a match for a rule with a terminating action, the rule evaluation will stop and the action will be executed immediately. Rules with a non-terminating action (such as Log) will not prevent subsequent rules from being evaluated and executed. For more information on how rules are evaluated, refer to Rule evaluation in the Ruleset Engine documentation.
For more information on the phases where each WAF feature will execute, refer to WAF phases.