Skip to main content
User guide

Rules and policies

CRS protection level and anomaly thresholds, detection module modes and presets, precision mode, CSRF options, rule bundles and virtual patches, the CRS rule library, heightened protection mode and configuration publishing.

In the Web attack protection (Web 攻击防护) group, Rules and policies (规则与策略), CRS rule library (CRS 规则库), Heightened protection mode (重保模式) and Configuration publishing (配置发布) decide how requests are inspected. Viewing needs View protection policy, changes need Modify protection policy. Without publishing mode, saved changes take effect immediately.

How detection works

Each request is first parsed by the semantic engine, which reads SQL, HTML/JS, shell and template syntax to judge whether it forms an attack. Its verdict feeds into the OWASP CRS 4.25.2 anomaly score. CRS matches rules by paranoia level and adds up the score, and the request is blocked when the score passes the threshold. The semantic engine covers SQL injection, XSS, command injection, template injection, NoSQL injection, XXE, Log4j JNDI, GraphQL and Base64-wrapped payloads.

Protection level

The protection level (防护等级) is the CRS blocking paranoia level. Higher levels block more and produce more false positives:

LevelCRS
Lenient (宽松)PL1
Balanced (平衡)PL2
Strict (严格)PL3
Maximum (高强度)PL4

With Follow deployment configuration (跟随部署配置) on, the value of CRS_PL in .env is used. Sites can override the level and are listed below it.

Under Advanced you can set:

  • Detection paranoia level (检测偏执级别): same as the blocking level, or PL1 to PL4, never lower than the blocking level. Rules above the blocking level only log.
  • Inbound anomaly threshold (default 5) and outbound anomaly threshold (default 4).
  • Parameter count limit: requests above it get 400.
  • Request body inspection limit: requests above it get 413.
  • Allowed HTTP methods: set once and pushed to every node, or follow each node's RSTWAF_ALLOWED_METHODS in .env.

Changes that weaken protection or add noise ask you to confirm that you understand the risks.

Detection modules

Detection modules can be set as global defaults or per site. Each module has four modes:

ModeBehaviour
Disabled (禁用)Not inspected
Observe only (仅观察)Log without blocking. Events the thresholds would have blocked are marked as would block
Balanced (平衡防护)Default
Strict (高强度防护)Blocks more, with more false positives

At site scope there is also Follow global (跟随全局). There are 24 modules: SQL injection, XSS, command injection, PHP code injection, PHP deserialisation, Java code injection, Java deserialisation, other code injection, template injection, NoSQL injection, XXE, LDAP injection, file inclusion and path traversal, remote file inclusion, SSRF, file upload, malformed HTTP, HTTP smuggling and CRLF injection, scanners, session fixation, GraphQL parsing, Base64 decoding, response inspection and CSRF. Each row shows the rules it covers.

Apply preset (套用预设):

PresetDescription
Recommended (推荐)Everything balanced
Rollout observation (上线观察)Malformed protocol, HTTP smuggling and scanners still blocked, everything else logged. The default for new sites
Strict (严格)Everything strict

Precision mode

Sites can turn on Precision mode (low false positives) (精准档(低误报)), which applies only to modules set to balanced. When all three semantic engines judge a request harmless, rule hits without engine support together count as a single warning. Precision mode lets through a small number of attacks that only CRS rules match and the semantic engines judge harmless. It has no effect while any module is disabled or observe only.

CSRF options

Only write requests (POST, PUT, PATCH, DELETE) carrying a cookie or HTTP authentication are checked. APIs using bearer tokens are not affected.

  • Trusted origins: one per line, such as https://…, *.domain or null.
  • Exempt paths: a trailing * means prefix. Balanced mode also exempts callback, notify, saml and oauth path segments automatically.
  • Token check: follow global, on or off. Takes effect only in strict mode.
  • Cross-site subresource requests: follow global, log only (default) or block. Strict mode always blocks.

Rule bundles

Rule bundles are vendor-signed .rstb files carrying rule updates, virtual patches and threat-intelligence data. Select Import rule bundle (导入规则包) and drop in the file (up to 64 MiB). An imported bundle does not take effect until you choose Activate this version (激活此版本) in the list.

Each version shows whether it is active, vendor or customer-signed, when and by whom it was imported, the signing key and the file count. Virtual-patch bundles also show the rule count and CVE list. You can switch versions, roll back to the previously active version, disable a bundle and view the activation history. If activation fails, the previous version stays in place. Activating an older version asks you to confirm the downgrade. Rollbacks of the version serial and duplicate imports are refused.

Rule bundles are free. Bundles containing virtual patches need a Professional or higher licence, or the virtual patch subscription add-on. With online updates on, rule bundles can be fetched and applied automatically; see Upgrade and backup.

CRS rule library

Lists every built-in OWASP CRS rule, with no network access needed. Filter by rule ID, description, tag, category, severity, PL and status, and see hits over the last 7 days.

Each rule can be overridden globally or per site:

OverrideBehaviour
Default / Follow globalNo override
Disabled (禁用)The rule is no longer loaded
Log only (仅记录)Matches and logs events as usual but adds nothing to the anomaly score
Enabled (启用)Site overrides only

Flow-control rules and rules already removed by RST WAF tuning cannot be overridden, and chained rules cannot be set to log only. Rule details show category, phase, owning module and its current mode, hits, overrides at each scope, allow rules that reference it and the rule source. Select several rules for bulk actions.

Heightened protection mode

Heightened protection mode switches to stricter protection for major events with one action and restores the previous configuration automatically when it ends.

  1. Select Start heightened protection (开启重保).
  2. Choose a preset, the scope (global or selected sites), the start (now or scheduled), the duration (2 hours, 8 hours, 1 day, 3 days, 7 days or a specific end time, up to 31 days) and a note.
  3. Run a rehearsal (演练) first. It lists every change and its estimated impact without writing anything.
  4. After the rehearsal, select Start heightened protection or Schedule (排期).

Built-in presets:

  • Standard (标准重保): 16 low-false-positive modules go to strict, observe becomes block, challenge thresholds tighten, rate-limit thresholds halve and two temporary rules for high request rates and high error rates are added, bans are extended to at least 72 hours, admin paths such as /admin, /manage, /wp-admin, /phpmyadmin and /actuator are limited to allow-listed IPs, and alerting tightens.
  • Maximum (极限重保): every module goes to strict, and access from outside the allowed countries needs a challenge.

Presets can be copied and edited: detection modules, challenge thresholds, rate-limit factor and temporary rules, foreign access, admin path allow list, ban extension and on-call alert channels.

While active, the page shows the time remaining and the changes in effect, and you can change the end time or end early. Manual edits to affected items during the period are reverted when it ends, and recorded in the history.

Configuration publishing

By default, saved changes take effect at once. With Publishing mode (发布模式) on, changes to sites, rules, module modes, access control, rate limits and similar settings go into a draft that you review and publish in one step.

  • Turning on publishing mode needs Modify system settings; the current configuration is recorded as the baseline.
  • Optionally require approval by another account (发布需另一账号审批). Submitters cannot approve their own requests.
  • Drafts show differences as structured, raw, data plane and change log views, and can be published, submitted for approval or discarded.
  • Each version in the publishing history can be loaded as a draft, or rolled back and applied.
  • Approving and rejecting work only from a console session, never with an API token.

On this page