Armor Rule Tuning
Armor Rule Tuning
Google Cloud Armor precon gured rules are complex web application rewall (WAF) rules with
dozens of signatures that are compiled from open source industry standards. Google offers
these rules as-is. The rules enable Google Cloud Armor to evaluate dozens of distinct tra c
signatures by referring to conveniently-named rules, rather than requiring you to de ne each
signature manually.
The following table contains a comprehensive list of precon gured WAF rules that are available
for use in a Google Cloud Armor security policy. The rule source is ModSecurity Core Rule Set
3.0.2 (https://modsecurity.org/crs/).
Google Cloud Armor rule name ModSecurity rule name Current Status
https://cloud.google.com/armor/docs/rule-tuning/ 1/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
Each precon gured rule consists of multiple signatures. Incoming requests are evaluated
against the precon gured rules. A request matches a precon gured rule if the request matches
any of the signatures that are associated with the precon gured rule. A match is made when
the evaluatePreconfiguredExpr() command returns the value true.
If you decide that a precon gured rule matches more tra c than is necessary or if the rule is
blocking tra c that needs to be allowed, the rule can be tuned to disable noisy or otherwise
unnecessary signatures. To disable signatures in a particular precon gured rule, you provide a
list of IDs of the unwanted signatures to the evaluatePreconfiguredExpr() command. For
example, here is an example match condition in the rules language with a tuned rule:
SQL injection
https://cloud.google.com/armor/docs/rule-tuning/ 2/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
owasp-crs-v030001- 1 Looking for basic sql injection. Common attack string for mysql
id942270-sqli
https://cloud.google.com/armor/docs/rule-tuning/ 3/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
https://cloud.google.com/armor/docs/rule-tuning/ 4/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
To con gure a rule at a particular sensitivity level, disable the signatures at greater sensitivity
levels:
evaluatePreconfiguredExpr('sqli-stable', ['owasp-crs-v030001-id942110-sqli',
'owasp-crs-v030001-id942120-sqli',
'owasp-crs-v030001-id942150-sqli',
'owasp-crs-v030001-id942180-sqli',
'owasp-crs-v030001-id942200-sqli',
'owasp-crs-v030001-id942210-sqli',
'owasp-crs-v030001-id942260-sqli',
'owasp-crs-v030001-id942300-sqli',
'owasp-crs-v030001-id942310-sqli',
'owasp-crs-v030001-id942330-sqli',
'owasp-crs-v030001-id942340-sqli',
'owasp-crs-v030001-id942380-sqli',
'owasp-crs-v030001-id942390-sqli',
'owasp-crs-v030001-id942400-sqli',
'owasp-crs-v030001-id942410-sqli',
'owasp-crs-v030001-id942430-sqli',
'owasp-crs-v030001-id942440-sqli',
'owasp-crs-v030001-id942450-sqli',
'owasp-crs-v030001-id942251-sqli',
'owasp-crs-v030001-id942420-sqli',
'owasp-crs-v030001-id942431-sqli',
'owasp-crs-v030001-id942460-sqli',
'owasp-crs-v030001-id942421-sqli',
'owasp-crs-v030001-id942432-sqli']
)
https://cloud.google.com/armor/docs/rule-tuning/ 5/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
evaluatePreconfiguredExpr('sqli-stable', ['owasp-crs-v030001-id942251-sqli',
'owasp-crs-v030001-id942420-sqli',
'owasp-crs-v030001-id942431-sqli',
'owasp-crs-v030001-id942460-sqli',
'owasp-crs-v030001-id942421-sqli',
'owasp-crs-v030001-id942432-sqli']
)
evaluatePreconfiguredExpr('sqli-stable', ['owasp-crs-v030001-id942421-sqli',
'owasp-crs-v030001-id942432-sqli']
)
evaluatePreconfiguredExpr('sqli-stable')
Sensitivity
Signature ID (Rule ID) Description
Level
https://cloud.google.com/armor/docs/rule-tuning/ 6/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
Sensitivity
Signature ID (Rule ID) Description
Level
https://cloud.google.com/armor/docs/rule-tuning/ 7/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
Sensitivity
Signature ID (Rule ID) Description
Level
To con gure a rule at a particular sensitivity level, disable the signatures at greater sensitivity
levels:
evaluatePreconfiguredExpr('xss-stable', ['owasp-crs-v030001-id941150-xss',
'owasp-crs-v030001-id941320-xss',
'owasp-crs-v030001-id941330-xss',
'owasp-crs-v030001-id941340-xss'])
All signatures for XSS are below sensitivity level 2. The following con guration works for other
sensitivity levels:
https://cloud.google.com/armor/docs/rule-tuning/ 8/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
evaluatePreconfiguredExpr('xss-stable')
All signatures for LFI are at sensitivity level 1. The following con guration works for all
sensitivity levels:
evaluatePreconfiguredExpr('lfi-canary')
https://cloud.google.com/armor/docs/rule-tuning/ 9/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
All signatures for RCE are at sensitivity level 1. The following con guration works for all
sensitivity levels:
evaluatePreconfiguredExpr('rce-canary')
Sensitivity
Signature ID (Rule ID) Description
Level
https://cloud.google.com/armor/docs/rule-tuning/ 10/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
Sensitivity
Signature ID (Rule ID) Description
Level
To con gure a rule at a particular sensitivity level, disable the signatures at greater sensitivity
levels:
evaluatePreconfiguredExpr('rfi-canary', ['owasp-crs-v030001-id931130-rfi'])
evaluatePreconfiguredExpr('rfi-canary')
What's next
To con gure security policies, rules, and expressions, use the instructions in Con guring
security policies (/armor/docs/con gure-security-policies) and Creating Google Cloud Armor
security policies, rules, and expressions
(/armor/docs/con gure-security-policies#creating-policy-rules).
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
(https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the Apache 2.0 License
(https://www.apache.org/licenses/LICENSE-2.0). For details, see the Google Developers Site Policies
(https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its a liates.
https://cloud.google.com/armor/docs/rule-tuning/ 11/12
8/23/2020 Tuning Google Cloud Armor WAF rules | Google Cloud Armor Documentation
https://cloud.google.com/armor/docs/rule-tuning/ 12/12