@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,774 @@
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:933011,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
18
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:933012,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
19
+ #
20
+ # -= Paranoia Level 1 (default) =- (apply only when tx.detection_paranoia_level is sufficiently high: 1 or higher)
21
+ #
22
+
23
+ #
24
+ # -=[ PHP Injection Attacks ]=-
25
+ #
26
+ # [ References ]
27
+ # https://rips-scanner.sourceforge.net/
28
+ # https://wiki.owasp.org/index.php/PHP_Top_5#P1:_Remote_Code_Executionh
29
+ #
30
+
31
+ #
32
+ # [ PHP Open Tag Found ]
33
+ #
34
+ # Detects PHP open tags "<?" and "<?php".
35
+ # http://www.php.net/manual/en/language.basic-syntax.phptags.php
36
+ #
37
+ # Care is taken to avoid false positives in XML declarations "<?xml..."
38
+ #
39
+ # Also detects "[php]", "[/php]" and "[\php]" tags used by some applications
40
+ # to indicate PHP dynamic content.
41
+ #
42
+ # Previously, this rule also checked for the PHP close tag '?>', but
43
+ # this resulted in false positives which were difficult to prevent.
44
+ # Therefore, that pattern is now checked by rule 933190 in paranoia levels
45
+ # 3 or higher.
46
+ #
47
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)<\?(?:[^x]|x(?:[^m]|m(?:[^l]|l(?:[^\s\x0b]|[\s\x0b]+[^a-z]|$)))|$|php)|\[[/\x5c]?php\]" \
48
+ "id:933100,\
49
+ phase:2,\
50
+ block,\
51
+ capture,\
52
+ t:none,\
53
+ msg:'PHP Injection Attack: PHP Open Tag Found',\
54
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
55
+ tag:'application-multi',\
56
+ tag:'language-php',\
57
+ tag:'platform-multi',\
58
+ tag:'attack-injection-php',\
59
+ tag:'paranoia-level/1',\
60
+ tag:'OWASP_CRS',\
61
+ tag:'capec/1000/152/242',\
62
+ ver:'OWASP_CRS/4.9.0',\
63
+ severity:'CRITICAL',\
64
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
65
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
66
+
67
+ #
68
+ # [ PHP Script Uploads ]
69
+ #
70
+ # Block file uploads with filenames ending in PHP related extensions
71
+ # (.php, .phps, .phtml, .php5 etc).
72
+ #
73
+ # Many application contain Unrestricted File Upload vulnerabilities.
74
+ # https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload
75
+ #
76
+ # Attackers may use such a vulnerability to achieve remote code execution
77
+ # by uploading a .php file. If the upload storage location is predictable
78
+ # and not adequately protected, the attacker may then request the uploaded
79
+ # .php file and have the code within it executed on the server.
80
+ #
81
+ # Also block files with just dot (.) characters after the extension:
82
+ # https://www.rapid7.com/blog/post/2013/08/15/time-to-patch-joomla/
83
+ #
84
+ # Some AJAX uploaders use the nonstandard request headers X-Filename,
85
+ # X_Filename, or X-File-Name to transmit the file name to the server;
86
+ # scan these request headers as well as multipart/form-data file names.
87
+ #
88
+ SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X.Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.ph(?:p\d*|tml|ar|ps|t|pt)\.*$" \
89
+ "id:933110,\
90
+ phase:2,\
91
+ block,\
92
+ capture,\
93
+ t:none,t:lowercase,\
94
+ msg:'PHP Injection Attack: PHP Script File Upload Found',\
95
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
96
+ tag:'application-multi',\
97
+ tag:'language-php',\
98
+ tag:'platform-multi',\
99
+ tag:'attack-injection-php',\
100
+ tag:'paranoia-level/1',\
101
+ tag:'OWASP_CRS',\
102
+ tag:'capec/1000/152/242',\
103
+ ver:'OWASP_CRS/4.9.0',\
104
+ severity:'CRITICAL',\
105
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
106
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
107
+
108
+
109
+ #
110
+ # [ PHP Configuration Directives ]
111
+ #
112
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-config-directives.data" \
113
+ "id:933120,\
114
+ phase:2,\
115
+ block,\
116
+ capture,\
117
+ t:none,t:normalisePath,\
118
+ msg:'PHP Injection Attack: Configuration Directive Found',\
119
+ logdata:'Matched Data: %{TX.1} found within %{TX.933120_MATCHED_VAR_NAME}: %{TX.933120_MATCHED_VAR}',\
120
+ tag:'application-multi',\
121
+ tag:'language-php',\
122
+ tag:'platform-multi',\
123
+ tag:'attack-injection-php',\
124
+ tag:'paranoia-level/1',\
125
+ tag:'OWASP_CRS',\
126
+ tag:'capec/1000/152/242',\
127
+ ver:'OWASP_CRS/4.9.0',\
128
+ severity:'CRITICAL',\
129
+ setvar:'tx.933120_matched_var=%{MATCHED_VAR}',\
130
+ setvar:'tx.933120_matched_var_name=%{MATCHED_VAR_NAME}',\
131
+ chain"
132
+ SecRule MATCHED_VARS "@rx \b([^\s]+)\s*=[^=]" \
133
+ "capture,\
134
+ chain"
135
+ SecRule TX:1 "@pmFromFile php-config-directives.data" \
136
+ "setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
137
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
138
+
139
+
140
+ #
141
+ # [ PHP Variables ]
142
+ #
143
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-variables.data" \
144
+ "id:933130,\
145
+ phase:2,\
146
+ block,\
147
+ capture,\
148
+ t:none,t:normalisePath,t:urlDecodeUni,\
149
+ msg:'PHP Injection Attack: Variables Found',\
150
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
151
+ tag:'application-multi',\
152
+ tag:'language-php',\
153
+ tag:'platform-multi',\
154
+ tag:'attack-injection-php',\
155
+ tag:'paranoia-level/1',\
156
+ tag:'OWASP_CRS',\
157
+ tag:'capec/1000/152/242',\
158
+ ver:'OWASP_CRS/4.9.0',\
159
+ severity:'CRITICAL',\
160
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
161
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
162
+
163
+
164
+ #
165
+ # [ PHP I/O Streams ]
166
+ #
167
+ # The "php://" syntax can be used to refer to various objects, such as local files (for LFI),
168
+ # remote urls (for RFI), or standard input/request body. Its occurrence indicates a possible attempt
169
+ # to either inject PHP code or exploit a file inclusion vulnerability in a PHP web app.
170
+ #
171
+ # Examples:
172
+ # php://filter/resource=./../../../wp-config.php
173
+ # php://filter/resource=http://www.example.com
174
+ # php://stdin
175
+ # php://input
176
+ #
177
+ # http://php.net/manual/en/wrappers.php.php
178
+ #
179
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)php://(?:std(?:in|out|err)|(?:in|out)put|fd|memory|temp|filter)" \
180
+ "id:933140,\
181
+ phase:2,\
182
+ block,\
183
+ capture,\
184
+ t:none,\
185
+ msg:'PHP Injection Attack: I/O Stream Found',\
186
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
187
+ tag:'application-multi',\
188
+ tag:'language-php',\
189
+ tag:'platform-multi',\
190
+ tag:'attack-injection-php',\
191
+ tag:'paranoia-level/1',\
192
+ tag:'OWASP_CRS',\
193
+ tag:'capec/1000/152/242',\
194
+ ver:'OWASP_CRS/4.9.0',\
195
+ severity:'CRITICAL',\
196
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
197
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
198
+
199
+
200
+ #
201
+ # [ PHP Wrappers ]
202
+ #
203
+ # PHP comes with many built-in wrappers for various URL-style protocols for use with the filesystem
204
+ # functions such as fopen(), copy(), file_exists() and filesize(). Abusing of PHP wrappers like phar://
205
+ # could lead to RCE as describled by Sam Thomas at BlackHat USA 2018 (https://bit.ly/2yaKV5X), even
206
+ # wrappers like zlib://, glob://, rar://, zip://, etc... could lead to LFI and expect:// to RCE.
207
+ #
208
+ # Valid PHP wrappers can be found in the PHP documentation here:
209
+ # https://www.php.net/manual/en/wrappers.php
210
+ #
211
+ # Regular expression generated from regex-assembly/933200.ra.
212
+ # To update the regular expression run the following shell script
213
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
214
+ # crs-toolchain regex update 933200
215
+ #
216
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:bzip2|expect|glob|ogg|(?:ph|r)ar|ssh2(?:.(?:s(?:hell|(?:ft|c)p)|exec|tunnel))?|z(?:ip|lib))://" \
217
+ "id:933200,\
218
+ phase:2,\
219
+ block,\
220
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:removeNulls,t:cmdLine,\
221
+ msg:'PHP Injection Attack: Wrapper scheme detected',\
222
+ logdata:'Matched Data: %{MATCHED_VAR} found within %{MATCHED_VAR_NAME}',\
223
+ tag:'application-multi',\
224
+ tag:'language-php',\
225
+ tag:'platform-multi',\
226
+ tag:'attack-injection-php',\
227
+ tag:'paranoia-level/1',\
228
+ tag:'OWASP_CRS',\
229
+ tag:'capec/1000/152/242',\
230
+ ver:'OWASP_CRS/4.9.0',\
231
+ severity:'CRITICAL',\
232
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
233
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
234
+
235
+
236
+ #
237
+ # [ PHP Functions ]
238
+ #
239
+ # Detecting PHP function names is useful to block PHP code injection attacks.
240
+ # There are many PHP functions. We have to strike a balance between robust detection
241
+ # of PHP code in content, and the risk of false positives.
242
+ #
243
+ # The list of PHP functions is divided into four groups of varying attack/false positive risk.
244
+ # Four separate rules are used to detect these groups of functions:
245
+ #
246
+ # - Rule 933150: ~40 words highly common to PHP injection payloads and extremely rare in
247
+ # natural language or other contexts.
248
+ # Examples: 'base64_decode', 'file_get_contents'.
249
+ # These words are detected as a match directly using @pmFromFile.
250
+ # Function names are defined in php-function-names-933150.data
251
+ #
252
+ # - Rule 933160: ~220 words which are common in PHP code, but have a higher chance to cause
253
+ # false positives in natural language or other contexts.
254
+ # Examples: 'chr', 'eval'.
255
+ # To mitigate false positives, a regexp looks for PHP function syntax, e.g. 'eval()'.
256
+ # Regexp is generated from function names in /regexp-assemble/data/933160.ra
257
+ #
258
+ # - Rule 933151: ~1300 words of lesser importance. This includes most PHP functions and keywords.
259
+ # Examples: 'addslashes', 'array_diff'.
260
+ # For performance reasons, the @pmFromFile operator is used, and many functions from lesser
261
+ # used PHP extensions are removed.
262
+ # To mitigate false positives, we only match when the '(' character is also found.
263
+ # This rule only runs in paranoia level 2 or higher.
264
+ # Function names are defined in php-function-names-933151.data
265
+ #
266
+ # - Rule 933161: ~200 words with short or trivial names, possibly leading to false positives.
267
+ # Examples: 'abs', 'cos'.
268
+ # To mitigate false positives, a regexp matches on function syntax, e.g. 'abs()'.
269
+ # This rule only runs in paranoia level 3 or higher.
270
+ # Regexp is generated from function names in /regexp-assemble/data/933161.ra
271
+ #
272
+
273
+
274
+ #
275
+ # [ PHP Functions: High-Risk PHP Function Names ]
276
+ #
277
+ # Rule 933150 contains a small list of function names which are highly indicative of a PHP
278
+ # injection attack, for example 'base64_decode'.
279
+ # We block these function names outright, without using a complex regexp or chain.
280
+ # This could make the detection a bit more robust against possible bypasses.
281
+ #
282
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-function-names-933150.data" \
283
+ "id:933150,\
284
+ phase:2,\
285
+ block,\
286
+ capture,\
287
+ t:none,\
288
+ msg:'PHP Injection Attack: High-Risk PHP Function Name Found',\
289
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
290
+ tag:'application-multi',\
291
+ tag:'language-php',\
292
+ tag:'platform-multi',\
293
+ tag:'attack-injection-php',\
294
+ tag:'paranoia-level/1',\
295
+ tag:'OWASP_CRS',\
296
+ tag:'capec/1000/152/242',\
297
+ ver:'OWASP_CRS/4.9.0',\
298
+ severity:'CRITICAL',\
299
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
300
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
301
+
302
+
303
+ #
304
+ # [ PHP Functions: High-Risk PHP Function Calls ]
305
+ #
306
+ # Some PHP function names have a certain risk of false positives, due to short
307
+ # names, full or partial overlap with common natural language terms, uses in
308
+ # other contexts, et cetera. Some examples are 'eval', 'exec', 'system'.
309
+ #
310
+ # For these function names, we apply a regexp to look for PHP function syntax.
311
+ # The regexp looks for a word boundary and adjoining parentheses.
312
+ # For instance, we want to block 'eval()', but we want to allow 'medieval()'.
313
+ #
314
+ # We have to be careful of possible bypasses using comment syntax. Examples:
315
+ #
316
+ # system(...)
317
+ # system (...)
318
+ # system\t(...)
319
+ # system /*comment*/ (...)
320
+ # system /*multiline \n comment*/ (...)
321
+ # system //comment \n (...)
322
+ # system #comment \n (...)
323
+ #
324
+ # This rule is triggered by the following exploits as well, as they include the string 'exec(...)':
325
+ # [ Apache Struts vulnerability CVE-2017-9791 - Exploit tested: https://www.exploit-db.com/exploits/42324 ]
326
+ # [ Apache Struts vulnerability CVE-2018-11776 - Exploit tested: https://www.exploit-db.com/exploits/45260 ]
327
+ # [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
328
+ #
329
+ # Regular expression generated from regex-assembly/933160.ra.
330
+ # To update the regular expression run the following shell script
331
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
332
+ # crs-toolchain regex update 933160
333
+ #
334
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b\(?[\"']*(?:assert(?:_options)?|c(?:hr|reate_function)|e(?:val|x(?:ec|p))|file(?:group)?|glob|i(?:mage(?:gif|(?:jpe|pn)g|wbmp|xbm)|s_a)|md5|o(?:pendir|rd)|p(?:assthru|open|rev)|(?:read|tmp)file|un(?:pac|lin)k|s(?:tat|ubstr|ystem))(?:/(?:\*.*\*/|/.*)|#.*|[\s\x0b\"])*[\"']*\)?[\s\x0b]*\(.*\)" \
335
+ "id:933160,\
336
+ phase:2,\
337
+ block,\
338
+ capture,\
339
+ t:none,\
340
+ msg:'PHP Injection Attack: High-Risk PHP Function Call Found',\
341
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
342
+ tag:'application-multi',\
343
+ tag:'language-php',\
344
+ tag:'platform-multi',\
345
+ tag:'attack-injection-php',\
346
+ tag:'paranoia-level/1',\
347
+ tag:'OWASP_CRS',\
348
+ tag:'capec/1000/152/242',\
349
+ ver:'OWASP_CRS/4.9.0',\
350
+ severity:'CRITICAL',\
351
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
352
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
353
+
354
+
355
+ #
356
+ # [ PHP Object Injection ]
357
+ #
358
+ # PHP Object Injection is an application level vulnerability that could allow
359
+ # an attacker to perform different kinds of malicious attacks, such as
360
+ # Code Injection, SQL Injection, Path Traversal and Application Denial of Service,
361
+ # depending on the context.
362
+ #
363
+ # The vulnerability occurs when user-supplied input is not properly sanitized
364
+ # before being passed to the unserialize() PHP function. Since PHP allows object
365
+ # serialization, attackers could pass ad-hoc serialized strings to a vulnerable
366
+ # unserialize() call, resulting in an arbitrary PHP object(s) injection into the
367
+ # application scope.
368
+ #
369
+ # https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection
370
+ #
371
+ # In serialized form, PHP objects have the following format:
372
+ #
373
+ # O:8:"stdClass":1:{s:1:"a";i:2;}
374
+ # O:3:"Foo":0:{}
375
+ #
376
+ # Also detected are PHP objects with a custom unserializer:
377
+ # https://www.phpinternalsbook.com/php5/classes_objects/serialization.html
378
+ # These have the following format:
379
+ #
380
+ # C:11:"ArrayObject":37:{x:i:0;a:1:{s:1:"a";s:1:"b";};m:a:0:{}}
381
+ # C:3:"Foo":23:{s:15:"My private data";}
382
+ #
383
+ # HTTP headers are inspected, since PHP object injection vulnerabilities have been
384
+ # found in applications parsing them:
385
+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-8562 (User-Agent header)
386
+ # https://www.exploit-db.com/exploits/39033/ (X-Forwarded-For header)
387
+ # http://karmainsecurity.com/KIS-2015-10 (Host header)
388
+ #
389
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS|ARGS_NAMES|ARGS|XML:/* "@rx [oOcC]:\d+:\".+?\":\d+:{.*}" \
390
+ "id:933170,\
391
+ phase:2,\
392
+ block,\
393
+ capture,\
394
+ t:none,\
395
+ msg:'PHP Injection Attack: Serialized Object Injection',\
396
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
397
+ tag:'application-multi',\
398
+ tag:'language-php',\
399
+ tag:'platform-multi',\
400
+ tag:'attack-injection-php',\
401
+ tag:'paranoia-level/1',\
402
+ tag:'OWASP_CRS',\
403
+ tag:'capec/1000/152/242',\
404
+ ver:'OWASP_CRS/4.9.0',\
405
+ severity:'CRITICAL',\
406
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
407
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
408
+
409
+
410
+
411
+ #
412
+ # [ PHP Functions: Variable Function Calls ]
413
+ #
414
+ # PHP 'variable functions' provide an alternate syntax for calling PHP functions.
415
+ # http://php.net/manual/en/functions.variable-functions.php
416
+ #
417
+ # An attacker may use variable function syntax to evade detection of function
418
+ # names during exploitation of a remote code execution vulnerability.
419
+ # An example to use the 'file_get_contents' function while evading rule 933150:
420
+ #
421
+ # $fn = 'file_' . 'get_' . 'contents';
422
+ # echo $fn('wp-co' . 'nfig.php');
423
+ #
424
+ # Some examples from obfuscated malware:
425
+ #
426
+ # $OOO0000O0(...)
427
+ # @$b374k(...)
428
+ # $_[@-_]($_[@!+_] )
429
+ #
430
+ # A breakdown of the regular expression:
431
+ #
432
+ # \$+
433
+ # The variable's '$' char, or multiple '$' for 'variable variables':
434
+ # http://php.net/manual/en/language.variables.variable.php
435
+ # (?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\s*{.+})
436
+ # One of the following:
437
+ # - A variable name; regexp from http://php.net/language.variables.basics
438
+ # - A nonempty expression for variable variables: ${'fn'} or $ {'fn'}
439
+ # (?:\s|\[.+\]|{.+}|/\*.*\*/|//.*|#.*)*
440
+ # Optional whitespace, array access, or comments
441
+ # \(.*\)
442
+ # Parentheses optionally containing function parameters
443
+ #
444
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx \$+(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\s*{.+})(?:\s|\[.+\]|{.+}|/\*.*\*/|//.*|#.*)*\(.*\)" \
445
+ "id:933180,\
446
+ phase:2,\
447
+ block,\
448
+ capture,\
449
+ t:none,\
450
+ msg:'PHP Injection Attack: Variable Function Call Found',\
451
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
452
+ tag:'application-multi',\
453
+ tag:'language-php',\
454
+ tag:'platform-multi',\
455
+ tag:'attack-injection-php',\
456
+ tag:'paranoia-level/1',\
457
+ tag:'OWASP_CRS',\
458
+ tag:'capec/1000/152/242',\
459
+ ver:'OWASP_CRS/4.9.0',\
460
+ severity:'CRITICAL',\
461
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
462
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
463
+
464
+ # [ PHP Functions: Variable Function Prevent Bypass ]
465
+ #
466
+ # Referring to https://www.secjuice.com/php-rce-bypass-filters-sanitization-waf/
467
+ # Regex test on https://regex101.com/r/x1tfXG/1
468
+ # the rule 933180 could be bypassed by using the following payloads:
469
+ #
470
+ # - (system)('uname');
471
+ # - (sy.(st).em)('uname');
472
+ # - (string)"system"('uname');
473
+ # - define('x', 'sys' . 'tem');(x)/* comment */('uname');
474
+ # - $y = 'sys'.'tem';($y)('uname');
475
+ # - define('z', [['sys' .'tem']]);(z)[0][0]('uname');
476
+ # - (system)(ls);
477
+ # - (/**/system)(ls/**/);
478
+ # - (['system'])[0]('uname');
479
+ # - (++[++system++][++0++])++{/*dsasd*/0}++(++ls++);
480
+ #
481
+ # This rule blocks all payloads above and avoids to block values like:
482
+ #
483
+ # - [ACME] this is a test (just a test)
484
+ # - Test (with two) rounded (brackets)
485
+ #
486
+ # Regular expression generated from regex-assembly/933210.ra.
487
+ # To update the regular expression run the following shell script
488
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
489
+ # crs-toolchain regex update 933210
490
+ #
491
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx (?:\((?:.+\)(?:[\"'][\-0-9A-Z_a-z]+[\"'])?\(.+|[^\)]*string[^\)]*\)[\s\x0b\"'\-\.0-9A-\[\]_a-\{\}]+\([^\)]*)|(?:\[[0-9]+\]|\{[0-9]+\}|\$[^\(\),\./;\x5c]+|[\"'][\-0-9A-Z\x5c_a-z]+[\"'])\(.+)\);" \
492
+ "id:933210,\
493
+ phase:2,\
494
+ block,\
495
+ capture,\
496
+ t:none,t:urlDecodeUni,t:replaceComments,t:removeWhitespace,\
497
+ msg:'PHP Injection Attack: Variable Function Call Found',\
498
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
499
+ tag:'application-multi',\
500
+ tag:'language-php',\
501
+ tag:'platform-multi',\
502
+ tag:'attack-injection-php',\
503
+ tag:'paranoia-level/1',\
504
+ tag:'OWASP_CRS',\
505
+ tag:'capec/1000/152/242',\
506
+ ver:'OWASP_CRS/4.9.0',\
507
+ severity:'CRITICAL',\
508
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
509
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
510
+
511
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:933013,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
512
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:933014,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
513
+ #
514
+ # -= Paranoia Level 2 =- (apply only when tx.detection_paranoia_level is sufficiently high: 2 or higher)
515
+ #
516
+
517
+ #
518
+ # [ PHP Functions: Medium-Risk PHP Function Names ]
519
+ #
520
+ # In paranoia level 2, we add additional checks for most PHP functions.
521
+ #
522
+ # The size of the PHP function list is considerable.
523
+ # Even after excluding the more obscure PHP extensions, 1300+ functions remain.
524
+ # For performance and maintenance reasons, this rule does not use a regexp,
525
+ # but uses a phrase file (@pmFromFile), and additionally looks for an '(' character
526
+ # in the matched variable.
527
+ #
528
+ # This approach carries some risk for false positives. Therefore, the function list
529
+ # has been curated to remove words closely matching natural language and terms often
530
+ # used in other contexts.
531
+ #
532
+ # This rule is a stricter sibling of rule 933150.
533
+ #
534
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-function-names-933151.data" \
535
+ "id:933151,\
536
+ phase:2,\
537
+ block,\
538
+ capture,\
539
+ t:none,\
540
+ msg:'PHP Injection Attack: Medium-Risk PHP Function Name Found',\
541
+ logdata:'Matched Data: %{TX.1} found within %{TX.933151_MATCHED_VAR_NAME}: %{TX.933151_MATCHED_VAR}',\
542
+ tag:'application-multi',\
543
+ tag:'language-php',\
544
+ tag:'platform-multi',\
545
+ tag:'attack-injection-php',\
546
+ tag:'paranoia-level/2',\
547
+ tag:'OWASP_CRS',\
548
+ tag:'capec/1000/152/242',\
549
+ ver:'OWASP_CRS/4.9.0',\
550
+ severity:'CRITICAL',\
551
+ setvar:'tx.933151_matched_var=%{MATCHED_VAR}',\
552
+ setvar:'tx.933151_matched_var_name=%{MATCHED_VAR_NAME}',\
553
+ chain"
554
+ SecRule MATCHED_VARS "@rx \b([^\s]+)\s*[(]" \
555
+ "capture,\
556
+ chain"
557
+ SecRule TX:1 "@pmFromFile php-function-names-933151.data" \
558
+ "setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
559
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
560
+
561
+
562
+
563
+
564
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:933015,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
565
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:933016,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
566
+ #
567
+ # -= Paranoia Level 3 =- (apply only when tx.detection_paranoia_level is sufficiently high: 3 or higher)
568
+ #
569
+
570
+ #
571
+ # [ PHP Variables: Common Variable Indexes ]
572
+ #
573
+ # In paranoia level 3, we add additional checks for parameters to many PHP variables.
574
+ #
575
+ #
576
+ # One of the more common variables used within attacks on PHP is $_SERVER. Because
577
+ # of how many different ways PHP has for executing variables (variable variables,
578
+ # etc) often just looking for $_SERVER will be less effective than looking for the
579
+ # various indexes within $_SERVER. This rule checks for these indexes.
580
+ # This rule is located in PL 3 because often developers will use these names as
581
+ # parameter names or values and this will lead to false positives.
582
+ # Because this list is not expected to change and it is limited in size we use a
583
+ # regex in this case to look for these values whereas in its sibling rule we use
584
+ # @pmFromFile for flexibility and performance.
585
+ #
586
+ # Regular expression generated from regex-assembly/933131.ra.
587
+ # To update the regular expression run the following shell script
588
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
589
+ # crs-toolchain regex update 933131
590
+ #
591
+ # This rule is a stricter sibling of rule 933130.
592
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx AUTH_TYPE|HTTP_(?:ACCEPT(?:_(?:CHARSET|ENCODING|LANGUAGE))?|CONNECTION|(?:HOS|USER_AGEN)T|KEEP_ALIVE|(?:REFERE|X_FORWARDED_FO)R)|ORIG_PATH_INFO|PATH_(?:INFO|TRANSLATED)|QUERY_STRING|REQUEST_URI" \
593
+ "id:933131,\
594
+ phase:2,\
595
+ block,\
596
+ capture,\
597
+ t:none,t:normalisePath,t:urlDecodeUni,\
598
+ msg:'PHP Injection Attack: Variables Found',\
599
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
600
+ tag:'application-multi',\
601
+ tag:'language-php',\
602
+ tag:'platform-multi',\
603
+ tag:'attack-injection-php',\
604
+ tag:'paranoia-level/3',\
605
+ tag:'OWASP_CRS',\
606
+ tag:'capec/1000/152/242',\
607
+ ver:'OWASP_CRS/4.9.0',\
608
+ severity:'CRITICAL',\
609
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
610
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
611
+
612
+
613
+ #
614
+ # [ PHP Functions: Low-Value PHP Function Calls ]
615
+ #
616
+ # In paranoia level 3, we add additional checks for the remaining PHP functions.
617
+ #
618
+ # Most of these function names are likely to cause false positives in natural text
619
+ # or common parameter values, such as 'abs', 'copy', 'date', 'key', 'max', 'min'.
620
+ # Therefore, these function names are not scanned in lower paranoia levels.
621
+ #
622
+ # To mitigate the risk of false positives somewhat, a regexp is used to look for
623
+ # PHP function syntax. (See rule 933160 for a description.)
624
+ #
625
+ # This rule is a stricter sibling of rule 933160.
626
+ #
627
+ # This rule is also triggered by the following exploit(s):
628
+ # [ Apache Struts vulnerability CVE-2018-11776 - Exploit tested: https://www.exploit-db.com/exploits/45262 ]
629
+ # [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
630
+ #
631
+ # Regular expression generated from regex-assembly/933161.ra.
632
+ # To update the regular expression run the following shell script
633
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
634
+ # crs-toolchain regex update 933161
635
+ #
636
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:a(?:bs|s(?:in|sert(?:_options)?))|basename|c(?:h(?:eckdate|r(?:oot)?)|o(?:(?:mpac|(?:nsta|u)n)t|py|sh?)|r(?:eate_function|ypt)|urrent)|d(?:ate|e(?:coct|fined?)|ir)|e(?:nd|val|x(?:ec|p(?:lode)?|tract))|f(?:ile(?:(?:[acm]tim|inod|siz|typ)e|group|owner|perms)?|l(?:o(?:ck|or)|ush))|glob|h(?:ash|eader)|i(?:date|m(?:age(?:gif|(?:jpe|pn)g|wbmp|xbm)|plode)|s_a)|key|l(?:ink|og)|m(?:a(?:il|x)|d5|in)|n(?:ame|ext)|o(?:pendir|rd)|p(?:a(?:ck|ss(?:thru)?)|i|o(?:pen|w)|rev)|r(?:an(?:d|ge)|e(?:(?:adfil|nam)e|set)|ound)|s(?:(?:erializ|huffl)e|in|leep|(?:or|ta)t|ubstr|y(?:mlink|s(?:log|tem)))|t(?:an|(?:im|mpfil)e|ouch|rim)|u(?:cfirst|n(?:lin|pac)k)|virtual)(?:[\s\x0b]|/\*.*\*/|(?:#|//).*)*\(.*\)" \
637
+ "id:933161,\
638
+ phase:2,\
639
+ block,\
640
+ capture,\
641
+ t:none,\
642
+ msg:'PHP Injection Attack: Low-Value PHP Function Call Found',\
643
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
644
+ tag:'application-multi',\
645
+ tag:'language-php',\
646
+ tag:'platform-multi',\
647
+ tag:'attack-injection-php',\
648
+ tag:'paranoia-level/3',\
649
+ tag:'OWASP_CRS',\
650
+ tag:'capec/1000/152/242',\
651
+ ver:'OWASP_CRS/4.9.0',\
652
+ severity:'CRITICAL',\
653
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
654
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
655
+
656
+
657
+ #
658
+ # [ PHP Script Uploads: Superfluous extension ]
659
+ #
660
+ # Block file uploads with PHP related extensions (.php, .phps, .phtml,
661
+ # .php5 etc) anywhere in the name, followed by a dot.
662
+ #
663
+ # Example: index.php.tmp
664
+ #
665
+ # Uploading of such files can lead to remote code execution if
666
+ # Apache is configured with AddType and MultiViews, as Apache will
667
+ # automatically do a filename match when the extension is unknown.
668
+ # This configuration is fortunately not common in modern installs.
669
+ #
670
+ # Blocking these file names might lead to more false positives.
671
+ #
672
+ # Some AJAX uploaders use the nonstandard request headers X-Filename,
673
+ # X_Filename, or X-File-Name to transmit the file name to the server;
674
+ # scan these request headers as well as multipart/form-data file names.
675
+ #
676
+ # This rule is a stricter sibling of rule 933110.
677
+ #
678
+ SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X.Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phtml)\..*$" \
679
+ "id:933111,\
680
+ phase:2,\
681
+ block,\
682
+ capture,\
683
+ t:none,t:lowercase,\
684
+ msg:'PHP Injection Attack: PHP Script File Upload Found',\
685
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
686
+ tag:'application-multi',\
687
+ tag:'language-php',\
688
+ tag:'platform-multi',\
689
+ tag:'attack-injection-php',\
690
+ tag:'paranoia-level/3',\
691
+ tag:'OWASP_CRS',\
692
+ tag:'capec/1000/152/242',\
693
+ ver:'OWASP_CRS/4.9.0',\
694
+ severity:'CRITICAL',\
695
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
696
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
697
+
698
+
699
+ # [ PHP Closing Tag Found ]
700
+ #
701
+ # http://www.php.net/manual/en/language.basic-syntax.phptags.php
702
+ #
703
+ # This check was extracted from 933100 (paranoia level 1), since the
704
+ # checked sequence '?>' commonly causes false positives.
705
+ # See issue #654 for discussion.
706
+ #
707
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pm ?>" \
708
+ "id:933190,\
709
+ phase:2,\
710
+ block,\
711
+ capture,\
712
+ t:none,t:urlDecodeUni,\
713
+ msg:'PHP Injection Attack: PHP Closing Tag Found',\
714
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
715
+ tag:'application-multi',\
716
+ tag:'language-php',\
717
+ tag:'platform-multi',\
718
+ tag:'attack-injection-php',\
719
+ tag:'paranoia-level/3',\
720
+ tag:'OWASP_CRS',\
721
+ tag:'capec/1000/152/242',\
722
+ ver:'OWASP_CRS/4.9.0',\
723
+ severity:'CRITICAL',\
724
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
725
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
726
+
727
+
728
+ # [ PHP Functions: Variable Function Prevent Bypass ]
729
+ #
730
+ # This rule is a stricter sibling of 933210.
731
+ # Unlike 933210, this rule will also match "this is a 'dog' (not a cat)", because the semi-colon at the end of the string is optional.
732
+ # This is useful for PHP evals where the semi-colon is already hardcoded:
733
+ # <?php eval("($input);") ?>
734
+ #
735
+ # Any potential function calls not at the end of a string will require a semi-colon to form valid PHP, which is automatically covered by 933210.
736
+ #
737
+ # Regular expression generated from regex-assembly/933211.ra.
738
+ # To update the regular expression run the following shell script
739
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
740
+ # crs-toolchain regex update 933211
741
+ #
742
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx (?:\((?:.+\)(?:[\"'][\-0-9A-Z_a-z]+[\"'])?\(.+|[^\)]*string[^\)]*\)[\s\x0b\"'\-\.0-9A-\[\]_a-\{\}]+\([^\)]*)|(?:\[[0-9]+\]|\{[0-9]+\}|\$[^\(\),\./;\x5c]+|[\"'][\-0-9A-Z\x5c_a-z]+[\"'])\(.+)\)(?:;|$)?" \
743
+ "id:933211,\
744
+ phase:2,\
745
+ block,\
746
+ capture,\
747
+ t:none,t:urlDecodeUni,t:replaceComments,t:removeWhitespace,\
748
+ msg:'PHP Injection Attack: Variable Function Call Found',\
749
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
750
+ tag:'application-multi',\
751
+ tag:'language-php',\
752
+ tag:'platform-multi',\
753
+ tag:'attack-injection-php',\
754
+ tag:'paranoia-level/3',\
755
+ tag:'OWASP_CRS',\
756
+ tag:'capec/1000/152/242',\
757
+ ver:'OWASP_CRS/4.9.0',\
758
+ severity:'CRITICAL',\
759
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
760
+ setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
761
+
762
+
763
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:933017,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
764
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:933018,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
765
+ #
766
+ # -= Paranoia Level 4 =- (apply only when tx.detection_paranoia_level is sufficiently high: 4 or higher)
767
+ #
768
+
769
+
770
+
771
+ #
772
+ # -= Paranoia Levels Finished =-
773
+ #
774
+ SecMarker "END-REQUEST-933-APPLICATION-ATTACK-PHP"