# WAF Rules: Managed vs Custom Rules and False Positives

> What WAF rules are, how managed and custom rules differ in Cloudflare, AWS WAF and OWASP CRS, how to tune a false positive and how to keep a WAF change log.

Canonical: https://origindatapartners.com/guides/waf-rules
By: Origin Data Partners
Status: Published
Published: 2026-11-17
Updated: 2026-11-17
Sources checked: 2026-11-17

## Quick answer

WAF rules are the conditions a web application firewall checks on each HTTP request, with an action such as block, challenge, log or allow when one matches. Managed rules are written and updated by a vendor or by the OWASP Core Rule Set project. Custom rules are your own. Most tuning work is fixing false positives: legitimate requests a rule blocks, which you exclude narrowly rather than switching the rule off.

## Key points

- A WAF inspects web and API requests and acts on the ones that match a rule.
- Managed rules cover known attacks and are updated by the provider; custom rules fit your own application.
- OWASP CRS adds up an anomaly score per request and blocks above a threshold; paranoia levels set how strict it is.
- Fix a false positive with the narrowest exclusion: one rule, one field, one path.
- Test new rules in count or log mode first, and record every change with its reason.

## What are WAF rules?

A web application firewall (WAF) sits in front of a website or API and inspects each HTTP request before it reaches the application. Cloudflare's WAF "checks incoming web and API requests and filters undesired traffic based on sets of rules called rulesets" ([Cloudflare](https://developers.cloudflare.com/waf/)). AWS describes AWS WAF as "a web application firewall that lets you monitor the HTTP(S) requests that are forwarded to your protected web application resources" ([AWS](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html)).

Each rule has two parts. Cloudflare lists "an expression that specifies the criteria" to match and "an action that specifies what to perform when there is a match for the rule" ([Cloudflare](https://developers.cloudflare.com/waf/custom-rules/)). Criteria can be a path, a header, a country, an IP address, or a pattern in the body. Actions include block, challenge, log, skip and allow.

A WAF rule is not the same as a network firewall rule. A network firewall decides which addresses and ports may connect. A WAF reads the content of web requests, so it can stop an SQL injection attempt on port 443 that a network firewall would let through.


## What is the difference between managed and custom WAF rules?

Managed rules are written and maintained by someone else. Cloudflare's managed ruleset "is updated frequently to address new threats and reduce false positives (legitimate requests incorrectly flagged)" ([Cloudflare](https://developers.cloudflare.com/waf/managed-rules/)). AWS Managed Rules is "a managed service that provides protection against application vulnerabilities or other unwanted traffic" ([AWS](https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups.html)). The open-source option is the OWASP Core Rule Set (CRS), "a free and open-source collection of rules that work with ModSecurity" and compatible WAFs ([OWASP CRS](https://coreruleset.org/docs/)). Cloudflare also runs its own implementation of the OWASP rule set.

Custom rules are the ones you write: block an old admin path, rate-limit a login form, allow a partner's IP range, or challenge traffic from places you do not serve.

|  | Managed rules | Custom rules |
| --- | --- | --- |
| Written by | The WAF vendor or the CRS project | Your team |
| Covers | Known attack types such as SQL injection and cross-site scripting | Your own paths, partners, abuse patterns |
| Updated | By the provider, sometimes without notice to you | Only when you change them |
| How you adjust | Change actions, set sensitivity, add exceptions | Edit the rule |
| Main risk | False positives on unusual but legitimate traffic | Gaps and stale rules nobody remembers |


## How are WAF rules evaluated?

Order matters. In Cloudflare, "custom rules are evaluated in order, and some actions like Block will stop the evaluation of other rules" ([Cloudflare](https://developers.cloudflare.com/waf/custom-rules/)). An allow or skip rule placed too early can switch off protection for everything after it.

OWASP CRS works differently. Each matching rule adds to an anomaly score for the request, and "the default CRS blocking policy, for example, is to block any transaction that meets or exceeds a defined anomaly score threshold" ([OWASP CRS](https://coreruleset.org/docs/2-how-crs-works/2-1-anomaly_scoring/)). How strict the rules are is set by the paranoia level. "The CRS project views the four paranoia levels" as steps from baseline to very strict, and "paranoia level 1 (PL 1) provides a set of rules that hardly ever trigger a false alarm" ([OWASP CRS](https://coreruleset.org/docs/2-how-crs-works/2-2-paranoia_levels/)). "A higher paranoia level makes it harder for an attacker to go undetected", at the cost of more tuning.


## What causes WAF false positives?

A false positive is a legitimate request that a rule treats as an attack. Common causes are a content editor that posts HTML, a search box where people type SQL-like words, a long API payload, or a file upload that looks like code. The rule is doing its job; it just cannot know that this field is supposed to contain that text.

They matter for two reasons. Blocked customers are lost business, and noisy alerts get ignored. The CRS documentation warns that "leaving false positives mixed in with real attacks is dangerous" ([OWASP CRS](https://coreruleset.org/docs/2-how-crs-works/2-3-false-positives-and-tuning/)). The safe way to roll out a rule is to watch before you block. AWS advises testing in staging and then to "test and tune the rules in count mode with your production traffic before enabling them" ([AWS](https://docs.aws.amazon.com/waf/latest/developerguide/web-acl-testing.html)). Cloudflare's Security Events view is for this: "investigate requests that Cloudflare security products acted on or flagged, identify false positives, and fine-tune your security rules" ([Cloudflare](https://developers.cloudflare.com/waf/analytics/security-events/)).


## WAF false positive example: tuning one rule

A company runs ModSecurity with CRS at paranoia level 1 in front of its content management system. After an update, editors cannot save posts that contain headings. The WAF log shows rule 941320 matching HTML in the post_body field on /admin/posts/save. The CRS documentation uses a very similar case: "Imagine deploying the CRS in front of a WordPress instance", where post content trips an XSS rule ([OWASP CRS](https://coreruleset.org/docs/2-how-crs-works/2-3-false-positives-and-tuning/)).

The wrong fix is to edit the CRS rule file or turn the rule off everywhere. CRS says "making direct modifications to CRS rule files is a bad idea and is strongly discouraged", and that "false positives need to be tuned away by writing rule exclusions" ([OWASP CRS](https://coreruleset.org/docs/2-how-crs-works/2-3-false-positives-and-tuning/)). The narrow fix is a runtime exclusion: on that one path, stop rule 941320 from inspecting that one field. Every other field and path keeps the full check.

| Step | What the team does | Record it leaves |
| --- | --- | --- |
| 1 | Editors report failed saves; support opens a ticket | Ticket SEC-2291 |
| 2 | Engineer finds rule 941320 and the field in the WAF log | WAF log lines with rule ID and matched data |
| 3 | Exclusion written and reviewed as a pull request | Diff, reviewer approval |
| 4 | Deployed; saves work; rule still runs on all other fields | Deploy log, WAF log after the change |

Runtime rule exclusion for one rule, one field and one path:

```apache
# Runtime rule exclusion, loaded before CRS
# Ticket SEC-2291: rule 941320 flags HTML in the post editor body field
SecRule REQUEST_URI "@beginsWith /admin/posts/save" \
    "id:1100,\
    phase:1,\
    pass,\
    t:none,\
    nolog,\
    ctl:ruleRemoveTargetById=941320;ARGS:post_body"
```

Illustrative example written for this page, using the exclusion syntax shown in the CRS documentation; the path, field, ticket and rule ID 1100 are made up. In Cloudflare the equivalent is a WAF exception, which "includes an expression that defines the skip conditions, and the rules or rulesets to skip under those conditions" ([Cloudflare](https://developers.cloudflare.com/waf/managed-rules/waf-exceptions/)).


## How should you keep a WAF change log?

Treat WAF rules like any other configuration: keep them in code and record why each one changed. Cloudflare's WAF rules can be managed in Terraform, and Cloudflare notes that "Terraform assumes that it has complete control over account and zone rulesets" ([Cloudflare](https://developers.cloudflare.com/terraform/additional-configurations/waf-custom-rules/)), so dashboard edits must stop once you switch. Cloudflare's audit logs "summarize the history of changes made within your Cloudflare account", including "zone configuration changes" ([Cloudflare](https://developers.cloudflare.com/fundamentals/account/account-security/review-audit-logs/)). NIST's firewall guide asks for the same thing for any rule set: "at a minimum, a log should be kept of all policy decisions and ruleset changes" ([NIST SP 800-41 Rev. 1](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-41r1.pdf)).

Keep the traffic logs that show each change worked. AWS WAF logs include "the time that AWS WAF received a web request from your AWS resource, detailed information about the request, and details about the rules that the request matched" ([AWS](https://docs.aws.amazon.com/waf/latest/developerguide/logging.html)). These logs can hold sensitive request content. Cloudflare's payload logging encrypts matched values "with a customer-provided public key so that only you can examine them later" ([Cloudflare](https://developers.cloudflare.com/waf/managed-rules/payload-logging/)).

| Field | Example |
| --- | --- |
| Rule or exception changed | Exclusion for rule 941320 on post_body |
| Reason and ticket | False positive, SEC-2291 |
| Before and after | The diff or pull request |
| Mode | Count or log first, then block |
| Who and when | Author, reviewer, deploy time in UTC |
| Evidence | WAF log query before and after |


## Common mistakes with WAF rules

Most WAF incidents come from rules changed in a hurry and never revisited.

- Turning off a whole managed rule group to fix one false positive.
- Placing a broad allow or skip rule early in the order, so later rules never run.
- Blocking straight away with a new rule instead of counting or logging first.
- Editing CRS rule files directly, which breaks the next upgrade.
- Leaving emergency rules from an attack in place for years with no note of why they were added.
- Changing rules in the dashboard when they are managed in Terraform, so the next apply removes the fix.


## Are WAF changes and attack logs also a data asset?

They can be, for the company's own platform. AI data buyers have asked Origin for attack and defense sequences that can be replayed: the WAF, DNS and load balancer changes made in response to an attack, with the logs of what happened before and after, in order. They want each change joined to its ticket, chat thread, pull request and outcome, with the runbooks, on-call records and postmortems of the same period. The first step is a sample of two or three incidents end to end plus a slice of the config history. Logs count only as part of an ordered incident record, as the [security incident data guide](https://origindatapartners.com/guides/license-security-incident-data-ai) explains. Hosting and CDN providers should also read [the hosting provider page](https://origindatapartners.com/guides/hosting-cdn-provider-incident-data-ai).

Origin is an independent data partner. Your company decides what is shared and signs any license itself, and a buyer may pay Origin when a deal closes.

Customer traffic, customer logs and anything about a client's own site usually belong to that customer or fall under the provider's terms and data processing agreements. This is general information, not legal advice.

- Request payloads: matched values, form fields, cookies and tokens in WAF logs come out first.
- IP addresses and user agents: they can identify people. See [anonymizing logs and captures](https://origindatapartners.com/guides/anonymize-pcap-files-logs).
- Secrets: API keys and credentials in rule files, Terraform and logs must be removed and rotated. See [remove secrets from git history](https://origindatapartners.com/guides/remove-secrets-from-git-history).
- Customer and client sites: leave out traffic of sites you protect for others unless they have agreed.
- Vendor rule content: check the terms of managed rule sets before exporting their rule text.

Does your company hold records like these? [See what your data is worth](https://origindatapartners.com/check-fit).


## Questions and answers

### What is the difference between WAF rules and firewall rules?

A network firewall rule decides which IP addresses and ports may connect. A WAF rule inspects the content of web and API requests, such as paths, headers, query strings and bodies, and acts on matches. A WAF can block an SQL injection attempt on port 443 that a network firewall, which only sees an allowed HTTPS connection, would let through.

### What are Cloudflare WAF custom rules?

Cloudflare WAF custom rules are rules you write yourself, each made of an expression that matches requests and an action such as Block, Managed Challenge or Skip. They are evaluated in order, and a Block stops later rules from running for that request. The number of custom rules available depends on the Cloudflare plan.

### What are ModSecurity rules?

ModSecurity rules are written in the SecRule language used by the ModSecurity WAF engine and compatible WAFs. The best-known set is the OWASP Core Rule Set, which detects common attacks such as SQL injection and cross-site scripting. CRS adds up an anomaly score for each request and blocks it once the score reaches a set threshold.

### How do you fix a WAF false positive?

Find the rule ID and the field it matched in the WAF log, then write the narrowest exception you can: that one rule, on that one field, on that one path. Do not edit the vendor's rule files or switch off a whole rule group. Test the change, keep the rule running everywhere else, and record the reason with a ticket.

### What is count mode in AWS WAF?

Count mode makes an AWS WAF rule record the requests it would have acted on without blocking them. AWS recommends testing rules in a staging environment first, then running them in count mode on production traffic and tuning them before enabling blocking. It is the standard way to see false positives before customers do.

### What should a WAF change log record?

A WAF change log should record which rule or exception changed, the reason and ticket, the diff or pull request, whether the rule ran in count or log mode before blocking, who made and approved the change, the deploy time in UTC, and a WAF log query from before and after that shows the effect.

### Can a web hosting provider share its WAF and firewall change history?

It can, for its own platform: WAF, DNS and firewall changes made to protect its own infrastructure, joined to the tickets and logs of the attacks they answered. Customer content, customer logs and clients' own sites usually belong to customers or fall under the provider's terms. Secrets, payloads and personal data in logs come out first.

## Sources

- [Cloudflare WAF documentation: Overview](https://developers.cloudflare.com/waf/)
- [Cloudflare WAF documentation: Custom rules](https://developers.cloudflare.com/waf/custom-rules/)
- [Cloudflare WAF documentation: Managed rules](https://developers.cloudflare.com/waf/managed-rules/)
- [OWASP CRS documentation](https://coreruleset.org/docs/)
- [OWASP CRS documentation: False positives and tuning](https://coreruleset.org/docs/2-how-crs-works/2-3-false-positives-and-tuning/)
- [AWS WAF Developer Guide: AWS WAF](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html)
- [AWS WAF Developer Guide: Testing and tuning your AWS WAF protections](https://docs.aws.amazon.com/waf/latest/developerguide/web-acl-testing.html)
- [NIST SP 800-41 Rev. 1: Guidelines on Firewalls and Firewall Policy](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-41r1.pdf)

## Related reading

- [Can a security company license alerts and incident data to AI?](https://origindatapartners.com/guides/license-security-incident-data-ai)
- [Audit Log Examples: Fields, SIEM Logs and CloudTrail](https://origindatapartners.com/guides/audit-log-examples)
- [Cybersecurity Incident Data: A Guide for MSSPs and IR Firms](https://origindatapartners.com/guides/cybersecurity-incident-soc-case-data)
- [Config Drift: How to Detect It in Terraform and Networks](https://origindatapartners.com/guides/config-drift)
- [Can a Hosting or CDN Provider License Incident Data to AI?](https://origindatapartners.com/guides/hosting-cdn-provider-incident-data-ai)
- [Anonymize PCAP Files and Logs Without Breaking Analysis](https://origindatapartners.com/guides/anonymize-pcap-files-logs)
