@abtnode/router-provider 1.16.38-beta-20250115-235439-bb5a1c1b → 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,558 @@
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
+ # -= Paranoia Level 0 (empty) =- (apply unconditionally)
13
+ #
14
+
15
+
16
+
17
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:921011,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
18
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:921012,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
19
+ #
20
+ # -= Paranoia Level 1 (default) =- (apply only when tx.detection_paranoia_level is sufficiently high: 1 or higher)
21
+ #
22
+
23
+ #
24
+ # -=[ HTTP Request Smuggling ]=-
25
+ #
26
+ # [ Rule Logic ]
27
+ # This rule looks for a HTTP / WEBDAV method name in combination with the word http/\d or a CR/LF character.
28
+ # This would point to an attempt to inject a 2nd request into the request, thus bypassing
29
+ # tests carried out on the primary request.
30
+ #
31
+ # [ References ]
32
+ # http://projects.webappsec.org/HTTP-Request-Smuggling
33
+ #
34
+ SecRule ARGS_NAMES|ARGS|REQUEST_BODY|XML:/* "@rx (?:get|post|head|options|connect|put|delete|trace|track|patch|propfind|propatch|mkcol|copy|move|lock|unlock)\s+[^\s]+\s+http/\d" \
35
+ "id:921110,\
36
+ phase:2,\
37
+ block,\
38
+ capture,\
39
+ t:none,t:htmlEntityDecode,t:lowercase,\
40
+ msg:'HTTP Request Smuggling Attack',\
41
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
42
+ tag:'application-multi',\
43
+ tag:'language-multi',\
44
+ tag:'platform-multi',\
45
+ tag:'attack-protocol',\
46
+ tag:'paranoia-level/1',\
47
+ tag:'OWASP_CRS',\
48
+ tag:'capec/1000/210/272/220/33',\
49
+ ver:'OWASP_CRS/4.9.0',\
50
+ severity:'CRITICAL',\
51
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
52
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
53
+
54
+ #
55
+ # -=[ HTTP Response Splitting ]=-
56
+ #
57
+ # [ Rule Logic ]
58
+ # These rules look for Carriage Return (CR) %0d and Linefeed (LF) %0a characters.
59
+ # These characters may cause problems if the data is returned in a response header and
60
+ # may be interpreted by an intermediary proxy server and treated as two separate
61
+ # responses.
62
+ #
63
+ # [ References ]
64
+ # http://projects.webappsec.org/HTTP-Response-Splitting
65
+ #
66
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx [\r\n]\W*?(?:content-(?:type|length)|set-cookie|location):\s*\w" \
67
+ "id:921120,\
68
+ phase:2,\
69
+ block,\
70
+ capture,\
71
+ t:none,t:lowercase,\
72
+ msg:'HTTP Response Splitting Attack',\
73
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
74
+ tag:'application-multi',\
75
+ tag:'language-multi',\
76
+ tag:'platform-multi',\
77
+ tag:'attack-protocol',\
78
+ tag:'paranoia-level/1',\
79
+ tag:'OWASP_CRS',\
80
+ tag:'capec/1000/210/272/220/34',\
81
+ ver:'OWASP_CRS/4.9.0',\
82
+ severity:'CRITICAL',\
83
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
84
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
85
+
86
+
87
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:\bhttp/\d|<(?:html|meta)\b)" \
88
+ "id:921130,\
89
+ phase:2,\
90
+ block,\
91
+ capture,\
92
+ t:none,t:htmlEntityDecode,t:lowercase,\
93
+ msg:'HTTP Response Splitting Attack',\
94
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
95
+ tag:'application-multi',\
96
+ tag:'language-multi',\
97
+ tag:'platform-multi',\
98
+ tag:'attack-protocol',\
99
+ tag:'paranoia-level/1',\
100
+ tag:'OWASP_CRS',\
101
+ tag:'capec/1000/210/272/220/34',\
102
+ ver:'OWASP_CRS/4.9.0',\
103
+ severity:'CRITICAL',\
104
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
105
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
106
+
107
+ #
108
+ # -=[ HTTP Header Injection ]=-
109
+ #
110
+ # [ Rule Logic ]
111
+ # These rules look for Carriage Return (CR) %0d and Linefeed (LF) %0a characters,
112
+ # on their own or in combination with header field names.
113
+ # These characters may cause problems if the data is returned in a response header
114
+ # and interpreted by the client.
115
+ # The rules are similar to rules defending against the HTTP Request Splitting and
116
+ # Request Smuggling rules.
117
+ #
118
+ # [ References ]
119
+ # https://en.wikipedia.org/wiki/HTTP_header_injection
120
+ #
121
+ SecRule REQUEST_HEADERS_NAMES|REQUEST_HEADERS "@rx [\n\r]" \
122
+ "id:921140,\
123
+ phase:1,\
124
+ block,\
125
+ capture,\
126
+ t:none,t:htmlEntityDecode,\
127
+ msg:'HTTP Header Injection Attack via headers',\
128
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
129
+ tag:'application-multi',\
130
+ tag:'language-multi',\
131
+ tag:'platform-multi',\
132
+ tag:'attack-protocol',\
133
+ tag:'paranoia-level/1',\
134
+ tag:'OWASP_CRS',\
135
+ tag:'capec/1000/210/272/220/273',\
136
+ ver:'OWASP_CRS/4.9.0',\
137
+ severity:'CRITICAL',\
138
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
139
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
140
+
141
+
142
+ # Detect newlines in argument names.
143
+ # Checking for GET arguments has been moved to paranoia level 2 (921151)
144
+ # in order to mitigate possible false positives.
145
+ #
146
+ # This rule is also triggered by the following exploit(s):
147
+ # [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
148
+ #
149
+ SecRule ARGS_NAMES "@rx [\n\r]" \
150
+ "id:921150,\
151
+ phase:2,\
152
+ block,\
153
+ capture,\
154
+ t:none,t:htmlEntityDecode,\
155
+ msg:'HTTP Header Injection Attack via payload (CR/LF detected)',\
156
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
157
+ tag:'application-multi',\
158
+ tag:'language-multi',\
159
+ tag:'platform-multi',\
160
+ tag:'attack-protocol',\
161
+ tag:'paranoia-level/1',\
162
+ tag:'OWASP_CRS',\
163
+ tag:'capec/1000/210/272/220/33',\
164
+ ver:'OWASP_CRS/4.9.0',\
165
+ severity:'CRITICAL',\
166
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
167
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
168
+
169
+
170
+ SecRule ARGS_GET_NAMES|ARGS_GET "@rx [\n\r]+(?:\s|location|refresh|(?:set-)?cookie|(?:x-)?(?:forwarded-(?:for|host|server)|host|via|remote-ip|remote-addr|originating-IP))\s*:" \
171
+ "id:921160,\
172
+ phase:1,\
173
+ block,\
174
+ capture,\
175
+ t:none,t:htmlEntityDecode,t:lowercase,\
176
+ msg:'HTTP Header Injection Attack via payload (CR/LF and header-name detected)',\
177
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
178
+ tag:'application-multi',\
179
+ tag:'language-multi',\
180
+ tag:'platform-multi',\
181
+ tag:'attack-protocol',\
182
+ tag:'paranoia-level/1',\
183
+ tag:'OWASP_CRS',\
184
+ tag:'capec/1000/210/272/220/33',\
185
+ ver:'OWASP_CRS/4.9.0',\
186
+ severity:'CRITICAL',\
187
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
188
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
189
+
190
+
191
+ # -=[ HTTP Splitting ]=-
192
+ #
193
+ # This rule detect \n or \r in the REQUEST FILENAME
194
+ # Reference: https://wiki.owasp.org/index.php/Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-016)
195
+ # Reference: https://owasp.org/www-project-web-security-testing-guide/assets/archive/OWASP_Testing_Guide_v4.pdf
196
+ #
197
+ SecRule REQUEST_FILENAME "@rx [\n\r]" \
198
+ "id:921190,\
199
+ phase:1,\
200
+ block,\
201
+ t:none,t:urlDecodeUni,\
202
+ msg:'HTTP Splitting (CR/LF in request filename detected)',\
203
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
204
+ tag:'application-multi',\
205
+ tag:'language-multi',\
206
+ tag:'platform-multi',\
207
+ tag:'attack-protocol',\
208
+ tag:'paranoia-level/1',\
209
+ tag:'OWASP_CRS',\
210
+ tag:'capec/1000/210/272/220/34',\
211
+ ver:'OWASP_CRS/4.9.0',\
212
+ severity:'CRITICAL',\
213
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
214
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
215
+
216
+
217
+ #
218
+ # -=[ LDAP Injection ]=-
219
+ #
220
+ # [ Rule Logic ]
221
+ #
222
+ # This is a rule trying to prevent LDAP injection. It is based on a BlackHat presentation by Alonso Parada
223
+ # and regex writing by Denis Kolegov.
224
+ #
225
+ # [ References ]
226
+ # * https://www.blackhat.com/presentations/bh-europe-08/Alonso-Parada/Whitepaper/bh-eu-08-alonso-parada-WP.pdf
227
+ # * https://www.sonarsource.com/blog/joomla-takeover-in-20-seconds-with-ldap-injection-cve-2017-14596/
228
+ # * https://github.com/SpiderLabs/owasp-modsecurity-crs/issues/276#issue-126581660
229
+
230
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ^[^:\(\)\&\|\!\<\>\~]*\)\s*(?:\((?:[^,\(\)\=\&\|\!\<\>\~]+[><~]?=|\s*[&!|]\s*(?:\)|\()?\s*)|\)\s*\(\s*[\&\|\!]\s*|[&!|]\s*\([^\(\)\=\&\|\!\<\>\~]+[><~]?=[^:\(\)\&\|\!\<\>\~]*)" \
231
+ "id:921200,\
232
+ phase:2,\
233
+ block,\
234
+ capture,\
235
+ t:none,t:htmlEntityDecode,\
236
+ msg:'LDAP Injection Attack',\
237
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
238
+ tag:'application-multi',\
239
+ tag:'language-ldap',\
240
+ tag:'platform-multi',\
241
+ tag:'paranoia-level/1',\
242
+ tag:'OWASP_CRS',\
243
+ tag:'capec/1000/152/248/136',\
244
+ ver:'OWASP_CRS/4.9.0',\
245
+ severity:'CRITICAL',\
246
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
247
+
248
+ #
249
+ # -=[ Body Processor Bypass ]=-
250
+ #
251
+ # [ Rule Logic ]
252
+ #
253
+ # This rule intends to detect content types in the Content-Type header outside of the actual content type declaration.
254
+ # This prevents bypasses targeting the Modsecurity recommended rules controlling which body processor is used.
255
+ #
256
+ # Regular expression generated from regex-assembly/921421.ra.
257
+ # To update the regular expression run the following shell script
258
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
259
+ # crs-toolchain regex update 921421
260
+ #
261
+ SecRule REQUEST_HEADERS:Content-Type "@rx ^[^\s\x0b,;]+[\s\x0b,;].*?(?:application/(?:.+\+)?json|(?:application/(?:soap\+)?|text/)xml)" \
262
+ "id:921421,\
263
+ phase:1,\
264
+ block,\
265
+ capture,\
266
+ t:none,t:lowercase,\
267
+ msg:'Content-Type header: Dangerous content type outside the mime type declaration',\
268
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
269
+ tag:'application-multi',\
270
+ tag:'language-multi',\
271
+ tag:'platform-multi',\
272
+ tag:'attack-protocol',\
273
+ tag:'paranoia-level/1',\
274
+ tag:'OWASP_CRS',\
275
+ tag:'capec/1000/255/153',\
276
+ tag:'PCI/12.1',\
277
+ ver:'OWASP_CRS/4.9.0',\
278
+ severity:'CRITICAL',\
279
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
280
+
281
+
282
+ #
283
+ # Rule against CVE-2021-40438:
284
+ # A crafted request uri-path can cause mod_proxy to forward the request to an origin server choosen by the remote user.
285
+ # This issue affects Apache HTTP Server 2.4.48 and earlier.
286
+ # GET /?unix:AAAAAAAAAAAAA|http://coreruleset.org/
287
+ #
288
+ SecRule REQUEST_URI "@rx unix:[^|]*\|" \
289
+ "id:921240,\
290
+ phase:1,\
291
+ block,\
292
+ capture,\
293
+ t:none,t:urlDecodeUni,t:lowercase,\
294
+ msg:'mod_proxy attack attempt detected',\
295
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
296
+ tag:'application-multi',\
297
+ tag:'language-multi',\
298
+ tag:'platform-apache',\
299
+ tag:'attack-protocol',\
300
+ tag:'paranoia-level/1',\
301
+ tag:'OWASP_CRS',\
302
+ tag:'capec/1000/210/272/220/33',\
303
+ ver:'OWASP_CRS/4.9.0',\
304
+ severity:'CRITICAL',\
305
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
306
+
307
+
308
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:921013,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
309
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:921014,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
310
+ #
311
+ # -= Paranoia Level 2 =- (apply only when tx.detection_paranoia_level is sufficiently high: 2 or higher)
312
+ #
313
+
314
+
315
+ # Detect newlines in GET argument values.
316
+ # These may point to a HTTP header injection attack, but can also sometimes
317
+ # occur in benign query parameters.
318
+ #
319
+ # See also: rule 921140, 921150
320
+ #
321
+ SecRule ARGS_GET "@rx [\n\r]" \
322
+ "id:921151,\
323
+ phase:1,\
324
+ block,\
325
+ capture,\
326
+ t:none,t:htmlEntityDecode,\
327
+ msg:'HTTP Header Injection Attack via payload (CR/LF detected)',\
328
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
329
+ tag:'application-multi',\
330
+ tag:'language-multi',\
331
+ tag:'platform-multi',\
332
+ tag:'attack-protocol',\
333
+ tag:'paranoia-level/2',\
334
+ tag:'OWASP_CRS',\
335
+ tag:'capec/1000/210/272/220/33',\
336
+ ver:'OWASP_CRS/4.9.0',\
337
+ severity:'CRITICAL',\
338
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
339
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
340
+
341
+ #
342
+ # -=[ Body Processor Bypass ]=-
343
+ #
344
+ # [ Rule Logic ]
345
+ #
346
+ # This rule intends to detect content types in the Content-Type header outside of the actual content type declaration.
347
+ #
348
+ # [ References ]
349
+ # * See rule 921422
350
+ #
351
+ # Regular expression generated from regex-assembly/921422.ra.
352
+ # To update the regular expression run the following shell script
353
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
354
+ # crs-toolchain regex update 921422
355
+ #
356
+ SecRule REQUEST_HEADERS:Content-Type "@rx ^[^\s\x0b,;]+[\s\x0b,;].*?\b(?:((?:tex|multipar)t|application)|((?:audi|vide)o|image|cs[sv]|(?:vn|relate)d|p(?:df|lain)|json|(?:soa|cs)p|x(?:ml|-www-form-urlencoded)|form-data|x-amf|(?:octe|repor)t|stream)|([\+/]))\b" \
357
+ "id:921422,\
358
+ phase:1,\
359
+ block,\
360
+ capture,\
361
+ t:none,t:lowercase,\
362
+ msg:'Content-Type header: Dangerous content type outside the mime type declaration',\
363
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
364
+ tag:'application-multi',\
365
+ tag:'language-multi',\
366
+ tag:'platform-multi',\
367
+ tag:'attack-protocol',\
368
+ tag:'paranoia-level/2',\
369
+ tag:'OWASP_CRS',\
370
+ tag:'capec/1000/255/153',\
371
+ tag:'PCI/12.1',\
372
+ ver:'OWASP_CRS/4.9.0',\
373
+ severity:'CRITICAL',\
374
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
375
+
376
+
377
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:921015,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
378
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:921016,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
379
+ #
380
+ # -= Paranoia Level 3 =- (apply only when tx.detection_paranoia_level is sufficiently high: 3 or higher)
381
+ #
382
+ #
383
+
384
+ # Forbid Request Range Header
385
+ #
386
+ # It is possible abuse the HTTP Request Range Header to leak error pages
387
+ # and other information in very small snippets.
388
+ # The easiest way to fight this is to deny the use of this header.
389
+ # This is a viable option since the header is only used in rare circumstances
390
+ # anymore.
391
+ # If it is necessary to use it in a certain setup, then it is best to
392
+ # create a rule exclusion for a given URI and this rule ID as a workaround.
393
+ #
394
+ SecRule &REQUEST_HEADERS:Range "@gt 0" \
395
+ "id:921230,\
396
+ phase:1,\
397
+ block,\
398
+ t:none,\
399
+ msg:'HTTP Range Header detected',\
400
+ logdata:'Matched Data: Header %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
401
+ tag:'application-multi',\
402
+ tag:'language-multi',\
403
+ tag:'platform-multi',\
404
+ tag:'attack-protocol',\
405
+ tag:'paranoia-level/3',\
406
+ tag:'OWASP_CRS',\
407
+ tag:'capec/1000/210/272/220',\
408
+ ver:'OWASP_CRS/4.9.0',\
409
+ severity:'CRITICAL',\
410
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
411
+
412
+
413
+ # -=[ HTTP Parameter Pollution ]=-
414
+ #
415
+ # [ Rule Logic ]
416
+ # These rules look for multiple parameters with the same name.
417
+ # 921170 counts the occurrences of the individual parameters.
418
+ # 921180 checks if any counter is > 1.
419
+ #
420
+ # One HPP attack vector is to try evade signature filters by distributing the
421
+ # attack payload across multiple parameters with the same name.
422
+ # This works as many security devices only apply signatures to individual
423
+ # parameter payloads, however the back-end web application may (in the case
424
+ # of ASP.NET) consolidate all of the payloads into one thus making the
425
+ # attack payload active.
426
+ #
427
+ # [ References ]
428
+ # http://tacticalwebappsec.blogspot.com/2009/05/http-parameter-pollution.html
429
+ # https://capec.mitre.org/data/definitions/460.html
430
+ #
431
+ SecRule ARGS_NAMES "@rx ." \
432
+ "id:921170,\
433
+ phase:2,\
434
+ pass,\
435
+ nolog,\
436
+ tag:'application-multi',\
437
+ tag:'language-multi',\
438
+ tag:'platform-multi',\
439
+ tag:'attack-protocol',\
440
+ tag:'OWASP_CRS',\
441
+ tag:'capec/1000/152/137/15/460',\
442
+ ver:'OWASP_CRS/4.9.0',\
443
+ setvar:'TX.paramcounter_%{MATCHED_VAR_NAME}=+1'"
444
+
445
+ SecRule TX:/paramcounter_.*/ "@gt 1" \
446
+ "id:921180,\
447
+ phase:2,\
448
+ pass,\
449
+ msg:'HTTP Parameter Pollution (%{MATCHED_VAR_NAME})',\
450
+ logdata:'Matched Data: %{MATCHED_VAR} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
451
+ tag:'application-multi',\
452
+ tag:'language-multi',\
453
+ tag:'platform-multi',\
454
+ tag:'attack-protocol',\
455
+ tag:'paranoia-level/3',\
456
+ tag:'OWASP_CRS',\
457
+ tag:'capec/1000/152/137/15/460',\
458
+ ver:'OWASP_CRS/4.9.0',\
459
+ severity:'CRITICAL',\
460
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
461
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
462
+
463
+
464
+ # -=[ HTTP Parameter Pollution ]=-
465
+ #
466
+ # [ Rule Logic ]
467
+ # Parameter pollution rule 921180 PL3 can by bypassed when a weak backend parameter
468
+ # parser is ignoring additional characters in a parameter array name after the
469
+ # closing of the array.
470
+ # Rule 921210 PL3 prevents this by disallowing arbitrary strings after an array has
471
+ # been closed or inbetween the square brackets in multidimensional arrays.
472
+ # Please note that rule 921210 allows for 2-dimensional, but not for higher dimensional
473
+ # arrays. If these are flagged as attacks, a rule exclusion will have to be
474
+ # deployed; ideally for the parameter(s) in question.
475
+ #
476
+ # [ References ]
477
+ # Private bug bounty in Spring 2022, findings Z05OZUCH.
478
+ #
479
+ # [ Payloads ]
480
+ # * foo[1]a=bar&foo[1]b=<evil> - parameter parsers often cut after the closing of
481
+ # the array. 921180 PL3 takes the full name, though.
482
+ # This impediance mismatch allows for bypasses.
483
+ # * foo[1]x[1]=bar&foo[1]x[2]=<evil> - extension of 1; this has the advantage that
484
+ # the parameter name does end with "]" just like a valid array notation.
485
+ #
486
+ SecRule ARGS_NAMES "@rx (][^\]]+$|][^\]]+\[)" \
487
+ "id:921210,\
488
+ phase:2,\
489
+ pass,\
490
+ log,\
491
+ msg:'HTTP Parameter Pollution after detecting bogus char after parameter array',\
492
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
493
+ tag:'application-multi',\
494
+ tag:'language-multi',\
495
+ tag:'platform-multi',\
496
+ tag:'attack-protocol',\
497
+ tag:'paranoia-level/3',\
498
+ tag:'OWASP_CRS',\
499
+ tag:'capec/1000/152/137/15/460',\
500
+ ver:'OWASP_CRS/4.9.0',\
501
+ severity:'CRITICAL',\
502
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
503
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
504
+
505
+
506
+
507
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:921017,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
508
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:921018,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-921-PROTOCOL-ATTACK"
509
+ #
510
+ # -= Paranoia Level 4 =- (apply only when tx.detection_paranoia_level is sufficiently high: 4 or higher)
511
+ #
512
+
513
+ # -=[ HTTP Parameter Pollution ]=-
514
+ #
515
+ # [ Rule Logic ]
516
+ # Parameter pollution rule 921180 PL3 and 921210 PL3 can by bypassed if a
517
+ # weak backend parameter parser ignores parameter array alltogether at
518
+ # cuts parameter names at the first occurrence of the "[" character.
519
+ # The rule 921220 PL4 prevents this by disallowing parameter array names.
520
+ #
521
+ # If an application needs parameter array names, then this rule should be
522
+ # disabled, ideally by issueing a rule exclusion for the parameter names
523
+ # that need it.
524
+ #
525
+ # [ References ]
526
+ # Private bug bounty in Spring 2022, finding 5UXE4RK0.
527
+ #
528
+ # [ Payloads ]
529
+ # * foo[1]=bar&foo[2]=<evil>
530
+ # * foo=bar&foo[1]=<evil>
531
+ # * foo[1]=bar&foo[1]acb]=<evil> - this is an edge case that 921210 PL3 is not
532
+ # able to catch since the parameter name ends with "]".
533
+ #
534
+ SecRule ARGS_NAMES "@rx \[" \
535
+ "id:921220,\
536
+ phase:2,\
537
+ pass,\
538
+ log,\
539
+ msg:'HTTP Parameter Pollution possible via array notation',\
540
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
541
+ tag:'application-multi',\
542
+ tag:'language-multi',\
543
+ tag:'platform-multi',\
544
+ tag:'attack-protocol',\
545
+ tag:'paranoia-level/4',\
546
+ tag:'OWASP_CRS',\
547
+ tag:'capec/1000/152/137/15/460',\
548
+ ver:'OWASP_CRS/4.9.0',\
549
+ severity:'CRITICAL',\
550
+ setvar:'tx.http_violation_score=+%{tx.critical_anomaly_score}',\
551
+ setvar:'tx.inbound_anomaly_score_pl4=+%{tx.critical_anomaly_score}'"
552
+
553
+
554
+
555
+ #
556
+ # -= Paranoia Levels Finished =-
557
+ #
558
+ SecMarker "END-REQUEST-921-PROTOCOL-ATTACK"
@@ -0,0 +1,120 @@
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
+ # -= Paranoia Level 0 (empty) =- (apply unconditionally)
13
+ #
14
+
15
+ # This file is to address the 3UWMWA6W vulnerability.
16
+ # It requires ModSecurity version 2.9.6 or 3.0.8 (or an updated version with backports
17
+ # of the security fixes in these versions) or a compatible engine supporting these changes.
18
+ #
19
+ # If you cannot upgrade ModSecurity, this file will cause ModSecurity to fail to start.
20
+ # In that case, you can temporarily delete this file. However, you will be missing
21
+ # protection from these rules. Therefore, we recommend upgrading your engine instead.
22
+
23
+ # The rules in this file will be part of the 920 / 921 in the future.
24
+
25
+ # Only allow specific charsets when using "_charset_"
26
+ # Note: this is in phase:2 because these are headers that come in the body
27
+ SecRule &MULTIPART_PART_HEADERS:_charset_ "!@eq 0" \
28
+ "id:922100,\
29
+ phase:2,\
30
+ block,\
31
+ t:none,\
32
+ msg:'Multipart content type global _charset_ definition is not allowed by policy',\
33
+ logdata:'Matched Data: %{ARGS._charset_}',\
34
+ tag:'application-multi',\
35
+ tag:'language-multi',\
36
+ tag:'platform-multi',\
37
+ tag:'attack-multipart-header',\
38
+ tag:'paranoia-level/1',\
39
+ tag:'OWASP_CRS',\
40
+ tag:'capec/1000/255/153',\
41
+ ver:'OWASP_CRS/4.9.0',\
42
+ severity:'CRITICAL',\
43
+ setvar:'tx.922100_charset=|%{ARGS._charset_}|',\
44
+ chain"
45
+ SecRule TX:922100_CHARSET "!@within %{tx.allowed_request_content_type_charset}" \
46
+ "t:lowercase,\
47
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
48
+
49
+
50
+ # Only allow specific charsets same as Rule 920600
51
+ # Note: this is in phase:2 because these are headers that come in the body
52
+ #
53
+ # Regular expression generated from regex-assembly/922110-chain1.ra.
54
+ # To update the regular expression run the following shell script
55
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
56
+ # crs-toolchain regex update 922110-chain1
57
+ SecRule MULTIPART_PART_HEADERS "@rx ^content-type\s*:\s*(.*)$" \
58
+ "id:922110,\
59
+ phase:2,\
60
+ block,\
61
+ capture,\
62
+ t:none,t:lowercase,\
63
+ msg:'Illegal MIME Multipart Header content-type: charset parameter',\
64
+ logdata:'Matched Data: %{TX.1} found within Content-Type multipart form',\
65
+ tag:'application-multi',\
66
+ tag:'language-multi',\
67
+ tag:'platform-multi',\
68
+ tag:'attack-protocol',\
69
+ tag:'paranoia-level/1',\
70
+ tag:'OWASP_CRS',\
71
+ tag:'capec/272/220',\
72
+ ver:'OWASP_CRS/4.9.0',\
73
+ severity:'CRITICAL',\
74
+ chain"
75
+ SecRule TX:1 "!@rx ^(?:(?:\*|[^!\"\(\),/:-\?\[-\]\{\}]+)/(?:\*|[^!\"\(\),/:-\?\[-\]\{\}]+)|\*)(?:[\s\x0b]*;[\s\x0b]*(?:charset[\s\x0b]*=[\s\x0b]*\"?(?:iso-8859-15?|utf-8|windows-1252)\b\"?|(?:[^\s\x0b-\"\(\),/:-\?\[-\]c\{\}]|c(?:[^!\"\(\),/:-\?\[-\]h\{\}]|h(?:[^!\"\(\),/:-\?\[-\]a\{\}]|a(?:[^!\"\(\),/:-\?\[-\]r\{\}]|r(?:[^!\"\(\),/:-\?\[-\]s\{\}]|s(?:[^!\"\(\),/:-\?\[-\]e\{\}]|e[^!\"\(\),/:-\?\[-\]t\{\}]))))))[^!\"\(\),/:-\?\[-\]\{\}]*[\s\x0b]*=[\s\x0b]*[^!\(\),/:-\?\[-\]\{\}]+);?)*(?:[\s\x0b]*,[\s\x0b]*(?:(?:\*|[^!\"\(\),/:-\?\[-\]\{\}]+)/(?:\*|[^!\"\(\),/:-\?\[-\]\{\}]+)|\*)(?:[\s\x0b]*;[\s\x0b]*(?:charset[\s\x0b]*=[\s\x0b]*\"?(?:iso-8859-15?|utf-8|windows-1252)\b\"?|(?:[^\s\x0b-\"\(\),/:-\?\[-\]c\{\}]|c(?:[^!\"\(\),/:-\?\[-\]h\{\}]|h(?:[^!\"\(\),/:-\?\[-\]a\{\}]|a(?:[^!\"\(\),/:-\?\[-\]r\{\}]|r(?:[^!\"\(\),/:-\?\[-\]s\{\}]|s(?:[^!\"\(\),/:-\?\[-\]e\{\}]|e[^!\"\(\),/:-\?\[-\]t\{\}]))))))[^!\"\(\),/:-\?\[-\]\{\}]*[\s\x0b]*=[\s\x0b]*[^!\(\),/:-\?\[-\]\{\}]+);?)*)*$" \
76
+ "setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
77
+
78
+ # Content-Transfer-Encoding was deprecated by rfc7578 in 2015 and should not be used (see: https://www.rfc-editor.org/rfc/rfc7578#section-4.7)
79
+ # Note: this is in phase:2 because these are headers that come in the body
80
+ SecRule MULTIPART_PART_HEADERS "@rx content-transfer-encoding:(.*)" \
81
+ "id:922120,\
82
+ phase:2,\
83
+ block,\
84
+ capture,\
85
+ t:none,t:lowercase,\
86
+ msg:'Content-Transfer-Encoding was deprecated by rfc7578 in 2015 and should not be used',\
87
+ logdata:'Matched Data: %{TX.0}',\
88
+ tag:'application-multi',\
89
+ tag:'language-multi',\
90
+ tag:'platform-multi',\
91
+ tag:'attack-deprecated-header',\
92
+ tag:'paranoia-level/1',\
93
+ tag:'OWASP_CRS',\
94
+ tag:'capec/272/220',\
95
+ ver:'OWASP_CRS/4.9.0',\
96
+ severity:'CRITICAL',\
97
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
98
+
99
+ # Multipart header names can't contain any characters outside of range 33 and 126,
100
+ # excluding 58 (':') which is the separator.
101
+ # RFC 2045 refers RFC 822 about the header syntax.
102
+ # Note: this is in phase:2 because these are headers that come in the body
103
+ SecRule MULTIPART_PART_HEADERS "@rx [^\x21-\x7E][\x21-\x39\x3B-\x7E]*:" \
104
+ "id:922130,\
105
+ phase:2,\
106
+ block,\
107
+ capture,\
108
+ t:none,t:lowercase,\
109
+ msg:'Multipart header contains characters outside of valid range',\
110
+ logdata:'Matched Data: %{TX.0}',\
111
+ tag:'application-multi',\
112
+ tag:'language-multi',\
113
+ tag:'platform-multi',\
114
+ tag:'attack-multipart-header',\
115
+ tag:'paranoia-level/1',\
116
+ tag:'OWASP_CRS',\
117
+ tag:'capec/272/220',\
118
+ ver:'OWASP_CRS/4.9.0',\
119
+ severity:'CRITICAL',\
120
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"