Skip to content

[Use Cases] Solution guide: Stop malicious bots while allowing legitimate traffic#29531

Draft
codyanthony850 wants to merge 5 commits intoproductionfrom
canthony/stop-malicious-bots-guide
Draft

[Use Cases] Solution guide: Stop malicious bots while allowing legitimate traffic#29531
codyanthony850 wants to merge 5 commits intoproductionfrom
canthony/stop-malicious-bots-guide

Conversation

@codyanthony850
Copy link
Copy Markdown
Contributor

First solution guide for the use-cases section. Covers layered bot defense using Cloudflare tools: Bot Fight Mode, Turnstile, WAF custom rules, rate limiting, and bot score rules.

  • New file: src/content/docs/use-cases/application-security/stop-malicious-bots.mdx
  • Nests under Daniel's application-security/ category structure from Add new use cases documentation #29162
  • Core workflow uses Free and Pro plan features, with callouts for higher tiers
  • Follows solution guide content type conventions: goal-first framing, workflow stages, plan tier callouts
  • Inline procedures will be refactored to partials before merge (tracked in PCX-21341)

Related: PCX-21341

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
* @cloudflare/pcx-technical-writing

Rules that use counting expressions with response codes (such as counting only `401` and `403` responses) require a Business plan or above. On Free and Pro plans, you can create simpler rate limiting rules with IP-based counting. Refer to [Rate limiting rules](/waf/rate-limiting-rules/) for plan availability details.
:::

## Target bot patterns with WAF rules
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Reduce the number of times we use WAF and call them "security rules".

If the built-in settings do not cover your needs, create a custom rule:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
2. Go to **Security** > **WAF** > **Custom rules**.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nav depends on the dashboard nav version (old or new). We commonly use tabs for this purpose.


If your bot traffic is concentrated from countries where you have no real users, you can combine geographic filters with the rules above. Add `ip.src.country` to your expression to restrict the rule to specific regions. For examples, refer to [Block traffic by geographical location](/waf/custom-rules/use-cases/block-by-geographical-location/).

### Rate limit high-frequency paths
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a few examples and use cases already in the rate limiting best practices page (could be useful to link there, either to specific sections or to the page).

You reference the `cf.bot_management.score` field in WAF custom rule expressions to act on these scores. For example, to challenge likely automated traffic on your checkout page:

```txt
(cf.bot_management.score lt 30 and http.request.uri.path eq "/checkout" and not cf.bot_management.verified_bot)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also provide a table as an alternative. For simple expressions like these, customers can use the expression builder instead of switching to the editor.
image

Security Events displays every request that Cloudflare mitigated — blocked, challenged, or flagged. This is where you confirm your rules are working as intended.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
2. Go to **Security** > **Events**.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact navigation depends on the dash nav version (old or new).

4. Check the top requested paths to find which endpoints receive the most bot traffic. Login pages, API endpoints, and checkout flows are common targets.
5. Look for patterns before making changes. Sudden spikes in low-score traffic, specific user agents appearing at high volume, or geographic concentration of requests all indicate bot activity worth investigating.

:::note[Bot Analytics requires a Pro plan or above]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this information should appear at the beginning of the section, before users try to follow the steps?


Cloudflare classifies bot traffic into categories based on bot scores and verification status. Understanding these categories helps you write rules that target the right traffic.

**Verified bots** are crawlers and services that Cloudflare has confirmed as legitimate. Googlebot, Bingbot, and uptime monitors fall into this category. Cloudflare maintains a [verified bot list](/bots/concepts/bot/verified-bots/policy/) with strict requirements — each bot must serve a benign purpose, respect `robots.txt`, and crawl with the consent of domain owners. Always allow verified bots through your protections.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make this a bulleted list.

Bot Fight Mode is available on all Cloudflare plans, including Free.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
2. Go to **Security Settings** and filter by **Bot traffic**.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should clarify where this is located, and what's the nav step for users in the old dashboard navigation.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

This PR requires additional review attention because it affects the following areas:

Redirects

This PR changes current filenames or deletes current files. Make sure you have redirects set up to cover the following paths:

  • /use-cases/application-security/bots/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants