Block requests by attack score

Last updated May 5, 2026 The attack score helps identify variations of known attacks and their malicious payloads.

This example custom rule blocks requests based on country code (ISO 3166-1 Alpha 2 ↗︎ format), from requests with an attack score lower than 20. For more information, refer to WAF attack score.

  • When incoming requests match:
Field Operator Value Logic
Country is in China, Taiwan, United Kingdom, United States And
WAF Attack Score less than 20

If you are using the expression editor:
(ip.src.country in {"CN" "TW" "US" "GB"} and cf.waf.score lt 20) - Then take action: Block

Was this helpful?

YesNo

On this page

Block requests by attack score - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-attack-score/#page","headline":"Block requests by attack score","description":"Block requests with high WAF attack scores.","url":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-attack-score/","inLanguage":"en","image":"https://developers.cloudflare.com/waf/custom-rules/use-cases/block-attack-score/og.png?v=8c9007ba90dd09aa","dateModified":"2026-05-05","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["Geolocation"]}


description: Block traffic based on geographic location. title: Block traffic by geographical location image: https://developers.cloudflare.com/waf/custom-rules/use-cases/block-by-geographical-location/og.png?v=f612818530d01734


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/waf/llms.txt
Use this file to discover all available pages before exploring further.