@abtnode/router-provider 1.16.38-beta-20250116-083413-dbd33222 → 1.16.38-beta-20250118-033334-2da05ae8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/lib/nginx/includes/security/crs4/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example +200 -0
  2. package/lib/nginx/includes/security/crs4/rules/REQUEST-901-INITIALIZATION.conf +470 -0
  3. package/lib/nginx/includes/security/crs4/rules/REQUEST-905-COMMON-EXCEPTIONS.conf +57 -0
  4. package/lib/nginx/includes/security/crs4/rules/REQUEST-911-METHOD-ENFORCEMENT.conf +76 -0
  5. package/lib/nginx/includes/security/crs4/rules/REQUEST-913-SCANNER-DETECTION.conf +86 -0
  6. package/lib/nginx/includes/security/crs4/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf +1915 -0
  7. package/lib/nginx/includes/security/crs4/rules/REQUEST-921-PROTOCOL-ATTACK.conf +558 -0
  8. package/lib/nginx/includes/security/crs4/rules/REQUEST-922-MULTIPART-ATTACK.conf +120 -0
  9. package/lib/nginx/includes/security/crs4/rules/REQUEST-930-APPLICATION-ATTACK-LFI.conf +203 -0
  10. package/lib/nginx/includes/security/crs4/rules/REQUEST-931-APPLICATION-ATTACK-RFI.conf +189 -0
  11. package/lib/nginx/includes/security/crs4/rules/REQUEST-932-APPLICATION-ATTACK-RCE.conf +1875 -0
  12. package/lib/nginx/includes/security/crs4/rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf +774 -0
  13. package/lib/nginx/includes/security/crs4/rules/REQUEST-934-APPLICATION-ATTACK-GENERIC.conf +366 -0
  14. package/lib/nginx/includes/security/crs4/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf +1071 -0
  15. package/lib/nginx/includes/security/crs4/rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf +1978 -0
  16. package/lib/nginx/includes/security/crs4/rules/REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION.conf +132 -0
  17. package/lib/nginx/includes/security/crs4/rules/REQUEST-944-APPLICATION-ATTACK-JAVA.conf +463 -0
  18. package/lib/nginx/includes/security/crs4/rules/REQUEST-949-BLOCKING-EVALUATION.conf +270 -0
  19. package/lib/nginx/includes/security/crs4/rules/RESPONSE-950-DATA-LEAKAGES.conf +156 -0
  20. package/lib/nginx/includes/security/crs4/rules/RESPONSE-951-DATA-LEAKAGES-SQL.conf +417 -0
  21. package/lib/nginx/includes/security/crs4/rules/RESPONSE-952-DATA-LEAKAGES-JAVA.conf +108 -0
  22. package/lib/nginx/includes/security/crs4/rules/RESPONSE-953-DATA-LEAKAGES-PHP.conf +158 -0
  23. package/lib/nginx/includes/security/crs4/rules/RESPONSE-954-DATA-LEAKAGES-IIS.conf +152 -0
  24. package/lib/nginx/includes/security/crs4/rules/RESPONSE-955-WEB-SHELLS.conf +558 -0
  25. package/lib/nginx/includes/security/crs4/rules/RESPONSE-959-BLOCKING-EVALUATION.conf +280 -0
  26. package/lib/nginx/includes/security/crs4/rules/RESPONSE-980-CORRELATION.conf +138 -0
  27. package/lib/nginx/includes/security/crs4/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example +76 -0
  28. package/lib/nginx/includes/security/crs4/rules/iis-errors.data +59 -0
  29. package/lib/nginx/includes/security/crs4/rules/java-classes.data +64 -0
  30. package/lib/nginx/includes/security/crs4/rules/java-code-leakages.data +17 -0
  31. package/lib/nginx/includes/security/crs4/rules/java-errors.data +10 -0
  32. package/lib/nginx/includes/security/crs4/rules/lfi-os-files.data +722 -0
  33. package/lib/nginx/includes/security/crs4/rules/php-config-directives.data +571 -0
  34. package/lib/nginx/includes/security/crs4/rules/php-errors-pl2.data +7 -0
  35. package/lib/nginx/includes/security/crs4/rules/php-errors.data +2147 -0
  36. package/lib/nginx/includes/security/crs4/rules/php-function-names-933150.data +245 -0
  37. package/lib/nginx/includes/security/crs4/rules/php-function-names-933151.data +2201 -0
  38. package/lib/nginx/includes/security/crs4/rules/php-variables.data +30 -0
  39. package/lib/nginx/includes/security/crs4/rules/restricted-files.data +284 -0
  40. package/lib/nginx/includes/security/crs4/rules/restricted-upload.data +177 -0
  41. package/lib/nginx/includes/security/crs4/rules/scanners-user-agents.data +119 -0
  42. package/lib/nginx/includes/security/crs4/rules/sql-errors.data +172 -0
  43. package/lib/nginx/includes/security/crs4/rules/ssrf.data +177 -0
  44. package/lib/nginx/includes/security/crs4/rules/unix-shell.data +670 -0
  45. package/lib/nginx/includes/security/crs4/rules/web-shells-php.data +167 -0
  46. package/lib/nginx/includes/security/crs4/rules/windows-powershell-commands.data +425 -0
  47. package/lib/nginx/includes/security/unicode.mapping +96 -0
  48. package/lib/nginx/index.js +50 -3
  49. package/lib/nginx/templates/security/crs4/crs-setup.conf.js +857 -0
  50. package/lib/nginx/templates/security/modsecurity.conf.js +244 -0
  51. package/package.json +7 -6
@@ -0,0 +1,200 @@
1
+ # ------------------------------------------------------------------------
2
+ # OWASP CRS ver.4.9.0
3
+ # Copyright (c) 2006-2020 Trustwave and contributors. All rights reserved.
4
+ # Copyright (c) 2021-2024 CRS project. All rights reserved.
5
+ #
6
+ # The OWASP CRS is distributed under
7
+ # Apache Software License (ASL) version 2
8
+ # Please see the enclosed LICENSE file for full details.
9
+ # ------------------------------------------------------------------------
10
+
11
+ #
12
+ # The purpose of this file is to hold LOCAL exceptions for your site. The
13
+ # types of rules that would go into this file are one where you want to
14
+ # short-circuit inspection and allow certain transactions to pass through
15
+ # inspection or if you want to alter rules that are applied.
16
+ #
17
+ # This file is named REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example for a
18
+ # very specific reason. Files affixed with the .example extension are designed
19
+ # to contain user created/modified data. The '.example'. extension should be
20
+ # renamed to end in .conf. The advantage of this is that when OWASP CRS is
21
+ # updated, the updates will not overwrite a user generated configuration file.
22
+ #
23
+ # As a result of this design paradigm users are encouraged NOT to directly
24
+ # modify rules. Instead they should use this
25
+ # REQUEST-900-EXCLUSION-RULES-BEFORE-CRS and the
26
+ # RESPONSE-999-EXCLUSION-RULES-AFTER-CRS file to modify OWASP rules using
27
+ # methods similar to the examples specified below.
28
+ #
29
+ # REQUEST-900-EXCLUSION-RULES-BEFORE-CRS and
30
+ # RESPONSE-999-EXCLUSION-RULES-AFTER-CRS serve different purposes. ModSecurity
31
+ # effectively maintains two different context: startup, and per transaction.
32
+ # As a rule, directives are processed within the startup context. While they
33
+ # can affect the per transaction context they generally remain fixed during the
34
+ # execution of ModSecurity.
35
+ #
36
+ # As a result if one wanted to disable a rule at bootup the SecRuleRemoveById
37
+ # directive or one of its siblings would have to be placed AFTER the rule is
38
+ # listed, otherwise it will not have knowledge of the rules existence (since
39
+ # these rules are read in at the same time). This means that when using
40
+ # directives that effect SecRules, these exceptions should be placed AFTER all
41
+ # the existing rules. This is why RESPONSE-999-EXCLUSION-RULES-AFTER-CRS is
42
+ # designed such that it loads LAST.
43
+ #
44
+ # Conversely, ModSecurity supports several actions that can change the state of
45
+ # the underlying configuration during the per transaction context, this is when
46
+ # rules are being processed. Generally, these are accomplished by using the
47
+ # 'ctl' action. As these are part of a rule, they will be evaluated in the
48
+ # order rules are applied (by physical location, considering phases). As a
49
+ # result of this ordering a 'ctl' action should be placed with consideration to
50
+ # when it will be executed. This is particularly relevant for the 'ctl' options
51
+ # that involve modifying ID's (such as ruleRemoveById). In these cases it is
52
+ # important that such rules are placed BEFORE the rule ID they will affect.
53
+ # Unlike the setup context, by the time we process rules in the per-transaction
54
+ # context, we are already aware of all the rule ID's. It is by this logic that
55
+ # we include rules such as this BEFORE all the remaining rules. As a result
56
+ # REQUEST-900-EXCLUSION-RULES-BEFORE-CRS is designed to load FIRST.
57
+ #
58
+ # As a general rule:
59
+ # ctl:ruleEngine -> place in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS
60
+ # ctl:ruleRemoveById -> place in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS
61
+ # ctl:ruleRemoveByMsg -> place in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS
62
+ # ctl:ruleRemoveByTag -> place in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS
63
+ # ctl:ruleRemoveTargetById -> place in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS
64
+ # ctl:ruleRemoveTargetByMsg -> place in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS
65
+ # ctl:ruleRemoveTargetByTag -> place in REQUEST-900-EXCLUSION-RULES-BEFORE-CRS
66
+ #
67
+ # SecRuleRemoveById -> place in RESPONSE-999-EXCLUSION-RULES-AFTER-CRS
68
+ # SecRuleRemoveByMsg -> place in RESPONSE-999-EXCLUSION-RULES-AFTER-CRS
69
+ # SecRuleRemoveByTag -> place in RESPONSE-999-EXCLUSION-RULES-AFTER-CRS
70
+ # SecRuleUpdateActionById -> place in RESPONSE-999-EXCLUSION-RULES-AFTER-CRS
71
+ # SecRuleUpdateTargetById -> place in RESPONSE-999-EXCLUSION-RULES-AFTER-CRS
72
+ # SecRuleUpdateTargetByMsg -> place in RESPONSE-999-EXCLUSION-RULES-AFTER-CRS
73
+ # SecRuleUpdateTargetByTag -> place in RESPONSE-999-EXCLUSION-RULES-AFTER-CRS
74
+ #
75
+ #
76
+ # What follows are a group of examples that show you how to perform rule
77
+ # exclusions.
78
+ #
79
+ #
80
+ # Example Exclusion Rule: Disable inspection for an authorized client
81
+ #
82
+ # This ruleset allows you to control how ModSecurity will handle traffic
83
+ # originating from Authorized Vulnerability Scanning (AVS) sources. See
84
+ # related blog post -
85
+ # https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/updated-advanced-topic-of-the-week-handling-authorized-scanning-traffic/
86
+ #
87
+ # Allow List ASV network block (no blocking or logging of AVS traffic) Update
88
+ # IP network block as appropriate for your AVS traffic
89
+ #
90
+ # ModSec Rule Exclusion: Disable Rule Engine for known ASV IP
91
+ # SecRule REMOTE_ADDR "@ipMatch 192.168.1.100" \
92
+ # "id:1000,\
93
+ # phase:1,\
94
+ # pass,\
95
+ # nolog,\
96
+ # ctl:ruleEngine=Off"
97
+ #
98
+ #
99
+ # Example Exclusion Rule: Removing a specific ARGS parameter from inspection
100
+ # for an individual rule
101
+ #
102
+ # This rule shows how to conditionally exclude the "password"
103
+ # parameter for rule 942100 when the REQUEST_URI is /index.php
104
+ # ModSecurity Rule Exclusion: 942100 SQL Injection Detected via libinjection
105
+ #
106
+ # SecRule REQUEST_URI "@beginsWith /index.php" \
107
+ # "id:1001,\
108
+ # phase:1,\
109
+ # pass,\
110
+ # nolog,\
111
+ # ctl:ruleRemoveTargetById=942100;ARGS:password"
112
+ #
113
+ #
114
+ # Example Exclusion Rule: Removing a specific ARGS parameter from inspection
115
+ # for only certain attacks
116
+ #
117
+ # Attack rules within the CRS are tagged, with tags such as 'attack-lfi',
118
+ # 'attack-sqli', 'attack-xss', 'attack-injection-php', et cetera.
119
+ #
120
+ # ModSecurity Rule Exclusion: Disable inspection of ARGS:pwd
121
+ # for all rules tagged attack-sqli
122
+ # SecRule REQUEST_FILENAME "@endsWith /wp-login.php" \
123
+ # "id:1002,\
124
+ # phase:2,\
125
+ # pass,\
126
+ # nolog,\
127
+ # ctl:ruleRemoveTargetByTag=attack-sqli;ARGS:pwd"
128
+ #
129
+
130
+ # Example Exclusion Rule: Removing a specific ARGS parameter from inspection
131
+ # for all CRS rules
132
+ #
133
+ # This rule illustrates that we can use tagging very effectively to allow list a
134
+ # common false positive across an entire ModSecurity instance. This can be done
135
+ # because every rule in OWASP_CRS is tagged with OWASP_CRS. This will NOT
136
+ # affect custom rules.
137
+ #
138
+ # ModSecurity Rule Exclusion: Disable inspection of ARGS:pwd
139
+ # for all CRS rules
140
+ # SecRule REQUEST_FILENAME "@endsWith /wp-login.php" \
141
+ # "id:1003,\
142
+ # phase:2,\
143
+ # pass,\
144
+ # nolog,\
145
+ # ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pwd"
146
+
147
+ #
148
+ # Example Exclusion Rule: Removing a range of rules
149
+ #
150
+ # This rule illustrates that we can remove a rule range via a ctl action.
151
+ # This uses the fact, that rules are grouped by topic in rule files covering
152
+ # a certain id range.
153
+ # IMPORTANT: ModSecurity v3, aka libModSecurity, does not currently support the
154
+ # use of rule ranges in a ruleRemoveById ctl action (this feature has been
155
+ # planned for v3.1). Consider using ruleRemoveByTag as a workaround, if
156
+ # appropriate.
157
+ #
158
+ # ModSecurity Rule Exclusion: Disable all SQLi and XSS rules
159
+ # SecRule REQUEST_FILENAME "@beginsWith /admin" \
160
+ # "id:1004,\
161
+ # phase:2,\
162
+ # pass,\
163
+ # nolog,\
164
+ # ctl:ruleRemoveById=941000-942999"
165
+ #
166
+ #
167
+ # The application-specific rule exclusion plugins
168
+ # (see: https://github.com/coreruleset/plugin-registry)
169
+ # provide additional examples which can be useful then tuning a service.
170
+
171
+
172
+ #
173
+ # Example Rule: Allow monitoring tools and scripts
174
+ #
175
+ # Uncomment this rule to allow all requests from trusted IPs and User-Agent.
176
+ # This can be useful for monitoring tools like Monit, Nagios, or other agents.
177
+ # For example, if you're using AWS Load Balancer, you may need to trust all
178
+ # requests from "10.0.0.0/8" subnet that come with the user-agent
179
+ # "ELB-HealthChecker/2.0". By doing this, all requests that match these
180
+ # conditions will not be matched against the following rules:
181
+ #
182
+ # - id: 911100 (allowed methods)
183
+ # - id: 913100 (scan detection)
184
+ # - id: 920280 (missing/empty host header)
185
+ # - id: 920350 (IP address in host header)
186
+ # - tag: attack-disclosure (all RESPONSE-*-DATA-LEAKAGES rules)
187
+ #
188
+ # SecRule REMOTE_ADDR "@ipMatch 10.0.0.0/8" \
189
+ # "id:1005,\
190
+ # phase:1,\
191
+ # pass,\
192
+ # nolog,\
193
+ # chain"
194
+ # SecRule REQUEST_METHOD "@pm GET HEAD" "chain"
195
+ # SecRule REQUEST_HEADERS:User-Agent "@pm ELB-HealthChecker" \
196
+ # "ctl:ruleRemoveById=911100,\
197
+ # ctl:ruleRemoveById=913100,\
198
+ # ctl:ruleRemoveById=920280,\
199
+ # ctl:ruleRemoveById=920350,\
200
+ # ctl:ruleRemoveByTag=attack-disclosure"
@@ -0,0 +1,470 @@
1
+ # ------------------------------------------------------------------------
2
+ # OWASP CRS ver.4.9.0
3
+ # Copyright (c) 2006-2020 Trustwave and contributors. All rights reserved.
4
+ # Copyright (c) 2021-2024 CRS project. All rights reserved.
5
+ #
6
+ # The OWASP CRS is distributed under
7
+ # Apache Software License (ASL) version 2
8
+ # Please see the enclosed LICENSE file for full details.
9
+ # ------------------------------------------------------------------------
10
+
11
+ #
12
+ # This file REQUEST-901-INITIALIZATION.conf initializes the Core Rules
13
+ # and performs preparatory actions. It also fixes errors and omissions
14
+ # of variable definitions in the file crs-setup.conf.
15
+ # The crs-setup.conf can and should be edited by the user, this file
16
+ # is part of the CRS installation and should not be altered.
17
+ #
18
+
19
+
20
+ #
21
+ # -=[ Rules Version ]=-
22
+ #
23
+ # Rule version data is added to the "Producer" line of Section H of the Audit log:
24
+ #
25
+ # - Producer: ModSecurity for Apache/2.9.1 (http://www.modsecurity.org/); OWASP_CRS/3.1.0.
26
+ #
27
+ # Ref: https://github.com/owasp-modsecurity/ModSecurity/wiki/Reference-Manual-(v2.x)#seccomponentsignature
28
+ #
29
+ SecComponentSignature "OWASP_CRS/4.9.0"
30
+
31
+ #
32
+ # -=[ Default setup values ]=-
33
+ #
34
+ # The CRS checks the tx.crs_setup_version variable to ensure that the setup
35
+ # file is included at the correct time. This detects situations where
36
+ # necessary settings are not defined, for instance if the file
37
+ # inclusion order is incorrect, or if the user has forgotten to
38
+ # include the crs-setup.conf file.
39
+ #
40
+ # If you are upgrading from an earlier version of the CRS and you are
41
+ # getting this error, please make a new copy of the setup template
42
+ # crs-setup.conf.example to crs-setup.conf, and re-apply your policy
43
+ # changes. There have been many changes in settings syntax from CRS2
44
+ # to CRS3, so an old setup file may cause unwanted behavior.
45
+ #
46
+ # If you are not planning to use the crs-setup.conf template, you must
47
+ # manually set the tx.crs_setup_version variable before including
48
+ # the CRS rules/* files.
49
+ #
50
+ # The variable is a numerical representation of the CRS version number.
51
+ # E.g., v3.0.0 is represented as 300.
52
+ #
53
+
54
+ SecRule &TX:crs_setup_version "@eq 0" \
55
+ "id:901001,\
56
+ phase:1,\
57
+ deny,\
58
+ status:500,\
59
+ log,\
60
+ auditlog,\
61
+ msg:'CRS is deployed without configuration! Please copy the crs-setup.conf.example template to crs-setup.conf, and include the crs-setup.conf file in your webserver configuration before including the CRS rules. See the INSTALL file in the CRS directory for detailed instructions',\
62
+ tag:'OWASP_CRS',\
63
+ ver:'OWASP_CRS/4.9.0',\
64
+ severity:'CRITICAL'"
65
+
66
+
67
+ #
68
+ # -=[ Default setup values ]=-
69
+ #
70
+ # Some constructs or individual rules will fail if certain parameters
71
+ # are not set in the crs-setup.conf file. The following rules will catch
72
+ # these cases and assign sane default values.
73
+ #
74
+
75
+ # Default Inbound Anomaly Threshold Level (rule 900110 in crs-setup.conf)
76
+ SecRule &TX:inbound_anomaly_score_threshold "@eq 0" \
77
+ "id:901100,\
78
+ phase:1,\
79
+ pass,\
80
+ nolog,\
81
+ tag:'OWASP_CRS',\
82
+ ver:'OWASP_CRS/4.9.0',\
83
+ setvar:'tx.inbound_anomaly_score_threshold=5'"
84
+
85
+ # Default Outbound Anomaly Threshold Level (rule 900110 in crs-setup.conf)
86
+ SecRule &TX:outbound_anomaly_score_threshold "@eq 0" \
87
+ "id:901110,\
88
+ phase:1,\
89
+ pass,\
90
+ nolog,\
91
+ tag:'OWASP_CRS',\
92
+ ver:'OWASP_CRS/4.9.0',\
93
+ setvar:'tx.outbound_anomaly_score_threshold=4'"
94
+
95
+ # Default Reporting Level (rule 900115 in crs-setup.conf)
96
+ SecRule &TX:reporting_level "@eq 0" \
97
+ "id:901111,\
98
+ phase:1,\
99
+ pass,\
100
+ nolog,\
101
+ tag:'OWASP_CRS',\
102
+ ver:'OWASP_CRS/4.9.0',\
103
+ setvar:'tx.reporting_level=4'"
104
+
105
+ # Default Early Blocking (rule 900120 in crs-setup.conf)
106
+ SecRule &TX:early_blocking "@eq 0" \
107
+ "id:901115,\
108
+ phase:1,\
109
+ pass,\
110
+ nolog,\
111
+ tag:'OWASP_CRS',\
112
+ ver:'OWASP_CRS/4.9.0',\
113
+ setvar:'tx.early_blocking=0'"
114
+
115
+ # Default Blocking Paranoia Level (rule 900000 in crs-setup.conf)
116
+ SecRule &TX:blocking_paranoia_level "@eq 0" \
117
+ "id:901120,\
118
+ phase:1,\
119
+ pass,\
120
+ nolog,\
121
+ tag:'OWASP_CRS',\
122
+ ver:'OWASP_CRS/4.9.0',\
123
+ setvar:'tx.blocking_paranoia_level=1'"
124
+
125
+ # Default Detection Paranoia Level (rule 900001 in crs-setup.conf)
126
+ SecRule &TX:detection_paranoia_level "@eq 0" \
127
+ "id:901125,\
128
+ phase:1,\
129
+ pass,\
130
+ nolog,\
131
+ tag:'OWASP_CRS',\
132
+ ver:'OWASP_CRS/4.9.0',\
133
+ setvar:'tx.detection_paranoia_level=%{TX.blocking_paranoia_level}'"
134
+
135
+ # Default Sampling Percentage (rule 900400 in crs-setup.conf)
136
+ SecRule &TX:sampling_percentage "@eq 0" \
137
+ "id:901130,\
138
+ phase:1,\
139
+ pass,\
140
+ nolog,\
141
+ tag:'OWASP_CRS',\
142
+ ver:'OWASP_CRS/4.9.0',\
143
+ setvar:'tx.sampling_percentage=100'"
144
+
145
+ # Default Anomaly Scores (rule 900100 in crs-setup.conf)
146
+ SecRule &TX:critical_anomaly_score "@eq 0" \
147
+ "id:901140,\
148
+ phase:1,\
149
+ pass,\
150
+ nolog,\
151
+ tag:'OWASP_CRS',\
152
+ ver:'OWASP_CRS/4.9.0',\
153
+ setvar:'tx.critical_anomaly_score=5'"
154
+
155
+ SecRule &TX:error_anomaly_score "@eq 0" \
156
+ "id:901141,\
157
+ phase:1,\
158
+ pass,\
159
+ nolog,\
160
+ tag:'OWASP_CRS',\
161
+ ver:'OWASP_CRS/4.9.0',\
162
+ setvar:'tx.error_anomaly_score=4'"
163
+
164
+ SecRule &TX:warning_anomaly_score "@eq 0" \
165
+ "id:901142,\
166
+ phase:1,\
167
+ pass,\
168
+ nolog,\
169
+ tag:'OWASP_CRS',\
170
+ ver:'OWASP_CRS/4.9.0',\
171
+ setvar:'tx.warning_anomaly_score=3'"
172
+
173
+ SecRule &TX:notice_anomaly_score "@eq 0" \
174
+ "id:901143,\
175
+ phase:1,\
176
+ pass,\
177
+ nolog,\
178
+ tag:'OWASP_CRS',\
179
+ ver:'OWASP_CRS/4.9.0',\
180
+ setvar:'tx.notice_anomaly_score=2'"
181
+
182
+ # Default HTTP policy: allowed_methods (rule 900200 in crs-setup.conf)
183
+ SecRule &TX:allowed_methods "@eq 0" \
184
+ "id:901160,\
185
+ phase:1,\
186
+ pass,\
187
+ nolog,\
188
+ tag:'OWASP_CRS',\
189
+ ver:'OWASP_CRS/4.9.0',\
190
+ setvar:'tx.allowed_methods=GET HEAD POST OPTIONS'"
191
+
192
+ # Default HTTP policy: allowed_request_content_type (rule 900220 in crs-setup.conf)
193
+ SecRule &TX:allowed_request_content_type "@eq 0" \
194
+ "id:901162,\
195
+ phase:1,\
196
+ pass,\
197
+ nolog,\
198
+ tag:'OWASP_CRS',\
199
+ ver:'OWASP_CRS/4.9.0',\
200
+ setvar:'tx.allowed_request_content_type=|application/x-www-form-urlencoded| |multipart/form-data| |text/xml| |application/xml| |application/soap+xml| |application/json|'"
201
+
202
+ # Default HTTP policy: allowed_request_content_type_charset (rule 900280 in crs-setup.conf)
203
+ SecRule &TX:allowed_request_content_type_charset "@eq 0" \
204
+ "id:901168,\
205
+ phase:1,\
206
+ pass,\
207
+ nolog,\
208
+ tag:'OWASP_CRS',\
209
+ ver:'OWASP_CRS/4.9.0',\
210
+ setvar:'tx.allowed_request_content_type_charset=|utf-8| |iso-8859-1| |iso-8859-15| |windows-1252|'"
211
+
212
+ # Default HTTP policy: allowed_http_versions (rule 900230 in crs-setup.conf)
213
+ SecRule &TX:allowed_http_versions "@eq 0" \
214
+ "id:901163,\
215
+ phase:1,\
216
+ pass,\
217
+ nolog,\
218
+ tag:'OWASP_CRS',\
219
+ ver:'OWASP_CRS/4.9.0',\
220
+ setvar:'tx.allowed_http_versions=HTTP/1.0 HTTP/1.1 HTTP/2 HTTP/2.0 HTTP/3 HTTP/3.0'"
221
+
222
+ # Default HTTP policy: restricted_extensions (rule 900240 in crs-setup.conf)
223
+ SecRule &TX:restricted_extensions "@eq 0" \
224
+ "id:901164,\
225
+ phase:1,\
226
+ pass,\
227
+ nolog,\
228
+ tag:'OWASP_CRS',\
229
+ ver:'OWASP_CRS/4.9.0',\
230
+ setvar:'tx.restricted_extensions=.asa/ .asax/ .ascx/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pem/ .pol/ .printer/ .pwd/ .rdb/ .resources/ .resx/ .sql/ .swp/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/'"
231
+
232
+ # Default HTTP policy: restricted_headers_basic (rule 900250 in crs-setup.conf)
233
+ SecRule &TX:restricted_headers_basic "@eq 0" \
234
+ "id:901165,\
235
+ phase:1,\
236
+ pass,\
237
+ nolog,\
238
+ tag:'OWASP_CRS',\
239
+ ver:'OWASP_CRS/4.9.0',\
240
+ setvar:'tx.restricted_headers_basic=/content-encoding/ /proxy/ /lock-token/ /content-range/ /if/ /x-http-method-override/ /x-http-method/ /x-method-override/'"
241
+
242
+ # Default HTTP policy: restricted_headers_extended (rule 900255 in crs-setup.conf)
243
+ SecRule &TX:restricted_headers_extended "@eq 0" \
244
+ "id:901171,\
245
+ phase:1,\
246
+ pass,\
247
+ nolog,\
248
+ tag:'OWASP_CRS',\
249
+ ver:'OWASP_CRS/4.9.0',\
250
+ setvar:'tx.restricted_headers_extended=/accept-charset/'"
251
+
252
+ # Default enforcing of body processor URLENCODED (rule 900010 in crs-setup.conf)
253
+ SecRule &TX:enforce_bodyproc_urlencoded "@eq 0" \
254
+ "id:901167,\
255
+ phase:1,\
256
+ pass,\
257
+ nolog,\
258
+ tag:'OWASP_CRS',\
259
+ ver:'OWASP_CRS/4.9.0',\
260
+ setvar:'tx.enforce_bodyproc_urlencoded=0'"
261
+
262
+ # Default check for UTF8 encoding validation (rule 900950 in crs-setup.conf)
263
+ SecRule &TX:crs_validate_utf8_encoding "@eq 0" \
264
+ "id:901169,\
265
+ phase:1,\
266
+ pass,\
267
+ nolog,\
268
+ tag:'OWASP_CRS',\
269
+ ver:'OWASP_CRS/4.9.0',\
270
+ setvar:'tx.crs_validate_utf8_encoding=0'"
271
+
272
+ # Default check for skipping response analysis (rule 900500 in crs-setup.conf)
273
+ SecRule &TX:crs_skip_response_analysis "@eq 0" \
274
+ "id:901170,\
275
+ phase:1,\
276
+ pass,\
277
+ nolog,\
278
+ tag:'OWASP_CRS',\
279
+ ver:'OWASP_CRS/4.9.0',\
280
+ setvar:'tx.crs_skip_response_analysis=0'"
281
+
282
+ #
283
+ # -=[ Initialize internal variables ]=-
284
+ #
285
+
286
+ # Initialize anomaly scoring variables.
287
+ # All _score variables start at 0, and are incremented by the various rules
288
+ # upon detection of a possible attack.
289
+
290
+ SecAction \
291
+ "id:901200,\
292
+ phase:1,\
293
+ pass,\
294
+ t:none,\
295
+ nolog,\
296
+ tag:'OWASP_CRS',\
297
+ ver:'OWASP_CRS/4.9.0',\
298
+ setvar:'tx.blocking_inbound_anomaly_score=0',\
299
+ setvar:'tx.detection_inbound_anomaly_score=0',\
300
+ setvar:'tx.inbound_anomaly_score_pl1=0',\
301
+ setvar:'tx.inbound_anomaly_score_pl2=0',\
302
+ setvar:'tx.inbound_anomaly_score_pl3=0',\
303
+ setvar:'tx.inbound_anomaly_score_pl4=0',\
304
+ setvar:'tx.sql_injection_score=0',\
305
+ setvar:'tx.xss_score=0',\
306
+ setvar:'tx.rfi_score=0',\
307
+ setvar:'tx.lfi_score=0',\
308
+ setvar:'tx.rce_score=0',\
309
+ setvar:'tx.php_injection_score=0',\
310
+ setvar:'tx.http_violation_score=0',\
311
+ setvar:'tx.session_fixation_score=0',\
312
+ setvar:'tx.blocking_outbound_anomaly_score=0',\
313
+ setvar:'tx.detection_outbound_anomaly_score=0',\
314
+ setvar:'tx.outbound_anomaly_score_pl1=0',\
315
+ setvar:'tx.outbound_anomaly_score_pl2=0',\
316
+ setvar:'tx.outbound_anomaly_score_pl3=0',\
317
+ setvar:'tx.outbound_anomaly_score_pl4=0',\
318
+ setvar:'tx.anomaly_score=0'"
319
+
320
+
321
+ #
322
+ # -=[ Initialize collections ]=-
323
+ #
324
+ # Create both Global and IP collections for rules to use.
325
+ # Some plugins assume that these two collections have already
326
+ # been initialized.
327
+ # IP collection is initialized with the IP address concatened with the hashed user agent.
328
+
329
+ # Disable collection initialization by default (see rule 900130 in crs-setup.conf)
330
+ # The creation of the IP and the GLOBAL collection is not being tested as
331
+ # of this writing due to limits in ftw and our testing setup.
332
+ # Proper testing would involve the checking of a variable in the said collections.
333
+ SecRule TX:ENABLE_DEFAULT_COLLECTIONS "@eq 1" \
334
+ "id:901320,\
335
+ phase:1,\
336
+ pass,\
337
+ nolog,\
338
+ tag:'OWASP_CRS',\
339
+ ver:'OWASP_CRS/4.9.0',\
340
+ setvar:'tx.ua_hash=%{REQUEST_HEADERS.User-Agent}',\
341
+ chain"
342
+ SecRule TX:ua_hash "@unconditionalMatch" \
343
+ "t:none,t:sha1,t:hexEncode,\
344
+ initcol:global=global,\
345
+ initcol:ip=%{remote_addr}_%{MATCHED_VAR}"
346
+
347
+ #
348
+ # -=[ Initialize Correct Body Processing ]=-
349
+ #
350
+ # Force request body variable and optionally request body processor
351
+ #
352
+
353
+ # Force body variable
354
+ SecRule REQBODY_PROCESSOR "!@rx (?:URLENCODED|MULTIPART|XML|JSON)" \
355
+ "id:901340,\
356
+ phase:1,\
357
+ pass,\
358
+ nolog,\
359
+ noauditlog,\
360
+ msg:'Enabling body inspection',\
361
+ tag:'OWASP_CRS',\
362
+ ctl:forceRequestBodyVariable=On,\
363
+ ver:'OWASP_CRS/4.9.0'"
364
+
365
+ # Force body processor URLENCODED
366
+ SecRule TX:enforce_bodyproc_urlencoded "@eq 1" \
367
+ "id:901350,\
368
+ phase:1,\
369
+ pass,\
370
+ t:none,t:urlDecodeUni,\
371
+ nolog,\
372
+ noauditlog,\
373
+ msg:'Enabling forced body inspection for ASCII content',\
374
+ tag:'OWASP_CRS',\
375
+ ver:'OWASP_CRS/4.9.0',\
376
+ chain"
377
+ SecRule REQBODY_PROCESSOR "!@rx (?:URLENCODED|MULTIPART|XML|JSON)" \
378
+ "ctl:requestBodyProcessor=URLENCODED"
379
+
380
+
381
+ #
382
+ # -=[ Easing In / Sampling Percentage ]=-
383
+ #
384
+ # This is used to send only a limited percentage of requests into the Core
385
+ # Rule Set. The selection is based on TX.sampling_percentage and a pseudo
386
+ # random number calculated below.
387
+ #
388
+ # Use this to ease into a new Core Rules installation with an existing
389
+ # productive service.
390
+ #
391
+ # See
392
+ # https://www.netnea.com/cms/2016/04/26/easing-in-conditional-modsecurity-rule-execution-based-on-pseudo-random-numbers/
393
+ #
394
+
395
+ #
396
+ # Generate the pseudo random number
397
+ #
398
+ # ATTENTION: This is no cryptographically secure random number. It's just
399
+ # a cheap way to get some random number suitable for sampling.
400
+ #
401
+ # We take the entropy contained in the UNIQUE_ID. We hash that variable and
402
+ # take the first integer numbers out of it. Theoretically, it is possible
403
+ # but highly improbable that there are no integers in a hexEncoded sha1 hash.
404
+ # In the very rare event that two integers are not matched (due to only being
405
+ # a-f in all, or all but one positions) 901450 will not be triggered.
406
+ # Leading zeros are not removed from the two-digit random number, and are
407
+ # handled gracefullly by 901450
408
+
409
+ SecRule TX:sampling_percentage "@eq 100" \
410
+ "id:901400,\
411
+ phase:1,\
412
+ pass,\
413
+ nolog,\
414
+ tag:'OWASP_CRS',\
415
+ ver:'OWASP_CRS/4.9.0',\
416
+ skipAfter:END-SAMPLING"
417
+
418
+ SecRule UNIQUE_ID "@rx ^[a-f]*([0-9])[a-f]*([0-9])" \
419
+ "id:901410,\
420
+ phase:1,\
421
+ pass,\
422
+ capture,\
423
+ t:sha1,t:hexEncode,\
424
+ nolog,\
425
+ tag:'OWASP_CRS',\
426
+ ver:'OWASP_CRS/4.9.0',\
427
+ setvar:'TX.sampling_rnd100=%{TX.1}%{TX.2}'"
428
+
429
+ #
430
+ # Sampling decision
431
+ #
432
+ # If a request is allowed to pass without being checked by the CRS, there is no
433
+ # entry in the audit log (for performance reasons), but an error log entry is
434
+ # being written. If you want to disable the error log entry, then issue the
435
+ # following directive somewhere after the inclusion of the CRS
436
+ # (E.g., RESPONSE-999-EXCEPTIONS.conf).
437
+ #
438
+ # SecRuleUpdateActionById 901450 "nolog"
439
+ #
440
+
441
+
442
+ SecRule TX:sampling_rnd100 "!@lt %{tx.sampling_percentage}" \
443
+ "id:901450,\
444
+ phase:1,\
445
+ pass,\
446
+ log,\
447
+ noauditlog,\
448
+ msg:'Sampling: Disable the rule engine based on sampling_percentage %{TX.sampling_percentage} and random number %{TX.sampling_rnd100}',\
449
+ tag:'OWASP_CRS',\
450
+ ctl:ruleRemoveByTag=OWASP_CRS,\
451
+ ver:'OWASP_CRS/4.9.0'"
452
+
453
+ SecMarker "END-SAMPLING"
454
+
455
+
456
+ #
457
+ # Configuration Plausibility Checks
458
+ #
459
+
460
+ # Make sure detection paranoia level is not lower than paranoia level
461
+ SecRule TX:detection_paranoia_level "@lt %{tx.blocking_paranoia_level}" \
462
+ "id:901500,\
463
+ phase:1,\
464
+ deny,\
465
+ status:500,\
466
+ t:none,\
467
+ log,\
468
+ msg:'Detection paranoia level configured is lower than the paranoia level itself. This is illegal. Blocking request. Aborting',\
469
+ tag:'OWASP_CRS',\
470
+ ver:'OWASP_CRS/4.9.0'"