@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.
- package/lib/nginx/includes/security/crs4/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example +200 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-901-INITIALIZATION.conf +470 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-905-COMMON-EXCEPTIONS.conf +57 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-911-METHOD-ENFORCEMENT.conf +76 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-913-SCANNER-DETECTION.conf +86 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf +1915 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-921-PROTOCOL-ATTACK.conf +558 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-922-MULTIPART-ATTACK.conf +120 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-930-APPLICATION-ATTACK-LFI.conf +203 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-931-APPLICATION-ATTACK-RFI.conf +189 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-932-APPLICATION-ATTACK-RCE.conf +1875 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf +774 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-934-APPLICATION-ATTACK-GENERIC.conf +366 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf +1071 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf +1978 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION.conf +132 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-944-APPLICATION-ATTACK-JAVA.conf +463 -0
- package/lib/nginx/includes/security/crs4/rules/REQUEST-949-BLOCKING-EVALUATION.conf +270 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-950-DATA-LEAKAGES.conf +156 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-951-DATA-LEAKAGES-SQL.conf +417 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-952-DATA-LEAKAGES-JAVA.conf +108 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-953-DATA-LEAKAGES-PHP.conf +158 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-954-DATA-LEAKAGES-IIS.conf +152 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-955-WEB-SHELLS.conf +558 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-959-BLOCKING-EVALUATION.conf +280 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-980-CORRELATION.conf +138 -0
- package/lib/nginx/includes/security/crs4/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example +76 -0
- package/lib/nginx/includes/security/crs4/rules/iis-errors.data +59 -0
- package/lib/nginx/includes/security/crs4/rules/java-classes.data +64 -0
- package/lib/nginx/includes/security/crs4/rules/java-code-leakages.data +17 -0
- package/lib/nginx/includes/security/crs4/rules/java-errors.data +10 -0
- package/lib/nginx/includes/security/crs4/rules/lfi-os-files.data +722 -0
- package/lib/nginx/includes/security/crs4/rules/php-config-directives.data +571 -0
- package/lib/nginx/includes/security/crs4/rules/php-errors-pl2.data +7 -0
- package/lib/nginx/includes/security/crs4/rules/php-errors.data +2147 -0
- package/lib/nginx/includes/security/crs4/rules/php-function-names-933150.data +245 -0
- package/lib/nginx/includes/security/crs4/rules/php-function-names-933151.data +2201 -0
- package/lib/nginx/includes/security/crs4/rules/php-variables.data +30 -0
- package/lib/nginx/includes/security/crs4/rules/restricted-files.data +284 -0
- package/lib/nginx/includes/security/crs4/rules/restricted-upload.data +177 -0
- package/lib/nginx/includes/security/crs4/rules/scanners-user-agents.data +119 -0
- package/lib/nginx/includes/security/crs4/rules/sql-errors.data +172 -0
- package/lib/nginx/includes/security/crs4/rules/ssrf.data +177 -0
- package/lib/nginx/includes/security/crs4/rules/unix-shell.data +670 -0
- package/lib/nginx/includes/security/crs4/rules/web-shells-php.data +167 -0
- package/lib/nginx/includes/security/crs4/rules/windows-powershell-commands.data +425 -0
- package/lib/nginx/includes/security/unicode.mapping +96 -0
- package/lib/nginx/index.js +50 -3
- package/lib/nginx/templates/security/crs4/crs-setup.conf.js +857 -0
- package/lib/nginx/templates/security/modsecurity.conf.js +244 -0
- package/package.json +7 -6
|
@@ -0,0 +1,1875 @@
|
|
|
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:932011,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
18
|
+
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:932012,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
19
|
+
#
|
|
20
|
+
# -= Paranoia Level 1 (default) =- (apply only when tx.detection_paranoia_level is sufficiently high: 1 or higher)
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# [ Unix command injection ]
|
|
25
|
+
#
|
|
26
|
+
# This rule detects Unix command injections.
|
|
27
|
+
# A command injection takes a form such as:
|
|
28
|
+
#
|
|
29
|
+
# foo.jpg;uname -a
|
|
30
|
+
# foo.jpg||uname -a
|
|
31
|
+
#
|
|
32
|
+
# The vulnerability exists when an application executes a shell command
|
|
33
|
+
# without proper input escaping/validation.
|
|
34
|
+
#
|
|
35
|
+
# This rule is also triggered by an Oracle WebLogic Remote Command Execution exploit:
|
|
36
|
+
# [ Oracle WebLogic vulnerability CVE-2017-10271 - Exploit tested: https://www.exploit-db.com/exploits/43458 ]
|
|
37
|
+
#
|
|
38
|
+
# To prevent false positives, we look for a 'starting sequence' that
|
|
39
|
+
# precedes a command in shell syntax, such as: ; | & $( ` <( >(
|
|
40
|
+
# Anatomy of the regexp with examples of patterns caught:
|
|
41
|
+
#
|
|
42
|
+
# 1. Starting tokens
|
|
43
|
+
#
|
|
44
|
+
# ; ;ifconfig
|
|
45
|
+
# \{ {ifconfig}
|
|
46
|
+
# \| |ifconfig
|
|
47
|
+
# \|\| ||ifconfig
|
|
48
|
+
# & &ifconfig
|
|
49
|
+
# && &&ifconfig
|
|
50
|
+
# \n ;\nifconfig
|
|
51
|
+
# \r ;\rifconfig
|
|
52
|
+
# \$\( $(ifconfig)
|
|
53
|
+
# \$\(\( $((ifconfig))
|
|
54
|
+
# \$\[ $[2+2]
|
|
55
|
+
# ` `ifconfig`
|
|
56
|
+
# \${ ${ifconfig}
|
|
57
|
+
# <\( <( ifconfig )
|
|
58
|
+
# >\( >( ifconfig )
|
|
59
|
+
# \(\s*\) a() ( ifconfig; ); a
|
|
60
|
+
#
|
|
61
|
+
# 2. Command prefixes
|
|
62
|
+
#
|
|
63
|
+
# { { ifconfig }
|
|
64
|
+
# \s*\(\s* ( ifconfig )
|
|
65
|
+
# \w+=(?:[^\s]*|\$.*|\$.*|<.*|>.*|\'.*\'|\".*\")\s+ VARNAME=xyz ifconfig
|
|
66
|
+
# !\s* ! ifconfig
|
|
67
|
+
# \$ $ifconfig
|
|
68
|
+
#
|
|
69
|
+
# 3. Quoting
|
|
70
|
+
#
|
|
71
|
+
# ' 'ifconfig'
|
|
72
|
+
# \" "ifconfig"
|
|
73
|
+
#
|
|
74
|
+
# 4. Paths
|
|
75
|
+
#
|
|
76
|
+
# [\?\*\[\]\(\)\-\|+\w'\"\./\x5c]+/ /sbin/ifconfig, /s?in/./ifconfig, /s[a-b]in/ifconfig etc.
|
|
77
|
+
#
|
|
78
|
+
# An effort was made to combat evasions by shell quoting (e.g. 'ls',
|
|
79
|
+
# 'l'"s", \l\s are all valid). ModSecurity has a t:cmdLine
|
|
80
|
+
# transformation built-in to deal with this, but unfortunately, it
|
|
81
|
+
# replaces ';' characters and lowercases the payload, which is less
|
|
82
|
+
# useful for this case. However, emulating the transformation makes
|
|
83
|
+
# the regexp more complex.
|
|
84
|
+
#
|
|
85
|
+
# This is the base Rule to prevent Unix Command Injection
|
|
86
|
+
# for prefix + two and three characters.
|
|
87
|
+
#
|
|
88
|
+
# Rule relations:
|
|
89
|
+
#
|
|
90
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
91
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
92
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
93
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
94
|
+
#
|
|
95
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
96
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
97
|
+
#
|
|
98
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
99
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
100
|
+
# - with and without prefix
|
|
101
|
+
# - words of any length)
|
|
102
|
+
# ..932239 (sibling of 932236, PL2,
|
|
103
|
+
# - with and without prefix
|
|
104
|
+
# - words of any length
|
|
105
|
+
# - targets request headers user-agent and referer only
|
|
106
|
+
# - excluded words: known user-agents)
|
|
107
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
108
|
+
# - no excluded words)
|
|
109
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
110
|
+
# - targets request headers user-agent and referer only
|
|
111
|
+
# - without prefix
|
|
112
|
+
# - with word boundaries
|
|
113
|
+
# - words of any length
|
|
114
|
+
# - excluded words: known user-agents)
|
|
115
|
+
#
|
|
116
|
+
#
|
|
117
|
+
# Regular expression generated from regex-assembly/932230.ra.
|
|
118
|
+
# To update the regular expression run the following shell script
|
|
119
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
120
|
+
# crs-toolchain regex update 932230
|
|
121
|
+
#
|
|
122
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?y[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?x|c[\"'\)\[\x5c]*(?:(?:(?:\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\x5c?d|(?:s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?)?h)[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?[\s\x0b&\),<>\|].*|v[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?n)|u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?d[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?p|w[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?3[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m)\b" \
|
|
123
|
+
"id:932230,\
|
|
124
|
+
phase:2,\
|
|
125
|
+
block,\
|
|
126
|
+
capture,\
|
|
127
|
+
t:none,\
|
|
128
|
+
msg:'Remote Command Execution: Unix Command Injection (2-3 chars)',\
|
|
129
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
130
|
+
tag:'application-multi',\
|
|
131
|
+
tag:'language-shell',\
|
|
132
|
+
tag:'platform-unix',\
|
|
133
|
+
tag:'attack-rce',\
|
|
134
|
+
tag:'paranoia-level/1',\
|
|
135
|
+
tag:'OWASP_CRS',\
|
|
136
|
+
tag:'capec/1000/152/248/88',\
|
|
137
|
+
tag:'PCI/6.5.2',\
|
|
138
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
139
|
+
severity:'CRITICAL',\
|
|
140
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
141
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
142
|
+
|
|
143
|
+
# [ Unix command injection ]
|
|
144
|
+
#
|
|
145
|
+
# This is the base Rule to prevent Unix Command Injection
|
|
146
|
+
# for prefix + more than 4 characters.
|
|
147
|
+
#
|
|
148
|
+
# Rule relations:
|
|
149
|
+
#
|
|
150
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
151
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
152
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
153
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
154
|
+
#
|
|
155
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
156
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
157
|
+
#
|
|
158
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
159
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
160
|
+
# - with and without prefix
|
|
161
|
+
# - words of any length)
|
|
162
|
+
# ..932239 (sibling of 932236, PL2,
|
|
163
|
+
# - with and without prefix
|
|
164
|
+
# - words of any length
|
|
165
|
+
# - targets request headers user-agent and referer only
|
|
166
|
+
# - excluded words: known user-agents)
|
|
167
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
168
|
+
# - no excluded words)
|
|
169
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
170
|
+
# - targets request headers user-agent and referer only
|
|
171
|
+
# - without prefix
|
|
172
|
+
# - with word boundaries
|
|
173
|
+
# - words of any length
|
|
174
|
+
# - excluded words: known user-agents)
|
|
175
|
+
#
|
|
176
|
+
#
|
|
177
|
+
# Regular expression generated from regex-assembly/932235.ra.
|
|
178
|
+
# To update the regular expression run the following shell script
|
|
179
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
180
|
+
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)<>\|]|ia2c)|s(?:cii(?:-xfr|85)|pell)|tobm)|b(?:a(?:s(?:e(?:32|64|n(?:ame[\s\x0b&\)<>\|]|c))|h[\s\x0b&\)<>\|])|tch[\s\x0b&\)<>\|])|lkid|pftrace|r(?:eaksw|idge[\s\x0b&\)<>\|])|sd(?:cat|iff|tar)|u(?:iltin|n(?:dler[\s\x0b&\)<>\|]|zip2)|s(?:ctl|ybox))|y(?:ebug|obu)|z(?:c(?:at|mp)|diff|e(?:grep|xe)|f?grep|ip2(?:recover)?|less|more))|c(?:a(?:ncel|psh)[\s\x0b&\)<>\|]|ertbot|h(?:attr|(?:dir|root)[\s\x0b&\)<>\|]|e(?:ck_(?:by_ssh|cups|log|memory|raid|s(?:sl_cert|tatusfile))|f[\s\x0b&\)\-<>\|])|(?:flag|pas)s|g(?:passwd|rp)|mod|o(?:om|wn)|sh)|lang(?:[\s\x0b&\)<>\|]|\+\+)|o(?:(?:b|pro)c|(?:lumn|m(?:m(?:and)?|p(?:oser|ress)))[\s\x0b&\)<>\|]|w(?:say|think))|p(?:an|io|ulimit)|r(?:ash[\s\x0b&\)<>\|]|on(?:[\s\x0b&\)<>\|]|tab))|s(?:cli[\s\x0b&\)<>\|]|plit|vtool)|u(?:psfilter|rl[\s\x0b&\)<>\|]))|d(?:(?:a(?:sh|te)|i(?:alog|ff))[\s\x0b&\)<>\|]|hclient|m(?:esg|idecode|setup)|o(?:as|(?:cker|ne)[\s\x0b&\)<>\|]|sbox)|pkg|vips)|e(?:2fsck|(?:asy_instal|va)l|cho[\s\x0b&\)<>\|]|fax|grep|macs|n(?:d(?:if|sw)|v-update)|sac|x(?:ec[\s\x0b&\)<>\|]|iftool|p(?:(?:and|(?:ec|or)t)[\s\x0b&\)<>\|]|r)))|f(?:acter|(?:etch|lock|unction)[\s\x0b&\)<>\|]|grep|i(?:le(?:[\s\x0b&\)<>\|]|test)|(?:n(?:d|ger)|sh)[\s\x0b&\)<>\|])|o(?:ld[\s\x0b&\)<>\|]|reach)|ping|tp(?:stats|who))|g(?:awk[\s\x0b&\)<>\|]|core|e(?:ni(?:e[\s\x0b&\)<>\|]|soimage)|tfacl[\s\x0b&\)<>\|])|hci|i(?:mp[\s\x0b&\)<>\|]|nsh)|r(?:ep[\s\x0b&\)<>\|]|oup(?:[\s\x0b&\)<>\|]|mod))|tester|unzip|z(?:cat|exe|ip))|h(?:(?:ash|i(?:ghlight|story))[\s\x0b&\)<>\|]|e(?:ad[\s\x0b&\)<>\|]|xdump)|ost(?:id|name)|ping3|t(?:digest|op|passwd))|i(?:conv|f(?:config|top)|nstall[\s\x0b&\)<>\|]|onice|p(?:6?tables|config)|spell)|j(?:ava[\s\x0b&\)<>\|]|exec|o(?:(?:bs|in)[\s\x0b&\)<>\|]|urnalctl)|runscript)|k(?:ill(?:[\s\x0b&\)<>\|]|all)|nife[\s\x0b&\)<>\|]|sshell)|l(?:a(?:st(?:[\s\x0b&\)<>\|]|comm|log(?:in)?)|tex[\s\x0b&\)<>\|])|dconfig|ess(?:[\s\x0b&\)<>\|]|echo|(?:fil|pip)e)|ftp(?:get)?|(?:inks|ynx)[\s\x0b&\)<>\|]|o(?:(?:ca(?:l|te)|ok)[\s\x0b&\)<>\|]|g(?:inctl|(?:nam|sav)e)|setup)|s(?:-F|b_release|cpu|hw|mod|of|pci|usb)|trace|ua(?:la)?tex|wp-(?:d(?:ownload|ump)|mirror|request)|z(?:4c(?:at)?|c(?:at|mp)|diff|[ef]?grep|less|m(?:a(?:dec|info)?|ore)))|m(?:a(?:il(?:[\s\x0b&\)<>q\|]|x[\s\x0b&\)<>\|])|ke[\s\x0b&\)<>\|]|ster\.passwd|wk)|k(?:dir[\s\x0b&\)<>\|]|fifo|nod|temp)|locate|o(?:squitto|unt[\s\x0b&\)<>\|])|sg(?:attrib|c(?:at|onv)|filter|merge|uniq)|utt[\s\x0b&\)<>\|]|ysql(?:admin|dump(?:slow)?|hotcopy|show)?)|n(?:a(?:no[\s\x0b&\)<>\|]|sm|wk)|c(?:\.(?:openbsd|traditional)|at)|e(?:ofetch|t(?:(?:c|st)at|kit-ftp|plan))|(?:ice|ull)[\s\x0b&\)<>\|]|map|o(?:de[\s\x0b&\)<>\|]|hup)|ping|roff|s(?:enter|lookup|tat))|o(?:ctave[\s\x0b&\)<>\|]|nintr|p(?:en(?:ssl|v(?:pn|t))|kg))|p(?:a(?:(?:cman|rted|tch)[\s\x0b&\)<>\|]|s(?:swd|te[\s\x0b&\)<>\|]))|d(?:f(?:la)?tex|ksh)|er(?:(?:f|ms)[\s\x0b&\)<>\|]|l(?:[\s\x0b&\)5<>\|]|sh))|(?:ft|gre)p|hp(?:-cgi|[57])|i(?:(?:co|ng)[\s\x0b&\)<>\|]|dstat|gz)|k(?:exec|g_?info|ill)|opd|rint(?:env|f[\s\x0b&\)<>\|])|s(?:ed|ftp|ql)|tar(?:diff|grep)?|u(?:ppet[\s\x0b&\)<>\|]|shd)|wd\.db|y(?:thon[^\s\x0b]|3?versions))|r(?:ak(?:e[\s\x0b&\)<>\|]|u)|bash|e(?:a(?:delf|lpath)|(?:dcarpet|name|p(?:eat|lace))[\s\x0b&\)<>\|]|stic)|l(?:ogin|wrap)|m(?:dir[\s\x0b&\)<>\|]|user)|nano|oute[\s\x0b&\)<>\|]|pm(?:db|(?:quer|verif)y)|sync|u(?:by[^\s\x0b]|n-(?:mailcap|parts))|vi(?:ew|m))|s(?:(?:ash|c(?:hed|r(?:een|ipt))|nap)[\s\x0b&\)<>\|]|diff|e(?:(?:lf|rvice)[\s\x0b&\)<>\|]|ndmail|t(?:arch|env|facl[\s\x0b&\)<>\|]|sid))|ftp|h(?:\.distrib|(?:adow|ells)[\s\x0b&\)<>\|]|u(?:f|tdown[\s\x0b&\)<>\|]))|l(?:eep[\s\x0b&\)<>\|]|sh)|mbclient|o(?:cat|elim|(?:rt|urce)[\s\x0b&\)<>\|])|p(?:lit[\s\x0b&\)<>\|]|wd\.db)|qlite3|sh(?:-key(?:ge|sca)n|pass)|t(?:art-stop-daemon|d(?:buf|err|in|out)|r(?:ace|ings[\s\x0b&\)<>\|]))|udo|ys(?:ctl|tem(?:ctl|d-resolve)))|t(?:a(?:il[\s\x0b&\)<>f\|]|sk(?:[\s\x0b&\)<>\|]|set))|c(?:l?sh|p(?:dump|ing|traceroute))|elnet|ftp|ime(?:datectl|out[\s\x0b&\)<>\|])|mux|ouch[\s\x0b&\)<>\|]|r(?:aceroute6?|off)|shark)|u(?:limit[\s\x0b&\)<>\|]|n(?:ame|(?:compress|s(?:et|hare))[\s\x0b&\)<>\|]|expand|iq|l(?:ink[\s\x0b&\)<>\|]|z(?:4|ma))|(?:pig|x)z|rar|z(?:ip[\s\x0b&\)<>\|]|std))|p(?:2date[\s\x0b&\)<>\|]|date-alternatives)|ser(?:(?:ad|mo)d|del)|u(?:de|en)code)|v(?:algrind|i(?:ew[\s\x0b&\)<>\|]|gr|mdiff|pw|rsh|sudo)|olatility[\s\x0b&\)<>\|])|w(?:a(?:ll|tch)[\s\x0b&\)<>\|]|get|h(?:iptail[\s\x0b&\)<>\|]|o(?:ami|is))|i(?:reshark|sh[\s\x0b&\)<>\|]))|x(?:args|e(?:la)?tex|mo(?:dmap|re)|pad|term|z(?:c(?:at|mp)|d(?:ec|iff)|[ef]?grep|less|more))|z(?:athura|c(?:at|mp)|diff|e(?:grep|ro[\s\x0b&\)<>\|])|f?grep|ip(?:c(?:loak|mp)|details|grep|info|(?:merg|not)e|split|tool)|less|more|run|s(?:oelim|td(?:(?:ca|m)t|grep|less)?)|ypper))" \
|
|
183
|
+
"id:932235,\
|
|
184
|
+
phase:2,\
|
|
185
|
+
block,\
|
|
186
|
+
capture,\
|
|
187
|
+
t:none,\
|
|
188
|
+
msg:'Remote Command Execution: Unix Command Injection (command without evasion)',\
|
|
189
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
190
|
+
tag:'application-multi',\
|
|
191
|
+
tag:'language-shell',\
|
|
192
|
+
tag:'platform-unix',\
|
|
193
|
+
tag:'attack-rce',\
|
|
194
|
+
tag:'paranoia-level/1',\
|
|
195
|
+
tag:'OWASP_CRS',\
|
|
196
|
+
tag:'capec/1000/152/248/88',\
|
|
197
|
+
tag:'PCI/6.5.2',\
|
|
198
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
199
|
+
severity:'CRITICAL',\
|
|
200
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
201
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# [ Windows PowerShell, cmdlets and options ]
|
|
205
|
+
#
|
|
206
|
+
# Detect some common PowerShell commands, cmdlets and options.
|
|
207
|
+
# These commands should be relatively uncommon in normal text, but
|
|
208
|
+
# potentially useful for code injection.
|
|
209
|
+
#
|
|
210
|
+
# If you are not running Windows, it is safe to disable this rule.
|
|
211
|
+
#
|
|
212
|
+
# https://learn.microsoft.com/en-us/previous-versions/technet-magazine/ff714569(v=msdn.10)
|
|
213
|
+
#
|
|
214
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile windows-powershell-commands.data" \
|
|
215
|
+
"id:932120,\
|
|
216
|
+
phase:2,\
|
|
217
|
+
block,\
|
|
218
|
+
capture,\
|
|
219
|
+
t:none,t:cmdLine,\
|
|
220
|
+
msg:'Remote Command Execution: Windows PowerShell Command Found',\
|
|
221
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
222
|
+
tag:'application-multi',\
|
|
223
|
+
tag:'language-shell',\
|
|
224
|
+
tag:'language-powershell',\
|
|
225
|
+
tag:'platform-windows',\
|
|
226
|
+
tag:'attack-rce',\
|
|
227
|
+
tag:'paranoia-level/1',\
|
|
228
|
+
tag:'OWASP_CRS',\
|
|
229
|
+
tag:'capec/1000/152/248/88',\
|
|
230
|
+
tag:'PCI/6.5.2',\
|
|
231
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
232
|
+
severity:'CRITICAL',\
|
|
233
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
234
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
# [ Windows Powershell cmdlet aliases ]
|
|
238
|
+
#
|
|
239
|
+
# Attempts to detect aliases of the common PowerShell cmdlets in windows-powershell-commands.data
|
|
240
|
+
# If you are not running Windows, it is safe to disable this rule.
|
|
241
|
+
#
|
|
242
|
+
# There are other aliases which are similar to Unix, but they are properly handled by rule 932105
|
|
243
|
+
#
|
|
244
|
+
# Regular expression generated from regex-assembly/932125.ra.
|
|
245
|
+
# To update the regular expression run the following shell script
|
|
246
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
247
|
+
# crs-toolchain regex update 932125
|
|
248
|
+
#
|
|
249
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:[\n\r;`\{]|\|\|?|&&?)[\s\x0b]*[\s\x0b\"'\(,@]*(?:[\"'\.-9A-Z_a-z]+/|(?:[\"'\x5c\^]*[0-9A-Z_a-z][\"'\x5c\^]*:.*|[ \"'\.-9A-Z\x5c\^_a-z]*)\x5c)?[\"\^]*(?:(?:a[\"\^]*(?:c|s[\"\^]*n[\"\^]*p)|e[\"\^]*(?:b[\"\^]*p|p[\"\^]*(?:a[\"\^]*l|c[\"\^]*s[\"\^]*v|s[\"\^]*n)|[tx][\"\^]*s[\"\^]*n)|f[\"\^]*(?:[cltw]|o[\"\^]*r[\"\^]*e[\"\^]*a[\"\^]*c[\"\^]*h)|i[\"\^]*(?:[cr][\"\^]*m|e[\"\^]*x|h[\"\^]*y|i|p[\"\^]*(?:a[\"\^]*l|c[\"\^]*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[\"\^]*(?:r[\"\^]*)?|m[\"\^]*(?:(?:d[\"\^]*i[\"\^]*r|o)[\"\^]*)?|s[\"\^]*n[\"\^]*(?:p[\"\^]*)?|v[\"\^]*(?:p[\"\^]*a[\"\^]*)?)[\s\x0b,\./;<>].*|c[\"\^]*(?:j[\"\^]*b[\"\^]*[\s\x0b,\./;<>].*|s[\"\^]*n)|u[\"\^]*j[\"\^]*b)|s[\"\^]*(?:(?:(?:a[\"\^]*(?:j[\"\^]*b|l|p[\"\^]*s|s[\"\^]*v)|b[\"\^]*p|[civ]|w[\"\^]*m[\"\^]*i)[\"\^]*|l[\"\^]*(?:s[\"\^]*)?|p[\"\^]*(?:(?:j[\"\^]*b|p[\"\^]*s|s[\"\^]*v)[\"\^]*)?)[\s\x0b,\./;<>].*|h[\"\^]*c[\"\^]*m|u[\"\^]*j[\"\^]*b))(?:\.[\"\^]*[0-9A-Z_a-z]+)?\b" \
|
|
250
|
+
"id:932125,\
|
|
251
|
+
phase:2,\
|
|
252
|
+
block,\
|
|
253
|
+
capture,\
|
|
254
|
+
t:none,\
|
|
255
|
+
msg:'Remote Command Execution: Windows Powershell Alias Command Injection',\
|
|
256
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
257
|
+
tag:'application-multi',\
|
|
258
|
+
tag:'language-shell',\
|
|
259
|
+
tag:'platform-windows',\
|
|
260
|
+
tag:'attack-rce',\
|
|
261
|
+
tag:'paranoia-level/1',\
|
|
262
|
+
tag:'OWASP_CRS',\
|
|
263
|
+
tag:'capec/1000/152/248/88',\
|
|
264
|
+
tag:'PCI/6.5.2',\
|
|
265
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
266
|
+
severity:'CRITICAL',\
|
|
267
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
268
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
# [ Unix shell expressions ]
|
|
272
|
+
#
|
|
273
|
+
# Detects the following patterns which are common in Unix shell scripts
|
|
274
|
+
# and one-liners:
|
|
275
|
+
#
|
|
276
|
+
# $(foo) Command substitution
|
|
277
|
+
# ${foo} Parameter expansion
|
|
278
|
+
# <(foo) Process substitution
|
|
279
|
+
# >(foo) Process substitution
|
|
280
|
+
# $((foo)) Arithmetic expansion
|
|
281
|
+
# $[2+2] Arithmetic expansion
|
|
282
|
+
# /e[t]c Shell glob expression to bypass wordlists
|
|
283
|
+
#
|
|
284
|
+
# This rule has a stricter sibling: 932131 (PL2) that applies the same regex to User-Agent and Referer
|
|
285
|
+
#
|
|
286
|
+
# This rule is essential to defend against the Log4J / Log4Shell attacks (see also rule 944150)
|
|
287
|
+
#
|
|
288
|
+
# Regular expression generated from regex-assembly/932130.ra.
|
|
289
|
+
# To update the regular expression run the following shell script
|
|
290
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
291
|
+
# crs-toolchain regex update 932130
|
|
292
|
+
#
|
|
293
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \$(?:\((?:.*|\(.*\))\)|\{.*\}|\[.*\])|[<>]\(.*\)|/[0-9A-Z_a-z]*\[!?.+\]" \
|
|
294
|
+
"id:932130,\
|
|
295
|
+
phase:2,\
|
|
296
|
+
block,\
|
|
297
|
+
capture,\
|
|
298
|
+
t:none,t:cmdLine,\
|
|
299
|
+
msg:'Remote Command Execution: Unix Shell Expression Found',\
|
|
300
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
301
|
+
tag:'application-multi',\
|
|
302
|
+
tag:'language-shell',\
|
|
303
|
+
tag:'platform-unix',\
|
|
304
|
+
tag:'attack-rce',\
|
|
305
|
+
tag:'paranoia-level/1',\
|
|
306
|
+
tag:'OWASP_CRS',\
|
|
307
|
+
tag:'capec/1000/152/248/88',\
|
|
308
|
+
tag:'PCI/6.5.2',\
|
|
309
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
310
|
+
severity:'CRITICAL',\
|
|
311
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
312
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
# [ Windows FOR, IF commands ]
|
|
316
|
+
#
|
|
317
|
+
# This rule detects Windows command shell FOR and IF commands.
|
|
318
|
+
# If you are not running Windows, it is safe to disable this rule.
|
|
319
|
+
#
|
|
320
|
+
# Examples:
|
|
321
|
+
#
|
|
322
|
+
# FOR %a IN (set) DO
|
|
323
|
+
# FOR /D %a IN (dirs) DO
|
|
324
|
+
# FOR /F "options" %a IN (text|"text") DO
|
|
325
|
+
# FOR /L %a IN (start,step,end) DO
|
|
326
|
+
# FOR /R C:\dir %A IN (set) DO
|
|
327
|
+
#
|
|
328
|
+
# IF [/I] [NOT] EXIST filename | DEFINED define | ERRORLEVEL n | CMDEXTVERSION n
|
|
329
|
+
# IF [/I] [NOT] item1 [==|EQU|NEQ|LSS|LEQ|GTR|GEQ] item2
|
|
330
|
+
# IF [/I] [NOT] (item1) [==|EQU|NEQ|LSS|LEQ|GTR|GEQ] (item2)
|
|
331
|
+
#
|
|
332
|
+
# http://ss64.com/nt/if.html
|
|
333
|
+
# http://ss64.com/nt/for.html
|
|
334
|
+
#
|
|
335
|
+
# Regular expression generated from regex-assembly/932140.ra.
|
|
336
|
+
# To update the regular expression run the following shell script
|
|
337
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
338
|
+
# crs-toolchain regex update 932140
|
|
339
|
+
#
|
|
340
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \b(?:for(?:/[dflr].*)? %+[^ ]+ in\(.*\)[\s\x0b]?do|if(?:/i)?(?: not)?(?: (?:e(?:xist|rrorlevel)|defined|cmdextversion)\b|[ \(].*(?:\b(?:g(?:eq|tr)|equ|neq|l(?:eq|ss))\b|==)))" \
|
|
341
|
+
"id:932140,\
|
|
342
|
+
phase:2,\
|
|
343
|
+
block,\
|
|
344
|
+
capture,\
|
|
345
|
+
t:none,t:cmdLine,\
|
|
346
|
+
msg:'Remote Command Execution: Windows FOR/IF Command Found',\
|
|
347
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
348
|
+
tag:'application-multi',\
|
|
349
|
+
tag:'language-shell',\
|
|
350
|
+
tag:'platform-windows',\
|
|
351
|
+
tag:'attack-rce',\
|
|
352
|
+
tag:'paranoia-level/1',\
|
|
353
|
+
tag:'OWASP_CRS',\
|
|
354
|
+
tag:'capec/1000/152/248/88',\
|
|
355
|
+
tag:'PCI/6.5.2',\
|
|
356
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
357
|
+
severity:'CRITICAL',\
|
|
358
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
359
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
# [ Unix shell expressions - Bash Tilde expansion ]
|
|
363
|
+
#
|
|
364
|
+
# Detects the following patterns which are common in Unix shell scripts
|
|
365
|
+
# and one-liners:
|
|
366
|
+
#
|
|
367
|
+
# ~+ $PWD
|
|
368
|
+
# ~- $OLDPWD
|
|
369
|
+
# ~4 fourth directory entry on the stack from the top
|
|
370
|
+
# ~-2 second directory entry on the stack from the top
|
|
371
|
+
# ~+2 second directory entry on the stack from the bottom
|
|
372
|
+
#
|
|
373
|
+
# Reference - https://linuxsimply.com/bash-scripting-tutorial/expansion/tilde-expansion/
|
|
374
|
+
#
|
|
375
|
+
# Regular expression generated from regex-assembly/932270.ra.
|
|
376
|
+
# To update the regular expression run the following shell script
|
|
377
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
378
|
+
# crs-toolchain regex update 932270
|
|
379
|
+
#
|
|
380
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ~(?:[\+\-](?:$|[\s\x0b0-9]+)|[0-9]+)" \
|
|
381
|
+
"id:932270,\
|
|
382
|
+
phase:2,\
|
|
383
|
+
block,\
|
|
384
|
+
capture,\
|
|
385
|
+
t:none,t:cmdLine,\
|
|
386
|
+
msg:'Remote Command Execution: Unix Shell Expression Found',\
|
|
387
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
388
|
+
tag:'application-multi',\
|
|
389
|
+
tag:'language-shell',\
|
|
390
|
+
tag:'platform-unix',\
|
|
391
|
+
tag:'attack-rce',\
|
|
392
|
+
tag:'paranoia-level/1',\
|
|
393
|
+
tag:'OWASP_CRS',\
|
|
394
|
+
tag:'capec/1000/152/248/88',\
|
|
395
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
396
|
+
severity:'CRITICAL',\
|
|
397
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
398
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
# [ Unix direct remote command execution ]
|
|
402
|
+
#
|
|
403
|
+
# Detects Unix commands at the start of a parameter (direct RCE).
|
|
404
|
+
# Example: foo=wget%20www.example.com
|
|
405
|
+
#
|
|
406
|
+
# In this rule we use a different check from command injection (rule 932230), where a
|
|
407
|
+
# command string is appended (injected) to a regular parameter, and then
|
|
408
|
+
# passed to a shell unescaped.
|
|
409
|
+
#
|
|
410
|
+
# Additionaly, we require a trailing space (denoting command parameters) or command
|
|
411
|
+
# separator character after the command.
|
|
412
|
+
#
|
|
413
|
+
# This rule is also triggered by an Oracle WebLogic Remote Command Execution exploit:
|
|
414
|
+
# [ Oracle WebLogic vulnerability CVE-2017-10271 - Exploit tested: https://www.exploit-db.com/exploits/43458 ]
|
|
415
|
+
#
|
|
416
|
+
# An effort was made to combat evasions by shell quoting (e.g. 'ls',
|
|
417
|
+
# 'l'"s", \l\s are all valid). ModSecurity has a t:cmdLine
|
|
418
|
+
# transformation built-in to deal with this, but unfortunately, it
|
|
419
|
+
# replaces ';' characters and lowercases the payload, which is less
|
|
420
|
+
# useful for this case. However, emulating the transformation makes
|
|
421
|
+
# the regexp more complex.
|
|
422
|
+
#
|
|
423
|
+
# This is the base Rule to prevent Direct Unix Command Injection
|
|
424
|
+
# without prefix match.
|
|
425
|
+
#
|
|
426
|
+
# Rule relations:
|
|
427
|
+
#
|
|
428
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
429
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
430
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
431
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
432
|
+
#
|
|
433
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
434
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
435
|
+
#
|
|
436
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
437
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
438
|
+
# - with and without prefix
|
|
439
|
+
# - words of any length)
|
|
440
|
+
# ..932239 (sibling of 932236, PL2,
|
|
441
|
+
# - with and without prefix
|
|
442
|
+
# - words of any length
|
|
443
|
+
# - targets request headers user-agent and referer only
|
|
444
|
+
# - excluded words: known user-agents)
|
|
445
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
446
|
+
# - no excluded words)
|
|
447
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
448
|
+
# - targets request headers user-agent and referer only
|
|
449
|
+
# - without prefix
|
|
450
|
+
# - with word boundaries
|
|
451
|
+
# - words of any length
|
|
452
|
+
# - excluded words: known user-agents)
|
|
453
|
+
#
|
|
454
|
+
#
|
|
455
|
+
# Regular expression generated from regex-assembly/932250.ra.
|
|
456
|
+
# To update the regular expression run the following shell script
|
|
457
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
458
|
+
# crs-toolchain regex update 932250
|
|
459
|
+
#
|
|
460
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:^|b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?y[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?x|c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m[\"'\)\[\x5c]*(?:(?:(?:\|\||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@_a-\{]*)?\x5c?c(?:[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?p)?|s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?(?:c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?p|e[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?d|(?:s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?)?h|v[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?n)|w[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?3[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m)[\s\x0b&\)<>\|]" \
|
|
461
|
+
"id:932250,\
|
|
462
|
+
phase:2,\
|
|
463
|
+
block,\
|
|
464
|
+
capture,\
|
|
465
|
+
t:none,\
|
|
466
|
+
msg:'Remote Command Execution: Direct Unix Command Execution',\
|
|
467
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
468
|
+
tag:'application-multi',\
|
|
469
|
+
tag:'language-shell',\
|
|
470
|
+
tag:'platform-unix',\
|
|
471
|
+
tag:'attack-rce',\
|
|
472
|
+
tag:'paranoia-level/1',\
|
|
473
|
+
tag:'OWASP_CRS',\
|
|
474
|
+
tag:'capec/1000/152/248/88',\
|
|
475
|
+
tag:'PCI/6.5.2',\
|
|
476
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
477
|
+
severity:'CRITICAL',\
|
|
478
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
479
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
480
|
+
|
|
481
|
+
# [ Unix command injection ]
|
|
482
|
+
#
|
|
483
|
+
# This rule complements rule 932250 for commands of 4 characters and up.
|
|
484
|
+
#
|
|
485
|
+
# Rule relations:
|
|
486
|
+
#
|
|
487
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
488
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
489
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
490
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
491
|
+
#
|
|
492
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
493
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
494
|
+
#
|
|
495
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
496
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
497
|
+
# - with and without prefix
|
|
498
|
+
# - words of any length)
|
|
499
|
+
# ..932239 (sibling of 932236, PL2,
|
|
500
|
+
# - with and without prefix
|
|
501
|
+
# - words of any length
|
|
502
|
+
# - targets request headers user-agent and referer only
|
|
503
|
+
# - excluded words: known user-agents)
|
|
504
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
505
|
+
# - no excluded words)
|
|
506
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
507
|
+
# - targets request headers user-agent and referer only
|
|
508
|
+
# - without prefix
|
|
509
|
+
# - with word boundaries
|
|
510
|
+
# - words of any length
|
|
511
|
+
# - excluded words: known user-agents)
|
|
512
|
+
#
|
|
513
|
+
#
|
|
514
|
+
# Regular expression generated from regex-assembly/932260.ra.
|
|
515
|
+
# To update the regular expression run the following shell script
|
|
516
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
517
|
+
# crs-toolchain regex update 932260
|
|
518
|
+
#
|
|
519
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:^|b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?y[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?x|c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?a[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?n[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\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ox)|yobu|z(?:c(?:at|mp)|diff|e(?:grep|xe)|f?grep|ip2(?:recover)?|less|more))|c(?:h(?:ef[\s\x0b&\)\-<>\|]|g(?:passwd|rp)|pass|sh)|lang\+\+|o(?:mm[\s\x0b&\)<>\|]|proc)|(?:ron|scli)[\s\x0b&\)<>\|])|d(?:iff[\s\x0b&\)<>\|]|mesg|oas)|e(?:2fsck|grep)|f(?:grep|iletest|tp(?:stats|who))|g(?:r(?:ep[\s\x0b&\)<>\|]|oupmod)|unzip|z(?:cat|exe|ip))|htop|l(?:ast(?:comm|log(?:in)?)|ess(?:echo|(?:fil|pip)e)|ftp(?:get)?|osetup|s(?:-F|b_release|cpu|mod|of|pci|usb)|wp-download|z(?:4c(?:at)?|c(?:at|mp)|diff|[ef]?grep|less|m(?:a(?:dec|info)?|ore)))|m(?:a(?:ilq|ster\.passwd)|k(?:fifo|nod|temp)|locate|ysql(?:admin|dump(?:slow)?|hotcopy|show))|n(?:c(?:\.(?:openbsd|traditional)|at)|et(?:(?:c|st)at|kit-ftp|plan)|ohup|ping|stat)|onintr|p(?:dksh|er(?:f[\s\x0b&\)<>\|]|l[\s\x0b&\)5<>\|])|(?:ft|gre)p|hp(?:-cgi|[57])|igz|k(?:exec|ill)|(?:op|se)d|rint(?:env|f[\s\x0b&\)<>\|])|tar(?:diff|grep)?|wd\.db|y(?:thon[23]|3?versions))|r(?:(?:bas|ealpat)h|m(?:dir[\s\x0b&\)<>\|]|user)|nano|sync)|s(?:diff|e(?:ndmail|t(?:env|sid))|ftp|(?:h\.distri|pwd\.d)b|ocat|td(?:err|in|out)|udo|ysctl)|t(?:ailf|c(?:p(?:ing|traceroute)|sh)|elnet|imeout[\s\x0b&\)<>\|]|raceroute6?)|u(?:n(?:ame|lz(?:4|ma)|(?:pig|x)z|rar|zstd)|ser(?:(?:ad|mo)d|del))|vi(?:gr|pw|sudo)|w(?:get|hoami)|x(?:args|z(?:c(?:at|mp)|d(?:ec|iff)|[ef]?grep|less|more))|z(?:c(?:at|mp)|diff|[ef]?grep|ip(?:c(?:loak|mp)|details|grep|info|(?:merg|not)e|split|tool)|less|more|run|std(?:(?:ca|m)t|grep|less)?))" \
|
|
520
|
+
"id:932260,\
|
|
521
|
+
phase:2,\
|
|
522
|
+
block,\
|
|
523
|
+
capture,\
|
|
524
|
+
t:none,\
|
|
525
|
+
msg:'Remote Command Execution: Direct Unix Command Execution',\
|
|
526
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
527
|
+
tag:'application-multi',\
|
|
528
|
+
tag:'language-shell',\
|
|
529
|
+
tag:'platform-unix',\
|
|
530
|
+
tag:'attack-rce',\
|
|
531
|
+
tag:'paranoia-level/1',\
|
|
532
|
+
tag:'OWASP_CRS',\
|
|
533
|
+
tag:'capec/1000/152/248/88',\
|
|
534
|
+
tag:'PCI/6.5.2',\
|
|
535
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
536
|
+
severity:'CRITICAL',\
|
|
537
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
538
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
539
|
+
|
|
540
|
+
# [ Unix shell history invocation ]
|
|
541
|
+
#
|
|
542
|
+
# Detects Unix shell history invocations in any context.
|
|
543
|
+
#
|
|
544
|
+
# Example:
|
|
545
|
+
# GET /?rce=example.com
|
|
546
|
+
# GET /?rce=curl%20
|
|
547
|
+
# GET /?rce=!-1!-2
|
|
548
|
+
#
|
|
549
|
+
# Will execute `curl example.com`. We should be able to detect the '!-<digit>' sequence with a very low risk of false-positives since the sequence is very specific
|
|
550
|
+
# and does not allow for whitespaces in between.
|
|
551
|
+
#
|
|
552
|
+
# This rule has stricter siblings:
|
|
553
|
+
# * 932331 (PL3)
|
|
554
|
+
#
|
|
555
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx !-\d" \
|
|
556
|
+
"id:932330,\
|
|
557
|
+
phase:2,\
|
|
558
|
+
block,\
|
|
559
|
+
capture,\
|
|
560
|
+
t:none,\
|
|
561
|
+
msg:'Remote Command Execution: Unix shell history invocation',\
|
|
562
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
563
|
+
tag:'application-multi',\
|
|
564
|
+
tag:'language-shell',\
|
|
565
|
+
tag:'platform-unix',\
|
|
566
|
+
tag:'attack-rce',\
|
|
567
|
+
tag:'paranoia-level/1',\
|
|
568
|
+
tag:'OWASP_CRS',\
|
|
569
|
+
tag:'capec/1000/152/248/88',\
|
|
570
|
+
tag:'PCI/6.5.2',\
|
|
571
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
572
|
+
severity:'CRITICAL',\
|
|
573
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
574
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
# [ Unix shell snippets ]
|
|
578
|
+
#
|
|
579
|
+
# Detect some common sequences found in shell commands and scripts.
|
|
580
|
+
#
|
|
581
|
+
# Some commands which were restricted in earlier rules due to FP,
|
|
582
|
+
# have been added here with their full path, in order to catch some
|
|
583
|
+
# cases where the full path is sent.
|
|
584
|
+
#
|
|
585
|
+
# Rule relations:
|
|
586
|
+
#
|
|
587
|
+
# .932160 (base rule, PL1, unix shell commands with full path)
|
|
588
|
+
# ..932161 (stricter sibling, PL2, unix shell commands with full path in User-Agent and Referer request headers)
|
|
589
|
+
#
|
|
590
|
+
# This rule is also triggered by an Apache Struts Remote Code Execution exploit:
|
|
591
|
+
# [ Apache Struts vulnerability CVE-2017-9805 - Exploit tested: https://www.exploit-db.com/exploits/42627 ]
|
|
592
|
+
#
|
|
593
|
+
# This rule is also triggered by an Oracle WebLogic Remote Command Execution exploit:
|
|
594
|
+
# [ Oracle WebLogic vulnerability CVE-2017-10271 - Exploit tested: https://www.exploit-db.com/exploits/43458 ]
|
|
595
|
+
|
|
596
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile unix-shell.data" \
|
|
597
|
+
"id:932160,\
|
|
598
|
+
phase:2,\
|
|
599
|
+
block,\
|
|
600
|
+
capture,\
|
|
601
|
+
t:none,t:cmdLine,t:normalizePath,\
|
|
602
|
+
msg:'Remote Command Execution: Unix Shell Code Found',\
|
|
603
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
604
|
+
tag:'application-multi',\
|
|
605
|
+
tag:'language-shell',\
|
|
606
|
+
tag:'platform-unix',\
|
|
607
|
+
tag:'attack-rce',\
|
|
608
|
+
tag:'paranoia-level/1',\
|
|
609
|
+
tag:'OWASP_CRS',\
|
|
610
|
+
tag:'capec/1000/152/248/88',\
|
|
611
|
+
tag:'PCI/6.5.2',\
|
|
612
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
613
|
+
severity:'CRITICAL',\
|
|
614
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
615
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
# [ Shellshock vulnerability (CVE-2014-6271 and CVE-2014-7169) ]
|
|
619
|
+
#
|
|
620
|
+
# Detect exploitation of "Shellshock" GNU Bash RCE vulnerability.
|
|
621
|
+
#
|
|
622
|
+
# Based on ModSecurity rules created by Red Hat.
|
|
623
|
+
# Permission for use was granted by Martin Prpic <secalert@redhat.com>
|
|
624
|
+
#
|
|
625
|
+
# https://access.redhat.com/articles/1212303
|
|
626
|
+
#
|
|
627
|
+
SecRule REQUEST_HEADERS|REQUEST_LINE "@rx ^\(\s*\)\s+{" \
|
|
628
|
+
"id:932170,\
|
|
629
|
+
phase:1,\
|
|
630
|
+
block,\
|
|
631
|
+
capture,\
|
|
632
|
+
t:none,t:urlDecodeUni,\
|
|
633
|
+
msg:'Remote Command Execution: Shellshock (CVE-2014-6271)',\
|
|
634
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
635
|
+
tag:'application-multi',\
|
|
636
|
+
tag:'language-shell',\
|
|
637
|
+
tag:'platform-unix',\
|
|
638
|
+
tag:'attack-rce',\
|
|
639
|
+
tag:'paranoia-level/1',\
|
|
640
|
+
tag:'OWASP_CRS',\
|
|
641
|
+
tag:'capec/1000/152/248/88',\
|
|
642
|
+
tag:'PCI/6.5.2',\
|
|
643
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
644
|
+
severity:'CRITICAL',\
|
|
645
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
646
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
647
|
+
|
|
648
|
+
SecRule ARGS_NAMES|ARGS|FILES_NAMES "@rx ^\(\s*\)\s+{" \
|
|
649
|
+
"id:932171,\
|
|
650
|
+
phase:2,\
|
|
651
|
+
block,\
|
|
652
|
+
capture,\
|
|
653
|
+
t:none,t:urlDecodeUni,\
|
|
654
|
+
msg:'Remote Command Execution: Shellshock (CVE-2014-6271)',\
|
|
655
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
656
|
+
tag:'application-multi',\
|
|
657
|
+
tag:'language-shell',\
|
|
658
|
+
tag:'platform-unix',\
|
|
659
|
+
tag:'attack-rce',\
|
|
660
|
+
tag:'paranoia-level/1',\
|
|
661
|
+
tag:'OWASP_CRS',\
|
|
662
|
+
tag:'capec/1000/152/248/88',\
|
|
663
|
+
tag:'PCI/6.5.2',\
|
|
664
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
665
|
+
severity:'CRITICAL',\
|
|
666
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
667
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
# [ Unix shell alias detection ]
|
|
671
|
+
#
|
|
672
|
+
# Detects Unix shell alias invocations in any context.
|
|
673
|
+
#
|
|
674
|
+
# Example:
|
|
675
|
+
# GET /?rce=alias%20a=b
|
|
676
|
+
#
|
|
677
|
+
# Shell aliasing can be performed to substitute anything in commands, escaping
|
|
678
|
+
#
|
|
679
|
+
# References: https://pubs.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html#tag_03_10 :
|
|
680
|
+
# "In the shell command language, a word consisting solely of underscores, digits, and alphabetics
|
|
681
|
+
# from the portable character set and any of the following characters: '!', '%', ',', '@'."
|
|
682
|
+
#
|
|
683
|
+
# Implementations may allow other characters within alias names as an extension.
|
|
684
|
+
#
|
|
685
|
+
# Regular expression generated from regex-assembly/932175.ra.
|
|
686
|
+
# To update the regular expression run the following shell script
|
|
687
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
688
|
+
# crs-toolchain regex update 932175
|
|
689
|
+
#
|
|
690
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \ba[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?l[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?i[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?a[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s\b[\s\x0b]+(?:[\+\-][a-z]+\+?[\s\x0b]+)?[!\"%',-\.0-9@-Z_a-z]+=[^\s\x0b]" \
|
|
691
|
+
"id:932175,\
|
|
692
|
+
phase:2,\
|
|
693
|
+
block,\
|
|
694
|
+
capture,\
|
|
695
|
+
t:none,\
|
|
696
|
+
msg:'Remote Command Execution: Unix shell alias invocation',\
|
|
697
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
698
|
+
tag:'application-multi',\
|
|
699
|
+
tag:'language-shell',\
|
|
700
|
+
tag:'platform-unix',\
|
|
701
|
+
tag:'attack-rce',\
|
|
702
|
+
tag:'paranoia-level/1',\
|
|
703
|
+
tag:'OWASP_CRS',\
|
|
704
|
+
tag:'capec/1000/152/248/88',\
|
|
705
|
+
tag:'PCI/6.5.2',\
|
|
706
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
707
|
+
severity:'CRITICAL',\
|
|
708
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
709
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
#
|
|
713
|
+
# -=[ Restricted File Upload ]=-
|
|
714
|
+
#
|
|
715
|
+
# Detects attempts to upload a file with a forbidden filename.
|
|
716
|
+
#
|
|
717
|
+
# Many application contain Unrestricted File Upload vulnerabilities.
|
|
718
|
+
# https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload
|
|
719
|
+
#
|
|
720
|
+
# These might be abused to upload configuration files or other files
|
|
721
|
+
# that affect the behavior of the web server, possibly causing remote
|
|
722
|
+
# code execution.
|
|
723
|
+
#
|
|
724
|
+
SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name "@pmFromFile restricted-upload.data" \
|
|
725
|
+
"id:932180,\
|
|
726
|
+
phase:2,\
|
|
727
|
+
block,\
|
|
728
|
+
capture,\
|
|
729
|
+
t:none,\
|
|
730
|
+
msg:'Restricted File Upload Attempt',\
|
|
731
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
732
|
+
tag:'application-multi',\
|
|
733
|
+
tag:'language-multi',\
|
|
734
|
+
tag:'platform-multi',\
|
|
735
|
+
tag:'attack-rce',\
|
|
736
|
+
tag:'paranoia-level/1',\
|
|
737
|
+
tag:'OWASP_CRS',\
|
|
738
|
+
tag:'capec/1000/152/248/88',\
|
|
739
|
+
tag:'PCI/6.5.2',\
|
|
740
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
741
|
+
severity:'CRITICAL',\
|
|
742
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
743
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
# [ Windows command injection ]
|
|
747
|
+
#
|
|
748
|
+
# This rule detects Windows shell command injections.
|
|
749
|
+
# If you are not running Windows, it is safe to disable this rule.
|
|
750
|
+
#
|
|
751
|
+
# New in CRSv4: The rules 932110 and 932115 were reorganized and renumbered to 932370 and 932380.
|
|
752
|
+
# The new rules target specific Windows binaries to simplify future updates of the command list.
|
|
753
|
+
#
|
|
754
|
+
# A command injection takes a form such as:
|
|
755
|
+
#
|
|
756
|
+
# foo.jpg&ver /r
|
|
757
|
+
# foo.jpg|ver /r
|
|
758
|
+
#
|
|
759
|
+
# The vulnerability exists when an application executes a shell command
|
|
760
|
+
# without proper input escaping/validation.
|
|
761
|
+
#
|
|
762
|
+
# To prevent false positives, we look for a 'starting sequence' that
|
|
763
|
+
# precedes a command in CMD syntax, such as: ; | & `
|
|
764
|
+
#
|
|
765
|
+
# Anatomy of the regexp:
|
|
766
|
+
#
|
|
767
|
+
# 1. Starting tokens
|
|
768
|
+
#
|
|
769
|
+
# ; ;cmd
|
|
770
|
+
# \{ {cmd
|
|
771
|
+
# \| |cmd
|
|
772
|
+
# \|\| ||cmd
|
|
773
|
+
# & &cmd
|
|
774
|
+
# && &&cmd
|
|
775
|
+
# \n \ncmd
|
|
776
|
+
# \r \rcmd
|
|
777
|
+
# ` `cmd
|
|
778
|
+
#
|
|
779
|
+
# 2. Command prefixes
|
|
780
|
+
#
|
|
781
|
+
# ( (cmd)
|
|
782
|
+
# , ,cmd
|
|
783
|
+
# @ @cmd
|
|
784
|
+
# ' 'cmd'
|
|
785
|
+
# " "cmd"
|
|
786
|
+
# \s spacing+cmd
|
|
787
|
+
#
|
|
788
|
+
# 3. Paths
|
|
789
|
+
#
|
|
790
|
+
# [\w'\"\./]+/ /path/cmd
|
|
791
|
+
# [\x5c'\"\^]*\w[\x5c'\"\^]*:.*\x5c C:\Program Files\cmd
|
|
792
|
+
# [\^\.\w '\"/\x5c]*\x5c)?[\"\^]* \\net\share\dir\cmd
|
|
793
|
+
#
|
|
794
|
+
# 4. Quoting
|
|
795
|
+
#
|
|
796
|
+
# \" "cmd"
|
|
797
|
+
# \^ ^cmd
|
|
798
|
+
#
|
|
799
|
+
# 5. Extension/switches
|
|
800
|
+
#
|
|
801
|
+
# \.[\"\^]*\w+ cmd.com, cmd.exe, etc.
|
|
802
|
+
# /b cmd/h
|
|
803
|
+
#
|
|
804
|
+
# An effort is made to combat evasions by CMD syntax; for example,
|
|
805
|
+
# the following strings are valid: c^md, @cmd, "c"md. ModSecurity
|
|
806
|
+
# has a t:cmdLine transformation built-in to deal with some of these,
|
|
807
|
+
# but unfortunately, that transformation replaces ';' characters (so
|
|
808
|
+
# we cannot match on the start of a command) and '\' characters (so we
|
|
809
|
+
# have trouble matching paths). This makes the regexp more complex.
|
|
810
|
+
#
|
|
811
|
+
# This rule is case-insensitive.
|
|
812
|
+
#
|
|
813
|
+
# Regular expression generated from regex-assembly/932370.ra.
|
|
814
|
+
# To update the regular expression run the following shell script
|
|
815
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
816
|
+
# crs-toolchain reg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*u[\"\^]*g[\"\^]*g)[\"\^]*e[\"\^]*r)|w[\"\^]*(?:a[\"\^]*b|(?:f|m[\"\^]*i)[\"\^]*c|i[\"\^]*n[\"\^]*(?:g[\"\^]*e[\"\^]*t|r[\"\^]*m|w[\"\^]*o[\"\^]*r[\"\^]*d)|l[\"\^]*r[\"\^]*m[\"\^]*d[\"\^]*r|o[\"\^]*r[\"\^]*k[\"\^]*f[\"\^]*o[\"\^]*l[\"\^]*d[\"\^]*e[\"\^]*r[\"\^]*s|s[\"\^]*(?:(?:c[\"\^]*r[\"\^]*i[\"\^]*p|r[\"\^]*e[\"\^]*s[\"\^]*e)[\"\^]*t|l)|t[\"\^]*[\s\x0b,\./;<>].*|u[\"\^]*a[\"\^]*u[\"\^]*c[\"\^]*l[\"\^]*t)|x[\"\^]*w[\"\^]*i[\"\^]*z[\"\^]*a[\"\^]*r[\"\^]*d|z[\"\^]*i[\"\^]*p[\"\^]*f[\"\^]*l[\"\^]*d[\"\^]*r)(?:\.[\"\^]*[0-9A-Z_a-z]+)?\b" \
|
|
819
|
+
"id:932370,\
|
|
820
|
+
phase:2,\
|
|
821
|
+
block,\
|
|
822
|
+
capture,\
|
|
823
|
+
t:none,\
|
|
824
|
+
msg:'Remote Command Execution: Windows Command Injection',\
|
|
825
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
826
|
+
tag:'application-multi',\
|
|
827
|
+
tag:'language-shell',\
|
|
828
|
+
tag:'platform-windows',\
|
|
829
|
+
tag:'attack-rce',\
|
|
830
|
+
tag:'paranoia-level/1',\
|
|
831
|
+
tag:'OWASP_CRS',\
|
|
832
|
+
tag:'capec/1000/152/248/88',\
|
|
833
|
+
tag:'PCI/6.5.2',\
|
|
834
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
835
|
+
severity:'CRITICAL',\
|
|
836
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
837
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
838
|
+
|
|
839
|
+
#
|
|
840
|
+
# This rule detects Windows shell command injections.
|
|
841
|
+
# If you are not running Windows, it is safe to disable this rule.
|
|
842
|
+
#
|
|
843
|
+
# New in CRSv4: The rules 932110 and 932115 were reorganized and renumbered to 932370 and 932380.
|
|
844
|
+
# The new rules target specific Windows binaries to simplify future updates of the command list.
|
|
845
|
+
#
|
|
846
|
+
# See rule 932370 above for further explanation.
|
|
847
|
+
#
|
|
848
|
+
# This rule is case-insensitive.
|
|
849
|
+
#
|
|
850
|
+
# Regular expression generated from regex-assembly/932380.ra.
|
|
851
|
+
# To update the regular expression run the following shell script
|
|
852
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
853
|
+
# crs-toolchain regex update 932380
|
|
854
|
+
#
|
|
855
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:[\n\r;`\{]|\|\|?|&&?)[\s\x0b]*[\s\x0b\"'\(,@]*(?:[\"'\.-9A-Z_a-z]+/|(?:[\"'\x5c\^]*[0-9A-Z_a-z][\"'\x5c\^]*:.*|[ \"'\.-9A-Z\x5c\^_a-z]*)\x5c)?[\"\^]*(?:a[\"\^]*(?:s[\"\^]*s[\"\^]*o[\"\^]*c|t[\"\^]*(?:m[\"\^]*a[\"\^]*d[\"\^]*m|t[\"\^]*r[\"\^]*i[\"\^]*b)|u[\"\^]*(?:d[\"\^]*i[\"\^]*t[\"\^]*p[\"\^]*o[\"\^]*l|t[\"\^]*o[\"\^]*(?:c[\"\^]*(?:h[\"\^]*k|o[\"\^]*n[\"\^]*v)|(?:f[\"\^]*m|m[\"\^]*o[\"\^]*u[\"\^]*n)[\"\^]*t)))|b[\"\^]*(?:c[\"\^]*d[\"\^]*(?:b[\"\^]*o[\"\^]*o|e[\"\^]*d[\"\^]*i)[\"\^]*t|(?:d[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i[\"\^]*c|s[\"\^]*c[\"\^]*r[\"\^]*i[\"\^]*p[\"\^]*t)|x[\"\^]*c[\"\^]*o[\"\^]*p[\"\^]*y)(?:\.[\"\^]*[0-9A-Z_a-z]+)?\b" \
|
|
856
|
+
"id:932380,\
|
|
857
|
+
phase:2,\
|
|
858
|
+
block,\
|
|
859
|
+
capture,\
|
|
860
|
+
t:none,\
|
|
861
|
+
msg:'Remote Command Execution: Windows Command Injection',\
|
|
862
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
863
|
+
tag:'application-multi',\
|
|
864
|
+
tag:'language-shell',\
|
|
865
|
+
tag:'platform-windows',\
|
|
866
|
+
tag:'attack-rce',\
|
|
867
|
+
tag:'paranoia-level/1',\
|
|
868
|
+
tag:'OWASP_CRS',\
|
|
869
|
+
tag:'capec/1000/152/248/88',\
|
|
870
|
+
tag:'PCI/6.5.2',\
|
|
871
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
872
|
+
severity:'CRITICAL',\
|
|
873
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
874
|
+
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:932013,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
878
|
+
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:932014,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
879
|
+
#
|
|
880
|
+
# -= Paranoia Level 2 =- (apply only when tx.detection_paranoia_level is sufficiently high: 2 or higher)
|
|
881
|
+
#
|
|
882
|
+
|
|
883
|
+
# [ Unix command injection ]
|
|
884
|
+
#
|
|
885
|
+
# This rule targets pefix + the source command (dot character) at PL2.
|
|
886
|
+
#
|
|
887
|
+
# Rule relations:
|
|
888
|
+
#
|
|
889
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
890
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
891
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
892
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
893
|
+
#
|
|
894
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
895
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
896
|
+
#
|
|
897
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
898
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
899
|
+
# - with and without prefix
|
|
900
|
+
# - words of any length)
|
|
901
|
+
# ..932239 (sibling of 932236, PL2,
|
|
902
|
+
# - with and without prefix
|
|
903
|
+
# - words of any length
|
|
904
|
+
# - targets request headers user-agent and referer only
|
|
905
|
+
# - excluded words: known user-agents)
|
|
906
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
907
|
+
# - no excluded words)
|
|
908
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
909
|
+
# - targets request headers user-agent and referer only
|
|
910
|
+
# - without prefix
|
|
911
|
+
# - with word boundaries
|
|
912
|
+
# - words of any length
|
|
913
|
+
# - excluded words: known user-agents)
|
|
914
|
+
#
|
|
915
|
+
#
|
|
916
|
+
# Regular expression generated from regex-assembly/932231.ra.
|
|
917
|
+
# To update the regular expression run the following shell script
|
|
918
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
919
|
+
# crs-toolchain regex update 932231
|
|
920
|
+
#
|
|
921
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/*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-0-9\?@_a-\{]*)?\x5c?e(?:[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?t)?|w[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?a[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?t[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?h|[\n\r;=`\{]|\|\|?|&&?|\$(?:\(\(?|[\[\{])|<(?:\(|<<)|>\(|\([\s\x0b]*\))[\s\x0b]*(?:[\$\{]|(?:[\s\x0b]*\(|!)[\s\x0b]*|[0-9A-Z_a-z]+=(?:[^\s\x0b]*|\$(?:.*|.*)|[<>].*|'.*'|\".*\")[\s\x0b]+)*[\s\x0b]*[\"']*(?:[\"'-\+\--9\?A-\]_a-z\|]+/)?[\"'\x5c]*\.[\s\x0b].*\b" \
|
|
922
|
+
"id:932231,\
|
|
923
|
+
phase:2,\
|
|
924
|
+
block,\
|
|
925
|
+
capture,\
|
|
926
|
+
t:none,\
|
|
927
|
+
msg:'Remote Command Execution: Unix Command Injection',\
|
|
928
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
929
|
+
tag:'application-multi',\
|
|
930
|
+
tag:'language-shell',\
|
|
931
|
+
tag:'platform-unix',\
|
|
932
|
+
tag:'attack-rce',\
|
|
933
|
+
tag:'paranoia-level/2',\
|
|
934
|
+
tag:'OWASP_CRS',\
|
|
935
|
+
tag:'capec/1000/152/248/88',\
|
|
936
|
+
tag:'PCI/6.5.2',\
|
|
937
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
938
|
+
severity:'CRITICAL',\
|
|
939
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
940
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
941
|
+
|
|
942
|
+
# This is a stricter sibling of rule 932130.
|
|
943
|
+
#
|
|
944
|
+
# It applies the same regular expression to the
|
|
945
|
+
# User-Agent and Referer HTTP headers.
|
|
946
|
+
#
|
|
947
|
+
# Unlike the sibling rule, this rule runs in phase 1.
|
|
948
|
+
#
|
|
949
|
+
# Regular expression generated from regex-assembly/932131.ra.
|
|
950
|
+
# To update the regular expression run the following shell script
|
|
951
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
952
|
+
# crs-toolchain regex update 932131
|
|
953
|
+
#
|
|
954
|
+
SecRule REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer "@rx \$(?:\((?:.*|\(.*\))\)|\{.*\}|\[.*\])|[<>]\(.*\)|/[0-9A-Z_a-z]*\[!?.+\]" \
|
|
955
|
+
"id:932131,\
|
|
956
|
+
phase:1,\
|
|
957
|
+
block,\
|
|
958
|
+
capture,\
|
|
959
|
+
t:none,t:cmdLine,\
|
|
960
|
+
msg:'Remote Command Execution: Unix Shell Expression Found',\
|
|
961
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
962
|
+
tag:'application-multi',\
|
|
963
|
+
tag:'language-shell',\
|
|
964
|
+
tag:'platform-unix',\
|
|
965
|
+
tag:'attack-rce',\
|
|
966
|
+
tag:'paranoia-level/2',\
|
|
967
|
+
tag:'OWASP_CRS',\
|
|
968
|
+
tag:'capec/1000/152/248/88',\
|
|
969
|
+
tag:'PCI/6.5.2',\
|
|
970
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
971
|
+
severity:'CRITICAL',\
|
|
972
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
973
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
974
|
+
|
|
975
|
+
#
|
|
976
|
+
# -=[ Rule 932200 ]=-
|
|
977
|
+
#
|
|
978
|
+
# Block RCE Bypass using different techniques:
|
|
979
|
+
# - uninitialized variables (https://www.secjuice.com/web-application-firewall-waf-evasion/)
|
|
980
|
+
# - string concatenations (https://medium.com/secjuice/web-application-firewall-waf-evasion-techniques-2-125995f3e7b0)
|
|
981
|
+
# - globbing patterns (https://medium.com/secjuice/waf-evasion-techniques-718026d693d8)
|
|
982
|
+
#
|
|
983
|
+
# Examples:
|
|
984
|
+
# - foo;cat$u+/etc$u/passwd
|
|
985
|
+
# - bar;cd+/etc;/bin$u/ca*+passwd
|
|
986
|
+
# - foo;ca\t+/et\c/pa\s\swd
|
|
987
|
+
# - foo;c'at'+/etc/pa's'swd
|
|
988
|
+
# - foo;c$@at+/et$@c/pas$@swd
|
|
989
|
+
# - foo;c$!at+/et$!c/pas$!swd
|
|
990
|
+
# - foo;c$*at+/et$*c/pas$*swd
|
|
991
|
+
# - foo;c$?at+/et$?c/pas$?swd
|
|
992
|
+
# - foo;c$-at+/et$-c/pas$-swd
|
|
993
|
+
# - foo;c$_at+/et$_c/pas$_swd
|
|
994
|
+
# - foo;c$$at+/et$$c/pas$$swd
|
|
995
|
+
#
|
|
996
|
+
# Regex notes: https://regex101.com/r/V6wrCO/1
|
|
997
|
+
#
|
|
998
|
+
# Regular expression generated from regex-assembly/932200.ra.
|
|
999
|
+
# To update the regular expression run the following shell script
|
|
1000
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1001
|
+
# crs-toolchain regex update 932200
|
|
1002
|
+
#
|
|
1003
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ['\*\?\x5c`][^\n/]+/|/[^/]+?['\*\?\x5c`]|\$[!#\$\(\*\-0-9\?-\[_a-\{]" \
|
|
1004
|
+
"id:932200,\
|
|
1005
|
+
phase:2,\
|
|
1006
|
+
block,\
|
|
1007
|
+
capture,\
|
|
1008
|
+
t:none,t:lowercase,t:urlDecodeUni,\
|
|
1009
|
+
msg:'RCE Bypass Technique',\
|
|
1010
|
+
logdata:'Matched Data: %{TX.0} found within %{TX.932200_MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1011
|
+
tag:'application-multi',\
|
|
1012
|
+
tag:'language-multi',\
|
|
1013
|
+
tag:'platform-multi',\
|
|
1014
|
+
tag:'attack-rce',\
|
|
1015
|
+
tag:'paranoia-level/2',\
|
|
1016
|
+
tag:'OWASP_CRS',\
|
|
1017
|
+
tag:'capec/1000/152/248/88',\
|
|
1018
|
+
tag:'PCI/6.5.2',\
|
|
1019
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1020
|
+
severity:'CRITICAL',\
|
|
1021
|
+
setvar:'tx.932200_matched_var_name=%{matched_var_name}',\
|
|
1022
|
+
chain"
|
|
1023
|
+
SecRule MATCHED_VAR "@rx /" \
|
|
1024
|
+
"t:none,\
|
|
1025
|
+
chain"
|
|
1026
|
+
SecRule MATCHED_VAR "@rx \s" \
|
|
1027
|
+
"t:none,\
|
|
1028
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1029
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1030
|
+
|
|
1031
|
+
#
|
|
1032
|
+
# -=[ Rule 932205 ]=-
|
|
1033
|
+
#
|
|
1034
|
+
# Sibling of 932200 targeting the Referer header. URLs cause false positives in rule 932200
|
|
1035
|
+
# and must be handled with additional checks.
|
|
1036
|
+
#
|
|
1037
|
+
# The last chain prevents FPs against the "Scroll to text fragment" browser feature
|
|
1038
|
+
# (https://wicg.github.io/scroll-to-text-fragment/).
|
|
1039
|
+
#
|
|
1040
|
+
# Regular expression generated from regex-assembly/932205.ra.
|
|
1041
|
+
# To update the regular expression run the following shell script
|
|
1042
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1043
|
+
# crs-toolchain regex update 932205
|
|
1044
|
+
#
|
|
1045
|
+
SecRule REQUEST_HEADERS:Referer "@rx ^[^#]+" \
|
|
1046
|
+
"id:932205,\
|
|
1047
|
+
phase:1,\
|
|
1048
|
+
block,\
|
|
1049
|
+
capture,\
|
|
1050
|
+
t:none,t:lowercase,t:urlDecodeUni,\
|
|
1051
|
+
msg:'RCE Bypass Technique',\
|
|
1052
|
+
logdata:'Matched Data: %{TX.2} found within %{TX.932205_MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1053
|
+
tag:'application-multi',\
|
|
1054
|
+
tag:'language-multi',\
|
|
1055
|
+
tag:'platform-multi',\
|
|
1056
|
+
tag:'attack-rce',\
|
|
1057
|
+
tag:'paranoia-level/2',\
|
|
1058
|
+
tag:'OWASP_CRS',\
|
|
1059
|
+
tag:'capec/1000/152/248/88',\
|
|
1060
|
+
tag:'PCI/6.5.2',\
|
|
1061
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1062
|
+
severity:'CRITICAL',\
|
|
1063
|
+
setvar:'tx.932205_matched_var_name=%{matched_var_name}',\
|
|
1064
|
+
chain"
|
|
1065
|
+
SecRule TX:0 "@rx ^[^\.]+\.[^;\?]+[;\?](.*(['\*\?\x5c`][^\n/]+/|/[^/]+?['\*\?\x5c`]|\$[!#\$\(\*\-0-9\?-\[_a-\{]))" \
|
|
1066
|
+
"capture,\
|
|
1067
|
+
t:none,\
|
|
1068
|
+
chain"
|
|
1069
|
+
SecRule TX:1 "@rx /" \
|
|
1070
|
+
"t:none,\
|
|
1071
|
+
chain"
|
|
1072
|
+
SecRule TX:1 "@rx \s" \
|
|
1073
|
+
"t:none,\
|
|
1074
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1075
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1076
|
+
|
|
1077
|
+
#
|
|
1078
|
+
# -=[ Rule 932206 ]=-
|
|
1079
|
+
#
|
|
1080
|
+
# Sibling of 932200 targeting the Referer header. URLs cause false positives in rule 932200
|
|
1081
|
+
# and must be handled with additional checks.
|
|
1082
|
+
#
|
|
1083
|
+
# Regular expression generated from regex-assembly/932206.ra.
|
|
1084
|
+
# To update the regular expression run the following shell script
|
|
1085
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1086
|
+
# crs-toolchain regex update 932206
|
|
1087
|
+
#
|
|
1088
|
+
SecRule REQUEST_HEADERS:Referer "@rx ^[^\.]*?(?:['\*\?\x5c`][^\n/]+/|/[^/]+?['\*\?\x5c`]|\$[!#\$\(\*\-0-9\?-\[_a-\{])" \
|
|
1089
|
+
"id:932206,\
|
|
1090
|
+
phase:1,\
|
|
1091
|
+
block,\
|
|
1092
|
+
capture,\
|
|
1093
|
+
t:none,t:lowercase,t:urlDecodeUni,\
|
|
1094
|
+
msg:'RCE Bypass Technique',\
|
|
1095
|
+
logdata:'Matched Data: %{TX.0} found within %{TX.932206_MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1096
|
+
tag:'application-multi',\
|
|
1097
|
+
tag:'language-multi',\
|
|
1098
|
+
tag:'platform-multi',\
|
|
1099
|
+
tag:'attack-rce',\
|
|
1100
|
+
tag:'paranoia-level/2',\
|
|
1101
|
+
tag:'OWASP_CRS',\
|
|
1102
|
+
tag:'capec/1000/152/248/88',\
|
|
1103
|
+
tag:'PCI/6.5.2',\
|
|
1104
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1105
|
+
severity:'CRITICAL',\
|
|
1106
|
+
setvar:'tx.932206_matched_var_name=%{matched_var_name}',\
|
|
1107
|
+
chain"
|
|
1108
|
+
SecRule MATCHED_VAR "@rx /" \
|
|
1109
|
+
"t:none,\
|
|
1110
|
+
chain"
|
|
1111
|
+
SecRule MATCHED_VAR "@rx \s" \
|
|
1112
|
+
"t:none,\
|
|
1113
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1114
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1115
|
+
|
|
1116
|
+
# Regular expression generated from regex-assembly/932220.ra.
|
|
1117
|
+
# To update the regular expression run the following shell script
|
|
1118
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1119
|
+
# crs-toolchain regex update 932220
|
|
1120
|
+
#
|
|
1121
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i).\|(?:[\s\x0b]*|b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?y[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?x|c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\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,\
|
|
1125
|
+
capture,\
|
|
1126
|
+
t:none,\
|
|
1127
|
+
msg:'Remote Command Execution: Unix Command Injection with pipe',\
|
|
1128
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1129
|
+
tag:'application-multi',\
|
|
1130
|
+
tag:'language-shell',\
|
|
1131
|
+
tag:'platform-unix',\
|
|
1132
|
+
tag:'attack-rce',\
|
|
1133
|
+
tag:'paranoia-level/2',\
|
|
1134
|
+
tag:'OWASP_CRS',\
|
|
1135
|
+
tag:'capec/1000/152/248/88',\
|
|
1136
|
+
tag:'PCI/6.5.2',\
|
|
1137
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1138
|
+
severity:'CRITICAL',\
|
|
1139
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1140
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1141
|
+
|
|
1142
|
+
# -=[ Rule 932240 ]=-
|
|
1143
|
+
#
|
|
1144
|
+
# Generic RCE Bypass blocking using different techniques: see https://github.com/coreruleset/coreruleset/issues/2632
|
|
1145
|
+
#
|
|
1146
|
+
# This rule complements rule 932230 with generic evasion detection.
|
|
1147
|
+
# Anything that uses a well-known evasion technique should be blocked at this level.
|
|
1148
|
+
# The chained rule will exclude false positives due to german thousands separators (e.g., 10'000).
|
|
1149
|
+
#
|
|
1150
|
+
# Rule relations:
|
|
1151
|
+
#
|
|
1152
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
1153
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
1154
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
1155
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
1156
|
+
#
|
|
1157
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
1158
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
1159
|
+
#
|
|
1160
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
1161
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
1162
|
+
# - with and without prefix
|
|
1163
|
+
# - words of any length)
|
|
1164
|
+
# ..932239 (sibling of 932236, PL2,
|
|
1165
|
+
# - with and without prefix
|
|
1166
|
+
# - words of any length
|
|
1167
|
+
# - targets request headers user-agent and referer only
|
|
1168
|
+
# - excluded words: known user-agents)
|
|
1169
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
1170
|
+
# - no excluded words)
|
|
1171
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
1172
|
+
# - targets request headers user-agent and referer only
|
|
1173
|
+
# - without prefix
|
|
1174
|
+
# - with word boundaries
|
|
1175
|
+
# - words of any length
|
|
1176
|
+
# - excluded words: known user-agents)
|
|
1177
|
+
#
|
|
1178
|
+
#
|
|
1179
|
+
# Regular expression generated from regex-assembly/932240.ra.
|
|
1180
|
+
# To update the regular expression run the following shell script
|
|
1181
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1182
|
+
# crs-toolchain regex update 932240
|
|
1183
|
+
#
|
|
1184
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS|XML:/* "@rx (?i)[\-0-9_a-z]+(?:[\s\x0b]*[\"'][^\s\x0b\"']+[\"']|(?:[\"'][\"']+|[\[-\]]+|\$+[!#\*\-0-9\?@\x5c_a-\{]+|``|[\$<>]\(\))[\s\x0b]*)[\-0-9_a-z]+" \
|
|
1185
|
+
"id:932240,\
|
|
1186
|
+
phase:2,\
|
|
1187
|
+
block,\
|
|
1188
|
+
capture,\
|
|
1189
|
+
t:none,\
|
|
1190
|
+
msg:'Remote Command Execution: Unix Command Injection evasion attempt detected',\
|
|
1191
|
+
logdata:'Matched Data: %{TX.0} found within %{TX.932240_MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1192
|
+
tag:'application-multi',\
|
|
1193
|
+
tag:'language-shell',\
|
|
1194
|
+
tag:'platform-unix',\
|
|
1195
|
+
tag:'attack-rce',\
|
|
1196
|
+
tag:'paranoia-level/2',\
|
|
1197
|
+
tag:'OWASP_CRS',\
|
|
1198
|
+
tag:'capec/1000/152/248/88',\
|
|
1199
|
+
tag:'PCI/6.5.2',\
|
|
1200
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1201
|
+
severity:'CRITICAL',\
|
|
1202
|
+
setvar:'tx.932240_matched_var_name=%{matched_var_name}',\
|
|
1203
|
+
chain"
|
|
1204
|
+
SecRule MATCHED_VAR "!@rx [0-9]\s*\'\s*[0-9]" \
|
|
1205
|
+
"t:none,\
|
|
1206
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1207
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
# [ Sqlite System Command Execution ]
|
|
1213
|
+
#
|
|
1214
|
+
# This rule prevents execution of SQLite CLI commands like .system and .shell
|
|
1215
|
+
#
|
|
1216
|
+
# You can find a vulnerable script and a sample payload here:
|
|
1217
|
+
# https://github.com/qxxxb/ctf/tree/master/2021/zer0pts_ctf/baby_sqli
|
|
1218
|
+
#
|
|
1219
|
+
# List of sqlite3 CLI commands:
|
|
1220
|
+
# https://sqlite.org/cli.html
|
|
1221
|
+
#
|
|
1222
|
+
# Regular expression generated from regex-assembly/932210.ra.
|
|
1223
|
+
# To update the regular expression run the following shell script
|
|
1224
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1225
|
+
# crs-toolchain regex update 932210
|
|
1226
|
+
#
|
|
1227
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ;[\s\x0b]*\.[\s\x0b]*[\"']?(?:a(?:rchive|uth)|b(?:a(?:ckup|il)|inary)|c(?:d|h(?:anges|eck)|lone|onnection)|d(?:atabases|b(?:config|info)|ump)|e(?:cho|qp|x(?:cel|it|p(?:ert|lain)))|f(?:ilectrl|ullschema)|he(?:aders|lp)|i(?:mpo(?:rt|ster)|ndexes|otrace)|l(?:i(?:mi|n)t|o(?:ad|g))|(?:mod|n(?:onc|ullvalu)|unmodul)e|o(?:nce|pen|utput)|p(?:arameter|r(?:int|o(?:gress|mpt)))|quit|re(?:ad|cover|store)|s(?:ave|c(?:anstats|hema)|e(?:lftest|parator|ssion)|h(?:a3sum|ell|ow)?|tats|ystem)|t(?:ables|estc(?:ase|trl)|ime(?:out|r)|race)|vfs(?:info|list|name)|width)" \
|
|
1228
|
+
"id:932210,\
|
|
1229
|
+
phase:2,\
|
|
1230
|
+
block,\
|
|
1231
|
+
t:none,t:escapeSeqDecode,t:compressWhitespace,\
|
|
1232
|
+
msg:'Remote Command Execution: SQLite System Command Execution',\
|
|
1233
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1234
|
+
tag:'application-multi',\
|
|
1235
|
+
tag:'language-shell',\
|
|
1236
|
+
tag:'platform-unix',\
|
|
1237
|
+
tag:'attack-rce',\
|
|
1238
|
+
tag:'paranoia-level/2',\
|
|
1239
|
+
tag:'OWASP_CRS',\
|
|
1240
|
+
tag:'capec/1000/152/248/88',\
|
|
1241
|
+
tag:'PCI/6.5.2',\
|
|
1242
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1243
|
+
severity:'CRITICAL',\
|
|
1244
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1245
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1246
|
+
|
|
1247
|
+
# -=[ SMTP/IMAP/POP3 Command Execution ]=-
|
|
1248
|
+
#
|
|
1249
|
+
# Rationale
|
|
1250
|
+
# =========
|
|
1251
|
+
#
|
|
1252
|
+
# The rules for email command execution are based on the RFCs for each protocol.
|
|
1253
|
+
# Some of the commands have optional and/or additional parameters, so we tried to be
|
|
1254
|
+
# precise to avoid as many FP in PL2 rules.
|
|
1255
|
+
# For those commands that resemble common English words, and may pose a higher risk of false positives,
|
|
1256
|
+
# they have been split off to a sibling rule in PL3.
|
|
1257
|
+
|
|
1258
|
+
# =[ SMTP Command Execution ]=
|
|
1259
|
+
#
|
|
1260
|
+
# This rule prevents execution of SMTP related system commands.
|
|
1261
|
+
#
|
|
1262
|
+
# List of SMTP commands: from rfc 5321 (https://www.rfc-editor.org/rfc/rfc5321)
|
|
1263
|
+
#
|
|
1264
|
+
# Regular expression generated from regex-assembly/932300.ra.
|
|
1265
|
+
# To update the regular expression run the following shell script
|
|
1266
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1267
|
+
# crs-toolchain regex update 932300
|
|
1268
|
+
#
|
|
1269
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \r\n.*?\b(?:E(?:HLO [\-\.A-Za-z\x17f\x212a]{1,255}|XPN .{1,64})|HELO [\-\.A-Za-z\x17f\x212a]{1,255}|MAIL FROM:<.{1,64}@.{1,255}>|R(?:CPT TO:(?:<.{1,64}@.{1,255}>| )?<.{1,64}>|SET\b)|VRFY .{1,64}(?: <.{1,64}@.{1,255}>|@.{1,255})|AUTH [\-0-9A-Z_a-z\x17f\x212a]{1,20} (?:(?:[\+/-9A-Z_a-z\x17f\x212a]{4})*(?:[\+/-9A-Z_a-z\x17f\x212a]{2}=|[\+/-9A-Z_a-z\x17f\x212a]{3}))?=|STARTTLS\b|NOOP\b(?: .{1,255})?)" \
|
|
1270
|
+
"id:932300,\
|
|
1271
|
+
phase:2,\
|
|
1272
|
+
block,\
|
|
1273
|
+
capture,\
|
|
1274
|
+
t:none,t:escapeSeqDecode,\
|
|
1275
|
+
msg:'Remote Command Execution: SMTP Command Execution',\
|
|
1276
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1277
|
+
tag:'application-multi',\
|
|
1278
|
+
tag:'platform-multi',\
|
|
1279
|
+
tag:'attack-rce',\
|
|
1280
|
+
tag:'paranoia-level/2',\
|
|
1281
|
+
tag:'OWASP_CRS',\
|
|
1282
|
+
tag:'capec/137/134',\
|
|
1283
|
+
tag:'PCI/6.5.2',\
|
|
1284
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1285
|
+
severity:'CRITICAL',\
|
|
1286
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1287
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1288
|
+
|
|
1289
|
+
# =[ IMAP Command Execution ]=
|
|
1290
|
+
#
|
|
1291
|
+
# This rule prevents execution of IMAP4 related system commands.
|
|
1292
|
+
#
|
|
1293
|
+
# List of IMAP4 commands: from rfc 3501 (https://datatracker.ietf.org/doc/html/rfc3501#section-9)
|
|
1294
|
+
#
|
|
1295
|
+
# Note: Mailbox International Naming Convention uses UTF-7, so it was left out explicitly.
|
|
1296
|
+
#
|
|
1297
|
+
# Regular expression generated from regex-assembly/932310.ra.
|
|
1298
|
+
# To update the regular expression run the following shell script
|
|
1299
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1300
|
+
# crs-toolchain regex update 932310
|
|
1301
|
+
#
|
|
1302
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?is)\r\n[0-9A-Z_a-z]{1,50}\b (?:A(?:PPEND (?:[\"#%&\*\--9A-Z\x5c_a-z]+)?(?: \([ \x5ca-z]+\))?(?: \"?[0-9]{1,2}-[0-9A-Z_a-z]{3}-[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} [\+\-][0-9]{4}\"?)? \{[0-9]{1,20}\+?\}|UTHENTICATE [\-0-9_a-z]{1,20}\r\n)|L(?:SUB (?:[\"#\*\.-9A-Z_a-z~]+)? (?:[\"%&\*\.-9A-Z\x5c_a-z]+)?|ISTRIGHTS (?:[\"%&\*\--9A-Z\x5c_a-z]+)?)|S(?:TATUS (?:[\"%&\*\--9A-Z\x5c_a-z]+)? \((?:U(?:NSEEN|IDNEXT)|MESSAGES|UIDVALIDITY|RECENT| )+\)|ETACL (?:[\"%&\*\--9A-Z\x5c_a-z]+)? [\+\-][ac-eiklpr-twx]+?)|UID (?:COPY|FETCH|STORE) (?:[\*,0-:]+)?|(?:(?:DELETE|GET)ACL|MYRIGHTS) (?:[\"%&\*\--9A-Z\x5c_a-z]+)?)" \
|
|
1303
|
+
"id:932310,\
|
|
1304
|
+
phase:2,\
|
|
1305
|
+
block,\
|
|
1306
|
+
t:none,t:escapeSeqDecode,\
|
|
1307
|
+
msg:'Remote Command Execution: IMAP Command Execution',\
|
|
1308
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1309
|
+
tag:'application-multi',\
|
|
1310
|
+
tag:'platform-multi',\
|
|
1311
|
+
tag:'attack-rce',\
|
|
1312
|
+
tag:'paranoia-level/2',\
|
|
1313
|
+
tag:'OWASP_CRS',\
|
|
1314
|
+
tag:'capec/137/134',\
|
|
1315
|
+
tag:'PCI/6.5.2',\
|
|
1316
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1317
|
+
severity:'CRITICAL',\
|
|
1318
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1319
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1320
|
+
|
|
1321
|
+
# =[ POP3 Command Execution ]=
|
|
1322
|
+
#
|
|
1323
|
+
# This rule prevents execution of POP3 related system commands.
|
|
1324
|
+
#
|
|
1325
|
+
# List of POP3 commands:
|
|
1326
|
+
# - from rfc 1939 (https://www.rfc-editor.org/rfc/rfc1939#appendix-B)
|
|
1327
|
+
# - extensions from rfc 2449 (https://www.rfc-editor.org/rfc/rfc2449)
|
|
1328
|
+
#
|
|
1329
|
+
# These commands all have some kind of parameter that makes them a good PL2 target.
|
|
1330
|
+
#
|
|
1331
|
+
# Regular expression generated from regex-assembly/932320.ra.
|
|
1332
|
+
# To update the regular expression run the following shell script
|
|
1333
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1334
|
+
# crs-toolchain regex update 932320
|
|
1335
|
+
#
|
|
1336
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?is)\r\n.*?\b(?:(?:LIST|TOP [0-9]+)(?: [0-9]+)?|U(?:SER .+?|IDL(?: [0-9]+)?)|PASS .+?|(?:RETR|DELE) [0-9]+?|A(?:POP [0-9A-Z_a-z]+ [0-9a-f]{32}|UTH [\-0-9_a-z]{1,20} (?:(?:[\+/-9A-Z_a-z]{4})*(?:[\+/-9A-Z_a-z]{2}=|[\+/-9A-Z_a-z]{3}))?=))" \
|
|
1337
|
+
"id:932320,\
|
|
1338
|
+
phase:2,\
|
|
1339
|
+
block,\
|
|
1340
|
+
t:none,t:escapeSeqDecode,\
|
|
1341
|
+
msg:'Remote Command Execution: POP3 Command Execution',\
|
|
1342
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1343
|
+
tag:'application-multi',\
|
|
1344
|
+
tag:'platform-multi',\
|
|
1345
|
+
tag:'attack-rce',\
|
|
1346
|
+
tag:'paranoia-level/2',\
|
|
1347
|
+
tag:'OWASP_CRS',\
|
|
1348
|
+
tag:'capec/137/134',\
|
|
1349
|
+
tag:'PCI/6.5.2',\
|
|
1350
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1351
|
+
severity:'CRITICAL',\
|
|
1352
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1353
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
# [ Unix command injection ]
|
|
1357
|
+
#
|
|
1358
|
+
# This is a stricter sibling of rules 932230, 932235, 932250, 932260.
|
|
1359
|
+
# This stricter sibling detects Unix RCE with and without prefix and words of any length.
|
|
1360
|
+
# It uses the same regex.
|
|
1361
|
+
#
|
|
1362
|
+
# Rule relations:
|
|
1363
|
+
#
|
|
1364
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
1365
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
1366
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
1367
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
1368
|
+
#
|
|
1369
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
1370
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
1371
|
+
#
|
|
1372
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
1373
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
1374
|
+
# - with and without prefix
|
|
1375
|
+
# - words of any length)
|
|
1376
|
+
# ..932239 (sibling of 932236, PL2,
|
|
1377
|
+
# - with and without prefix
|
|
1378
|
+
# - words of any length
|
|
1379
|
+
# - targets request headers user-agent and referer only
|
|
1380
|
+
# - excluded words: known user-agents)
|
|
1381
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
1382
|
+
# - no excluded words)
|
|
1383
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
1384
|
+
# - targets request headers user-agent and referer only
|
|
1385
|
+
# - without prefix
|
|
1386
|
+
# - with word boundaries
|
|
1387
|
+
# - words of any length
|
|
1388
|
+
# - excluded words: known user-agents)
|
|
1389
|
+
#
|
|
1390
|
+
#
|
|
1391
|
+
# Regular expression generated from regex-assembly/932236.ra.
|
|
1392
|
+
# To update the regular expression run the following shell script
|
|
1393
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1394
|
+
# crs-toolchain regex update 932236
|
|
1395
|
+
#
|
|
1396
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:^|b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?y[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?x|c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?a[\"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-\+\--9\?A-\]_a-z\|]+/)?[\"'\x5c]*(?:7z[arx]?|(?:(?:GE|POS)T|HEAD)[\s\x0b&\)<>\|]|a(?:(?:b|w[ks]|l(?:ias|pine)|xel)[\s\x0b&\)<>\|]|pt(?:[\s\x0b&\)<>\|]|-get)|r(?:[\s\x0b&\)<>j\|]|(?:p|ch)[\s\x0b&\)<>\|]|ia2c)|s(?:h[\s\x0b&\)<>\|]|cii(?:-xfr|85)|pell)|dd(?:group|user)|getty|nsible|tobm)|b(?:z(?:z[\s\x0b&\)<>\|]|c(?:at|mp)|diff|e(?:grep|xe)|f?grep|ip2(?:recover)?|less|more)|a(?:s(?:e(?:32|64|n(?:ame[\s\x0b&\)<>\|]|c))|h[\s\x0b&\)<>\|])|tch[\s\x0b&\)<>\|])|lkid|pftrace|r(?:eaksw|idge[\s\x0b&\)<>\|])|sd(?:cat|iff|tar)|u(?:iltin|n(?:dler[\s\x0b&\)<>\|]|zip2)|s(?:ctl|ybox))|y(?:ebug|obu))|c(?:[89]9|(?:a(?:t|ncel|psh)|c)[\s\x0b&\)<>\|]|mp|p(?:[\s\x0b&\)<>\|]|an|io|ulimit)|s(?:h|cli[\s\x0b&\)<>\|]|plit|vtool)|u(?:(?:t|rl)[\s\x0b&\)<>\|]|psfilter)|ertbot|h(?:attr|(?:dir|root)[\s\x0b&\)<>\|]|e(?:ck_(?:by_ssh|cups|log|memory|raid|s(?:sl_cert|tatusfile))|f[\s\x0b&\)\-<>\|])|(?:flag|pas)s|g(?:passwd|rp)|mod|o(?:om|wn)|sh)|lang(?:[\s\x0b&\)<>\|]|\+\+)|o(?:(?:b|pro)c|(?:lumn|m(?:m(?:and)?|p(?:oser|ress)))[\s\x0b&\)<>\|]|w(?:say|think))|r(?:ash[\s\x0b&\)<>\|]|on(?:[\s\x0b&\)<>\|]|tab)))|d(?:(?:[du]|i(?:(?:alo)?g|r|ff)|a(?:sh|te))[\s\x0b&\)<>\|]|f|hclient|m(?:esg|idecode|setup)|o(?:as|(?:cker|ne)[\s\x0b&\)<>\|]|sbox)|pkg|vips)|e(?:(?:[bd]|cho)[\s\x0b&\)<>\|]|n(?:v(?:[\s\x0b&\)<>\|]|-update)|d(?:if|sw))|qn|s(?:[\s\x0b&\)<>h\|]|ac)|x(?:(?:ec)?[\s\x0b&\)<>\|]|iftool|p(?:(?:and|(?:ec|or)t)[\s\x0b&\)<>\|]|r))|2fsck|(?:asy_instal|va)l|fax|grep|macs)|f(?:(?:c|etch|lock|unction)[\s\x0b&\)<>\|]|d|g(?:rep)?|i(?:(?:n(?:d|ger)|sh)?[\s\x0b&\)<>\|]|le(?:[\s\x0b&\)<>\|]|test))|mt|tp(?:[\s\x0b&\)<>\|]|stats|who)|acter|o(?:ld[\s\x0b&\)<>\|]|reach)|ping)|g(?:c(?:c[^\s\x0b]|ore)|db|e(?:(?:m|tfacl)[\s\x0b&\)<>\|]|ni(?:e[\s\x0b&\)<>\|]|soimage))|hci?|i(?:(?:t|mp)[\s\x0b&\)<>\|]|nsh)|(?:o|awk)[\s\x0b&\)<>\|]|pg|r(?:c|ep[\s\x0b&\)<>\|]|oup(?:[\s\x0b&\)<>\|]|mod))|tester|unzip|z(?:cat|exe|ip))|h(?:(?:d|up|ash|i(?:ghlight|story))[\s\x0b&\)<>\|]|e(?:ad[\s\x0b&\)<>\|]|xdump)|ost(?:id|name)|ping3|t(?:digest|op|passwd))|i(?:d|p(?:6?tables|config)?|rb|conv|f(?:config|top)|nstall[\s\x0b&\)<>\|]|onice|spell)|j(?:js|q|ava[\s\x0b&\)<>\|]|exec|o(?:(?:bs|in)[\s\x0b&\)<>\|]|urnalctl)|runscript)|k(?:s(?:h|shell)|ill(?:[\s\x0b&\)<>\|]|all)|nife[\s\x0b&\)<>\|])|l(?:d(?:d?[\s\x0b&\)<>\|]|config)|(?:[np]|inks|ynx)[\s\x0b&\)<>\|]|s(?:-F|b_release|cpu|hw|mod|of|pci|usb)?|ua(?:[\s\x0b&\)<>\|]|(?:la)?tex)|z(?:[\s\x0b&\)4<>\|]|4c(?:at)?|c(?:at|mp)|diff|[ef]?grep|less|m(?:a(?:dec|info)?|ore))|a(?:st(?:[\s\x0b&\)<>\|]|comm|log(?:in)?)|tex[\s\x0b&\)<>\|])|ess(?:[\s\x0b&\)<>\|]|echo|(?:fil|pip)e)|ftp(?:get)?|o(?:(?:ca(?:l|te)|ok)[\s\x0b&\)<>\|]|g(?:inctl|(?:nam|sav)e)|setup)|trace|wp-(?:d(?:ownload|ump)|mirror|request))|m(?:a(?:(?:n|ke)[\s\x0b&\)<>\|]|il(?:[\s\x0b&\)<>q\|]|x[\s\x0b&\)<>\|])|ster\.passwd|wk)|tr|(?:v|utt)[\s\x0b&\)<>\|]|k(?:dir[\s\x0b&\)<>\|]|fifo|nod|temp)|locate|o(?:squitto|unt[\s\x0b&\)<>\|])|sg(?:attrib|c(?:at|onv)|filter|merge|uniq)|ysql(?:admin|dump(?:slow)?|hotcopy|show)?)|n(?:c(?:[\s\x0b&\)<>\|]|\.(?:openbsd|traditional)|at)|e(?:t(?:[\s\x0b&\)<>\|]|(?:c|st)at|kit-ftp|plan)|ofetch)|(?:(?:ul)?l|ice)[\s\x0b&\)<>\|]|m(?:[\s\x0b&\)<>\|]|ap)|p(?:m[\s\x0b&\)<>\|]|ing)|a(?:no[\s\x0b&\)<>\|]|sm|wk)|o(?:de[\s\x0b&\)<>\|]|hup)|roff|s(?:enter|lookup|tat))|o(?:(?:d|ctave)[\s\x0b&\)<>\|]|nintr|p(?:en(?:ssl|v(?:pn|t))|kg))|p(?:a(?:(?:x|rted|tch)[\s\x0b&\)<>\|]|s(?:swd|te[\s\x0b&\)<>\|]))|d(?:b|f(?:la)?tex|ksh)|f(?:[\s\x0b&\)<>\|]|tp)|g(?:[\s\x0b&\)<>\|]|rep)|hp(?:[\s\x0b&\)57<>\|]|-cgi)|i(?:(?:co?|ng)[\s\x0b&\)<>\|]|p[^\s\x0b]|dstat|gz)|k(?:g(?:_?info)?|exec|ill)|r(?:y?[\s\x0b&\)<>\|]|int(?:env|f[\s\x0b&\)<>\|]))|t(?:x|ar(?:diff|grep)?)|wd(?:\.db)?|xz|er(?:(?:f|ms)[\s\x0b&\)<>\|]|l(?:[\s\x0b&\)5<>\|]|sh))|opd|s(?:ed|ftp|ql)|u(?:ppet[\s\x0b&\)<>\|]|shd)|y(?:thon[^\s\x0b]|3?versions))|r(?:a(?:r[\s\x0b&\)<>\|]|k(?:e[\s\x0b&\)<>\|]|u))|c(?:p[\s\x0b&\)<>\|])?|e(?:(?:d(?:carpet)?|v|name|p(?:eat|lace))[\s\x0b&\)<>\|]|a(?:delf|lpath)|stic)|m(?:(?:dir)?[\s\x0b&\)<>\|]|user)|pm(?:[\s\x0b&\)<>\|]|db|(?:quer|verif)y)|bash|l(?:ogin|wrap)|nano|oute[\s\x0b&\)<>\|]|sync|u(?:by[^\s\x0b]|n-(?:mailcap|parts))|vi(?:ew|m))|s(?:c(?:p|(?:hed|r(?:een|ipt))[\s\x0b&\)<>\|])|e(?:(?:d|lf|rvice)[\s\x0b&\)<>\|]|t(?:(?:facl)?[\s\x0b&\)<>\|]|arch|env|sid)|ndmail)|(?:g|ash|nap)[\s\x0b&\)<>\|]|h(?:(?:adow|ells)?[\s\x0b&\)<>\|]|\.distrib|u(?:f|tdown[\s\x0b&\)<>\|]))|s(?:[\s\x0b&\)<>\|]|h(?:[\s\x0b&\)<>\|]|-key(?:ge|sca)n|pass))|u(?:[\s\x0b&\)<>\|]|do)|vn|diff|ftp|l(?:eep[\s\x0b&\)<>\|]|sh)|mbclient|o(?:cat|elim|(?:rt|urce)[\s\x0b&\)<>\|])|p(?:lit[\s\x0b&\)<>\|]|wd\.db)|qlite3|t(?:art-stop-daemon|d(?:buf|err|in|out)|r(?:ace|ings[\s\x0b&\)<>\|]))|ys(?:ctl|tem(?:ctl|d-resolve)))|t(?:a(?:c|r[\s\x0b&\)<>\|]|il[\s\x0b&\)<>f\|]|sk(?:[\s\x0b&\)<>\|]|set))|bl|c(?:p(?:[\s\x0b&\)<>\|]|dump|ing|traceroute)|l?sh)|e(?:[ex][\s\x0b&\)<>\|]|lnet)|i(?:c[\s\x0b&\)<>\|]|me(?:datectl|out[\s\x0b&\)<>\|]))|o(?:p|uch[\s\x0b&\)<>\|])|ftp|mux|r(?:aceroute6?|off)|shark)|u(?:dp|l(?:imit)?[\s\x0b&\)<>\|]|n(?:ame|(?:compress|s(?:et|hare))[\s\x0b&\)<>\|]|expand|iq|l(?:ink[\s\x0b&\)<>\|]|z(?:4|ma))|(?:pig|x)z|rar|z(?:ip[\s\x0b&\)<>\|]|std))|pdate-alternatives|ser(?:(?:ad|mo)d|del)|u(?:de|en)code)|v(?:i(?:m(?:[\s\x0b&\)<>\|]|diff)|ew[\s\x0b&\)<>\|]|gr|pw|rsh|sudo)|algrind|olatility[\s\x0b&\)<>\|])|w(?:3m|c|a(?:ll|tch)[\s\x0b&\)<>\|]|get|h(?:iptail[\s\x0b&\)<>\|]|o(?:ami|is))|i(?:reshark|sh[\s\x0b&\)<>\|]))|x(?:(?:x|pa)d|z(?:[\s\x0b&\)<>\|]|c(?:at|mp)|d(?:ec|iff)|[ef]?grep|less|more)|args|e(?:la)?tex|mo(?:dmap|re)|term)|y(?:(?:e(?:s|lp)|arn)[\s\x0b&\)<>\|]|um)|z(?:ip(?:[\s\x0b&\)<>\|]|c(?:loak|mp)|details|grep|info|(?:merg|not)e|split|tool)|s(?:h|oelim|td(?:(?:ca|m)t|grep|less)?)|athura|c(?:at|mp)|diff|e(?:grep|ro[\s\x0b&\)<>\|])|f?grep|less|more|run|ypper))" \
|
|
1397
|
+
"id:932236,\
|
|
1398
|
+
phase:2,\
|
|
1399
|
+
block,\
|
|
1400
|
+
capture,\
|
|
1401
|
+
t:none,\
|
|
1402
|
+
msg:'Remote Command Execution: Unix Command Injection (command without evasion)',\
|
|
1403
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1404
|
+
tag:'application-multi',\
|
|
1405
|
+
tag:'language-shell',\
|
|
1406
|
+
tag:'platform-unix',\
|
|
1407
|
+
tag:'attack-rce',\
|
|
1408
|
+
tag:'paranoia-level/2',\
|
|
1409
|
+
tag:'OWASP_CRS',\
|
|
1410
|
+
tag:'capec/1000/152/248/88',\
|
|
1411
|
+
tag:'PCI/6.5.2',\
|
|
1412
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1413
|
+
severity:'CRITICAL',\
|
|
1414
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1415
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1416
|
+
|
|
1417
|
+
# [ Unix command injection ]
|
|
1418
|
+
#
|
|
1419
|
+
# This is a sibling of rule 932236.
|
|
1420
|
+
# This sibling detects Unix RCE in request headers Referer and User-Agent.
|
|
1421
|
+
# It uses the same regex but excludes known user-agents to avoid false positives.
|
|
1422
|
+
#
|
|
1423
|
+
# Rule relations:
|
|
1424
|
+
#
|
|
1425
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
1426
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
1427
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
1428
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
1429
|
+
#
|
|
1430
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
1431
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
1432
|
+
#
|
|
1433
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
1434
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
1435
|
+
# - with and without prefix
|
|
1436
|
+
# - words of any length)
|
|
1437
|
+
# ..932239 (sibling of 932236, PL2,
|
|
1438
|
+
# - with and without prefix
|
|
1439
|
+
# - words of any length
|
|
1440
|
+
# - targets request headers user-agent and referer only
|
|
1441
|
+
# - excluded words: known user-agents)
|
|
1442
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
1443
|
+
# - no excluded words)
|
|
1444
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
1445
|
+
# - targets request headers user-agent and referer only
|
|
1446
|
+
# - without prefix
|
|
1447
|
+
# - with word boundaries
|
|
1448
|
+
# - words of any length
|
|
1449
|
+
# - excluded words: known user-agents)
|
|
1450
|
+
#
|
|
1451
|
+
#
|
|
1452
|
+
#
|
|
1453
|
+
# Regular expression generated from regex-assembly/932239.ra.
|
|
1454
|
+
# To update the regular expression run the following shell script
|
|
1455
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1456
|
+
# crs-toolchain regex update 932239
|
|
1457
|
+
#
|
|
1458
|
+
SecRule REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer "@rx (?i)(?:^|b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?y[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?x|c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\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?|[\[\{])|<(?:\(|<<)|>\(|\([\s\x0b]*\))[\s\x0b]*(?:[\$\{]|(?:[\s\x0b]*\(|!)[\s\x0b]*|[0-9A-Z_a-z]+=(?:[^\s\x0b]*|\$(?:.*|.*)|[<>].*|'.*'|\".*\")[\s\x0b]+)*[\s\x0b]*[\"']*(?:[\"'-\+\--9\?A-\]_a-z\|]+/)?[\"'\x5c]*(?:7z[arx]?|(?:(?:GE|POS)T|HEAD)[\s\x0b&\)<>\|]|a(?:(?:b|w[ks]|l(?:ias|pine)|xel)[\s\x0b&\)<>\|]|pt(?:[\s\x0b&\)<>\|]|-get)|r(?:[\s\x0b&\)<>j\|]|(?:p|ch)[\s\x0b&\)<>\|]|ia2c)|s(?:h[\s\x0b&\)<>\|]|cii(?:-xfr|85)|pell)|dd(?:group|user)|getty|nsible|tobm)|b(?:z(?:z[\s\x0b&\)<>\|]|c(?:at|mp)|diff|e(?:grep|xe)|f?grep|ip2(?:recover)?|less|more)|a(?:s(?:e(?:32|64|n(?:ame[\s\x0b&\)<>\|]|c))|h[\s\x0b&\)<>\|])|tch[\s\x0b&\)<>\|])|lkid|pftrace|r(?:eaksw|idge[\s\x0b&\)<>\|])|sd(?:cat|iff|tar)|u(?:iltin|n(?:dler[\s\x0b&\)<>\|]|zip2)|s(?:ctl|ybox))|y(?:ebug|obu))|c(?:[89]9|(?:a(?:t|ncel|psh)|c)[\s\x0b&\)<>\|]|mp|p(?:[\s\x0b&\)<>\|]|io|ulimit)|s(?:h|cli[\s\x0b&\)<>\|]|plit|vtool)|u(?:t[\s\x0b&\)<>\|]|psfilter)|ertbot|h(?:attr|(?:dir|root)[\s\x0b&\)<>\|]|e(?:ck_(?:by_ssh|cups|log|memory|raid|s(?:sl_cert|tatusfile))|f[\s\x0b&\)\-<>\|])|(?:flag|pas)s|g(?:passwd|rp)|mod|o(?:om|wn)|sh)|lang(?:[\s\x0b&\)<>\|]|\+\+)|o(?:(?:b|pro)c|(?:lumn|m(?:m(?:and)?|p(?:oser|ress)))[\s\x0b&\)<>\|]|w(?:say|think))|r(?:ash[\s\x0b&\)<>\|]|on(?:[\s\x0b&\)<>\|]|tab)))|d(?:(?:[du]|i(?:(?:alo)?g|r|ff)|a(?:sh|te))[\s\x0b&\)<>\|]|f|hclient|m(?:esg|idecode|setup)|o(?:as|(?:cker|ne)[\s\x0b&\)<>\|]|sbox)|pkg|vips)|e(?:(?:[bd]|cho)[\s\x0b&\)<>\|]|n(?:v(?:[\s\x0b&\)<>\|]|-update)|d(?:if|sw))|qn|s(?:[\s\x0b&\)<>h\|]|ac)|x(?:(?:ec)?[\s\x0b&\)<>\|]|iftool|p(?:(?:and|(?:ec|or)t)[\s\x0b&\)<>\|]|r))|2fsck|(?:asy_instal|va)l|fax|grep|macs)|f(?:(?:c|etch|lock|unction)[\s\x0b&\)<>\|]|d|g(?:rep)?|i(?:(?:n(?:d|ger)|sh)?[\s\x0b&\)<>\|]|le(?:[\s\x0b&\)<>\|]|test))|mt|tp(?:[\s\x0b&\)<>\|]|stats|who)|acter|o(?:ld[\s\x0b&\)<>\|]|reach)|ping)|g(?:c(?:c[^\s\x0b]|ore)|db|e(?:(?:m|tfacl)[\s\x0b&\)<>\|]|ni(?:e[\s\x0b&\)<>\|]|soimage))|hci?|i(?:(?:t|mp)[\s\x0b&\)<>\|]|nsh)|(?:o|awk)[\s\x0b&\)<>\|]|pg|r(?:c|ep[\s\x0b&\)<>\|]|oup(?:[\s\x0b&\)<>\|]|mod))|tester|unzip|z(?:cat|exe|ip))|h(?:(?:d|up|ash|i(?:ghlight|story))[\s\x0b&\)<>\|]|e(?:ad[\s\x0b&\)<>\|]|xdump)|ost(?:id|name)|ping3|t(?:digest|op|passwd))|i(?:d|p(?:6?tables|config)?|rb|conv|f(?:config|top)|nstall[\s\x0b&\)<>\|]|onice|spell)|j(?:js|q|ava[\s\x0b&\)<>\|]|exec|o(?:(?:bs|in)[\s\x0b&\)<>\|]|urnalctl)|runscript)|k(?:s(?:h|shell)|ill(?:[\s\x0b&\)<>\|]|all)|nife[\s\x0b&\)<>\|])|l(?:d(?:d?[\s\x0b&\)<>\|]|config)|(?:[np]|ynx)[\s\x0b&\)<>\|]|s(?:-F|b_release|cpu|hw|mod|of|pci|usb)?|ua(?:[\s\x0b&\)<>\|]|(?:la)?tex)|z(?:[\s\x0b&\)4<>\|]|4c(?:at)?|c(?:at|mp)|diff|[ef]?grep|less|m(?:a(?:dec|info)?|ore))|a(?:st(?:[\s\x0b&\)<>\|]|comm|log(?:in)?)|tex[\s\x0b&\)<>\|])|ess(?:[\s\x0b&\)<>\|]|echo|(?:fil|pip)e)|ftp(?:get)?|o(?:(?:ca(?:l|te)|ok)[\s\x0b&\)<>\|]|g(?:inctl|(?:nam|sav)e)|setup)|trace|wp-(?:d(?:ownload|ump)|mirror|request))|m(?:a(?:(?:n|ke)[\s\x0b&\)<>\|]|il(?:[\s\x0b&\)<>q\|]|x[\s\x0b&\)<>\|])|ster\.passwd|wk)|tr|(?:v|utt)[\s\x0b&\)<>\|]|k(?:dir[\s\x0b&\)<>\|]|fifo|nod|temp)|locate|o(?:squitto|unt[\s\x0b&\)<>\|])|sg(?:attrib|c(?:at|onv)|filter|merge|uniq)|ysql(?:admin|dump(?:slow)?|hotcopy|show)?)|n(?:c(?:[\s\x0b&\)<>\|]|\.(?:openbsd|traditional)|at)|e(?:t(?:[\s\x0b&\)<>\|]|(?:c|st)at|kit-ftp|plan)|ofetch)|(?:(?:ul)?l|ice)[\s\x0b&\)<>\|]|m(?:[\s\x0b&\)<>\|]|ap)|p(?:m[\s\x0b&\)<>\|]|ing)|a(?:no[\s\x0b&\)<>\|]|sm|wk)|o(?:de[\s\x0b&\)<>\|]|hup)|roff|s(?:enter|lookup|tat))|o(?:(?:d|ctave)[\s\x0b&\)<>\|]|nintr|p(?:en(?:ssl|v(?:pn|t))|kg))|p(?:a(?:(?:x|rted|tch)[\s\x0b&\)<>\|]|s(?:swd|te[\s\x0b&\)<>\|]))|d(?:b|f(?:la)?tex|ksh)|f(?:[\s\x0b&\)<>\|]|tp)|g(?:[\s\x0b&\)<>\|]|rep)|hp(?:[\s\x0b&\)57<>\|]|-cgi)|i(?:(?:co?|ng)[\s\x0b&\)<>\|]|p[^\s\x0b]|dstat|gz)|k(?:g(?:_?info)?|exec|ill)|r(?:y?[\s\x0b&\)<>\|]|int(?:env|f[\s\x0b&\)<>\|]))|t(?:x|ar(?:diff|grep)?)|wd(?:\.db)?|xz|er(?:(?:f|ms)[\s\x0b&\)<>\|]|l(?:[\s\x0b&\)5<>\|]|sh))|opd|s(?:ed|ftp|ql)|u(?:ppet[\s\x0b&\)<>\|]|shd)|y(?:thon[23]|3?versions))|r(?:a(?:r[\s\x0b&\)<>\|]|k(?:e[\s\x0b&\)<>\|]|u))|c(?:p[\s\x0b&\)<>\|])?|e(?:(?:d(?:carpet)?|v|name|p(?:eat|lace))[\s\x0b&\)<>\|]|a(?:delf|lpath)|stic)|m(?:(?:dir)?[\s\x0b&\)<>\|]|user)|pm(?:[\s\x0b&\)<>\|]|db|(?:quer|verif)y)|bash|l(?:ogin|wrap)|nano|oute[\s\x0b&\)<>\|]|sync|u(?:by[^\s\x0b]|n-(?:mailcap|parts))|vi(?:ew|m))|s(?:c(?:p|(?:hed|r(?:een|ipt))[\s\x0b&\)<>\|])|e(?:(?:d|lf|rvice)[\s\x0b&\)<>\|]|t(?:(?:facl)?[\s\x0b&\)<>\|]|arch|env|sid)|ndmail)|(?:g|ash)[\s\x0b&\)<>\|]|h(?:(?:adow|ells)?[\s\x0b&\)<>\|]|\.distrib|u(?:f|tdown[\s\x0b&\)<>\|]))|s(?:[\s\x0b&\)<>\|]|h(?:[\s\x0b&\)<>\|]|-key(?:ge|sca)n|pass))|u(?:[\s\x0b&\)<>\|]|do)|vn|diff|ftp|l(?:eep[\s\x0b&\)<>\|]|sh)|mbclient|o(?:cat|elim|(?:rt|urce)[\s\x0b&\)<>\|])|p(?:lit[\s\x0b&\)<>\|]|wd\.db)|qlite3|t(?:art-stop-daemon|d(?:buf|err|in|out)|r(?:ace|ings[\s\x0b&\)<>\|]))|ys(?:ctl|tem(?:ctl|d-resolve)))|t(?:a(?:c|r[\s\x0b&\)<>\|]|il[\s\x0b&\)<>f\|]|sk(?:[\s\x0b&\)<>\|]|set))|bl|c(?:p(?:[\s\x0b&\)<>\|]|dump|ing|traceroute)|l?sh)|e(?:[ex][\s\x0b&\)<>\|]|lnet)|i(?:c[\s\x0b&\)<>\|]|me(?:datectl|out[\s\x0b&\)<>\|]))|o(?:p|uch[\s\x0b&\)<>\|])|ftp|mux|r(?:aceroute6?|off)|shark)|u(?:dp|l(?:imit)?[\s\x0b&\)<>\|]|n(?:ame|(?:compress|s(?:et|hare))[\s\x0b&\)<>\|]|expand|iq|l(?:ink[\s\x0b&\)<>\|]|z(?:4|ma))|(?:pig|x)z|rar|z(?:ip[\s\x0b&\)<>\|]|std))|pdate-alternatives|ser(?:(?:ad|mo)d|del)|u(?:de|en)code)|v(?:i(?:m(?:[\s\x0b&\)<>\|]|diff)|ew[\s\x0b&\)<>\|]|gr|pw|rsh|sudo)|algrind|olatility[\s\x0b&\)<>\|])|w(?:c|a(?:ll|tch)[\s\x0b&\)<>\|]|h(?:iptail[\s\x0b&\)<>\|]|o(?:ami|is))|i(?:reshark|sh[\s\x0b&\)<>\|]))|x(?:(?:x|pa)d|z(?:[\s\x0b&\)<>\|]|c(?:at|mp)|d(?:ec|iff)|[ef]?grep|less|more)|args|e(?:la)?tex|mo(?:dmap|re)|term)|y(?:(?:e(?:s|lp)|arn)[\s\x0b&\)<>\|]|um)|z(?:ip(?:[\s\x0b&\)<>\|]|c(?:loak|mp)|details|grep|info|(?:merg|not)e|split|tool)|s(?:h|oelim|td(?:(?:ca|m)t|grep|less)?)|athura|c(?:at|mp)|diff|e(?:grep|ro[\s\x0b&\)<>\|])|f?grep|less|more|run|ypper))" \
|
|
1459
|
+
"id:932239,\
|
|
1460
|
+
phase:1,\
|
|
1461
|
+
block,\
|
|
1462
|
+
capture,\
|
|
1463
|
+
t:none,\
|
|
1464
|
+
msg:'Remote Command Execution: Unix Command Injection found in user-agent or referer header',\
|
|
1465
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1466
|
+
tag:'application-multi',\
|
|
1467
|
+
tag:'language-shell',\
|
|
1468
|
+
tag:'platform-unix',\
|
|
1469
|
+
tag:'attack-rce',\
|
|
1470
|
+
tag:'paranoia-level/2',\
|
|
1471
|
+
tag:'OWASP_CRS',\
|
|
1472
|
+
tag:'capec/1000/152/248/88',\
|
|
1473
|
+
tag:'PCI/6.5.2',\
|
|
1474
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1475
|
+
severity:'CRITICAL',\
|
|
1476
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1477
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
# [ Unix shell snippets ]
|
|
1481
|
+
#
|
|
1482
|
+
# Detect some common sequences found in shell commands and scripts.
|
|
1483
|
+
#
|
|
1484
|
+
# Some commands which were restricted in earlier rules due to FP,
|
|
1485
|
+
# have been added here with their full path, in order to catch some
|
|
1486
|
+
# cases where the full path is sent.
|
|
1487
|
+
#
|
|
1488
|
+
# Rule relations:
|
|
1489
|
+
#
|
|
1490
|
+
# .932160 (base rule, PL1, unix shell commands with full path)
|
|
1491
|
+
# ..932161 (stricter sibling, PL2, unix shell commands with full path in User-Agent and Referer request headers)
|
|
1492
|
+
#
|
|
1493
|
+
SecRule REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer "@pmFromFile unix-shell.data" \
|
|
1494
|
+
"id:932161,\
|
|
1495
|
+
phase:1,\
|
|
1496
|
+
block,\
|
|
1497
|
+
capture,\
|
|
1498
|
+
t:none,t:cmdLine,t:normalizePath,\
|
|
1499
|
+
msg:'Remote Command Execution: Unix Shell Code Found in REQUEST_HEADERS',\
|
|
1500
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1501
|
+
tag:'application-multi',\
|
|
1502
|
+
tag:'language-shell',\
|
|
1503
|
+
tag:'platform-unix',\
|
|
1504
|
+
tag:'attack-rce',\
|
|
1505
|
+
tag:'paranoia-level/2',\
|
|
1506
|
+
tag:'OWASP_CRS',\
|
|
1507
|
+
tag:'capec/1000/152/248/88',\
|
|
1508
|
+
tag:'PCI/6.5.2',\
|
|
1509
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1510
|
+
severity:'CRITICAL',\
|
|
1511
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1512
|
+
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:932015,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
1516
|
+
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:932016,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
1517
|
+
#
|
|
1518
|
+
# -= Paranoia Level 3 =- (apply only when tx.detection_paranoia_level is sufficiently high: 3 or higher)
|
|
1519
|
+
#
|
|
1520
|
+
|
|
1521
|
+
# [ Unix command injection ]
|
|
1522
|
+
#
|
|
1523
|
+
# This rule targets pefix + commans that are prone to false positive detection at PL3.
|
|
1524
|
+
#
|
|
1525
|
+
# Rule relations:
|
|
1526
|
+
#
|
|
1527
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
1528
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
1529
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
1530
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
1531
|
+
#
|
|
1532
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
1533
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
1534
|
+
#
|
|
1535
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
1536
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
1537
|
+
# - with and without prefix
|
|
1538
|
+
# - words of any length)
|
|
1539
|
+
# ..932239 (sibling of 932236, PL2,
|
|
1540
|
+
# - with and without prefix
|
|
1541
|
+
# - words of any length
|
|
1542
|
+
# - targets request headers user-agent and referer only
|
|
1543
|
+
# - excluded words: known user-agents)
|
|
1544
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
1545
|
+
# - no excluded words)
|
|
1546
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
1547
|
+
# - targets request headers user-agent and referer only
|
|
1548
|
+
# - without prefix
|
|
1549
|
+
# - with word boundaries
|
|
1550
|
+
# - words of any length
|
|
1551
|
+
# - excluded words: known user-agents)
|
|
1552
|
+
#
|
|
1553
|
+
#
|
|
1554
|
+
# Regular expression generated from regex-assembly/932232.ra.
|
|
1555
|
+
# To update the regular expression run the following shell script
|
|
1556
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1557
|
+
# crs-toolchain regex update 932232
|
|
1558
|
+
#
|
|
1559
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(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:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?a[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?n[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?[\s\x0b&\),<>\|].*|s)|w[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?(?:h[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o|[\s\x0b&\),<>\|].*))\b" \
|
|
1560
|
+
"id:932232,\
|
|
1561
|
+
phase:2,\
|
|
1562
|
+
block,\
|
|
1563
|
+
capture,\
|
|
1564
|
+
t:none,\
|
|
1565
|
+
msg:'Remote Command Execution: Unix Command Injection',\
|
|
1566
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1567
|
+
tag:'application-multi',\
|
|
1568
|
+
tag:'language-shell',\
|
|
1569
|
+
tag:'platform-unix',\
|
|
1570
|
+
tag:'attack-rce',\
|
|
1571
|
+
tag:'paranoia-level/3',\
|
|
1572
|
+
tag:'OWASP_CRS',\
|
|
1573
|
+
tag:'capec/1000/152/248/88',\
|
|
1574
|
+
tag:'PCI/6.5.2',\
|
|
1575
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1576
|
+
severity:'CRITICAL',\
|
|
1577
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1578
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1579
|
+
|
|
1580
|
+
# [ Unix command injection ]
|
|
1581
|
+
#
|
|
1582
|
+
# Rule relations:
|
|
1583
|
+
#
|
|
1584
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
1585
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
1586
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
1587
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
1588
|
+
#
|
|
1589
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
1590
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
1591
|
+
#
|
|
1592
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
1593
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
1594
|
+
# - with and without prefix
|
|
1595
|
+
# - words of any length)
|
|
1596
|
+
# ..932239 (sibling of 932236, PL2,
|
|
1597
|
+
# - with and without prefix
|
|
1598
|
+
# - words of any length
|
|
1599
|
+
# - targets request headers user-agent and referer only
|
|
1600
|
+
# - excluded words: known user-agents)
|
|
1601
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
1602
|
+
# - no excluded words)
|
|
1603
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
1604
|
+
# - targets request headers user-agent and referer only
|
|
1605
|
+
# - without prefix
|
|
1606
|
+
# - with word boundaries
|
|
1607
|
+
# - words of any length
|
|
1608
|
+
# - excluded words: known user-agents)
|
|
1609
|
+
#
|
|
1610
|
+
#
|
|
1611
|
+
# Regular expression generated from regex-assembly/932237.ra.
|
|
1612
|
+
# To update the regular expression run the following shell script
|
|
1613
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1614
|
+
# crs-toolchain regex update 932237
|
|
1615
|
+
#
|
|
1616
|
+
SecRule REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer "@rx (?i)\b(?:7z[arx]?|(?:(?:GE|POS)T|HEAD)[\s\x0b&\)<>\|]|a(?:(?:b|w[ks]|l(?:ias|pine)|xel)[\s\x0b&\)<>\|]|pt(?:(?:itude)?[\s\x0b&\)<>\|]|-get)|r(?:[\s\x0b&\)<>j\|]|(?:p|ch)[\s\x0b&\)<>\|]|ia2c)|s(?:h?[\s\x0b&\)<>\|]|cii(?:-xfr|85)|pell)|t(?:[\s\x0b&\)<>\|]|obm)|dd(?:group|user)|getty|nsible)|b(?:z(?:z[\s\x0b&\)<>\|]|c(?:at|mp)|diff|e(?:grep|xe)|f?grep|ip2(?:recover)?|less|more)|a(?:s(?:e(?:32|64|n(?:ame[\s\x0b&\)<>\|]|c))|h[\s\x0b&\)<>\|])|tch[\s\x0b&\)<>\|])|lkid|pftrace|r(?:eaksw|idge[\s\x0b&\)<>\|])|sd(?:cat|iff|tar)|u(?:iltin|n(?:dler[\s\x0b&\)<>\|]|zip2)|s(?:ctl|ybox))|y(?:ebug|obu))|c(?:[89]9|(?:a(?:t|ncel|psh)|c)[\s\x0b&\)<>\|]|mp|p(?:[\s\x0b&\)<>\|]|io|ulimit)|s(?:h|cli[\s\x0b&\)<>\|]|plit|vtool)|u(?:t[\s\x0b&\)<>\|]|psfilter)|ertbot|h(?:attr|(?:dir|root)[\s\x0b&\)<>\|]|e(?:ck_(?:by_ssh|cups|log|memory|raid|s(?:sl_cert|tatusfile))|f[\s\x0b&\)\-<>\|])|(?:flag|pas)s|g(?:passwd|rp)|mod|o(?:om|wn)|sh)|lang(?:[\s\x0b&\)<>\|]|\+\+)|o(?:(?:b|pro)c|(?:lumn|m(?:m(?:and)?|p(?:oser|ress)))[\s\x0b&\)<>\|]|w(?:say|think))|r(?:ash[\s\x0b&\)<>\|]|on(?:[\s\x0b&\)<>\|]|tab)))|d(?:(?:[du]|i(?:(?:alo)?g|r|ff)|a(?:sh|te))[\s\x0b&\)<>\|]|n?f|hclient|m(?:esg|idecode|setup)|o(?:as|(?:cker|ne)[\s\x0b&\)<>\|]|sbox)|pkg|vips)|e(?:(?:[bd]|cho)[\s\x0b&\)<>\|]|n(?:v(?:[\s\x0b&\)<>\|]|-update)|d(?:if|sw))|qn|s(?:[\s\x0b&\)<>h\|]|ac)|x(?:(?:ec)?[\s\x0b&\)<>\|]|iftool|p(?:(?:and|(?:ec|or)t)[\s\x0b&\)<>\|]|r))|2fsck|(?:asy_instal|va)l|fax|grep|macs)|f(?:(?:c|etch|lock|unction)[\s\x0b&\)<>\|]|d|g(?:rep)?|i(?:(?:n(?:d|ger)|sh)?[\s\x0b&\)<>\|]|le(?:[\s\x0b&\)<>\|]|test))|mt|tp(?:[\s\x0b&\)<>\|]|stats|who)|acter|o(?:ld[\s\x0b&\)<>\|]|reach)|ping)|g(?:c(?:c[^\s\x0b]|ore)|db|e(?:(?:m|tfacl)[\s\x0b&\)<>\|]|ni(?:e[\s\x0b&\)<>\|]|soimage))|hci?|i(?:(?:t|mp)[\s\x0b&\)<>\|]|nsh)|(?:o|awk)[\s\x0b&\)<>\|]|pg|r(?:c|ep[\s\x0b&\)<>\|]|oup(?:[\s\x0b&\)<>\|]|mod))|tester|unzip|z(?:cat|exe|ip))|h(?:(?:d|up|ash|i(?:ghlight|story))[\s\x0b&\)<>\|]|e(?:ad[\s\x0b&\)<>\|]|xdump)|ost(?:id|name)|ping3|t(?:digest|op|passwd))|i(?:d|p(?:6?tables|config)?|rb|conv|f(?:config|top)|nstall[\s\x0b&\)<>\|]|onice|spell)|j(?:js|q|ava[\s\x0b&\)<>\|]|exec|o(?:(?:bs|in)[\s\x0b&\)<>\|]|urnalctl)|runscript)|k(?:s(?:h|shell)|ill(?:[\s\x0b&\)<>\|]|all)|nife[\s\x0b&\)<>\|])|l(?:d(?:d?[\s\x0b&\)<>\|]|config)|(?:[np]|ynx)[\s\x0b&\)<>\|]|s(?:-F|b_release|cpu|hw|mod|of|pci|usb)?|ua(?:[\s\x0b&\)<>\|]|(?:la)?tex)|z(?:[\s\x0b&\)4<>\|]|4c(?:at)?|c(?:at|mp)|diff|[ef]?grep|less|m(?:a(?:dec|info)?|ore))|a(?:st(?:[\s\x0b&\)<>\|]|comm|log(?:in)?)|tex[\s\x0b&\)<>\|])|ess(?:[\s\x0b&\)<>\|]|echo|(?:fil|pip)e)|ftp(?:get)?|o(?:(?:ca(?:l|te)|ok)[\s\x0b&\)<>\|]|g(?:inctl|(?:nam|sav)e)|setup)|trace|wp-(?:d(?:ownload|ump)|mirror|request))|m(?:a(?:(?:n|ke)[\s\x0b&\)<>\|]|il(?:[\s\x0b&\)<>q\|]|x[\s\x0b&\)<>\|])|ster\.passwd|wk)|tr|(?:v|utt)[\s\x0b&\)<>\|]|k(?:dir[\s\x0b&\)<>\|]|fifo|nod|temp)|locate|o(?:(?:re|unt)[\s\x0b&\)<>\|]|squitto)|sg(?:attrib|c(?:at|onv)|filter|merge|uniq)|ysql(?:admin|dump(?:slow)?|hotcopy|show)?)|n(?:c(?:[\s\x0b&\)<>\|]|\.(?:openbsd|traditional)|at)|e(?:t(?:[\s\x0b&\)<>\|]|(?:c|st)at|kit-ftp|plan)|ofetch)|(?:(?:ul)?l|ice)[\s\x0b&\)<>\|]|m(?:[\s\x0b&\)<>\|]|ap)|p(?:m[\s\x0b&\)<>\|]|ing)|a(?:no[\s\x0b&\)<>\|]|sm|wk)|o(?:de[\s\x0b&\)<>\|]|hup)|roff|s(?:enter|lookup|tat))|o(?:(?:d|ctave)[\s\x0b&\)<>\|]|nintr|p(?:en(?:ssl|v(?:pn|t))|kg))|p(?:a(?:(?:x|cman|rted|tch)[\s\x0b&\)<>\|]|s(?:swd|te[\s\x0b&\)<>\|]))|d(?:b|f(?:la)?tex|ksh)|f(?:[\s\x0b&\)<>\|]|tp)|g(?:[\s\x0b&\)<>\|]|rep)|hp(?:[\s\x0b&\)57<>\|]|-cgi)|i(?:(?:co?|ng)[\s\x0b&\)<>\|]|p[^\s\x0b]|dstat|gz)|k(?:g(?:_?info)?|exec|ill)|r(?:y?[\s\x0b&\)<>\|]|int(?:env|f[\s\x0b&\)<>\|]))|s(?:[\s\x0b&\)<>\|]|ed|ftp|ql)?|t(?:x|ar(?:diff|grep)?)|wd(?:\.db)?|xz|er(?:(?:f|ms)[\s\x0b&\)<>\|]|l(?:[\s\x0b&\)5<>\|]|sh))|opd|u(?:ppet[\s\x0b&\)<>\|]|shd)|y(?:thon[23]|3?versions))|r(?:a(?:r[\s\x0b&\)<>\|]|k(?:e[\s\x0b&\)<>\|]|u))|c(?:p[\s\x0b&\)<>\|])?|e(?:(?:d(?:carpet)?|v|name|p(?:eat|lace))[\s\x0b&\)<>\|]|a(?:delf|lpath)|stic)|m(?:(?:dir)?[\s\x0b&\)<>\|]|user)|pm(?:[\s\x0b&\)<>\|]|db|(?:quer|verif)y)|bash|l(?:ogin|wrap)|nano|oute[\s\x0b&\)<>\|]|sync|u(?:by[^\s\x0b]|n-(?:mailcap|parts))|vi(?:ew|m))|s(?:c(?:p|(?:hed|r(?:een|ipt))[\s\x0b&\)<>\|])|e(?:(?:d|lf|rvice)[\s\x0b&\)<>\|]|t(?:(?:facl)?[\s\x0b&\)<>\|]|arch|env|sid)|ndmail)|(?:g|ash)[\s\x0b&\)<>\|]|h(?:(?:adow|ells)?[\s\x0b&\)<>\|]|\.distrib|u(?:f|tdown[\s\x0b&\)<>\|]))|s(?:[\s\x0b&\)<>\|]|h(?:[\s\x0b&\)<>\|]|-key(?:ge|sca)n|pass))|u(?:[\s\x0b&\)<>\|]|do)|vn|diff|ftp|l(?:eep[\s\x0b&\)<>\|]|sh)|mbclient|o(?:cat|elim|(?:rt|urce)[\s\x0b&\)<>\|])|p(?:lit[\s\x0b&\)<>\|]|wd\.db)|qlite3|t(?:art-stop-daemon|d(?:buf|err|in|out)|r(?:ace|ings[\s\x0b&\)<>\|]))|ys(?:ctl|tem(?:ctl|d-resolve)))|t(?:a(?:c|r[\s\x0b&\)<>\|]|il[\s\x0b&\)<>f\|]|sk(?:[\s\x0b&\)<>\|]|set))|bl|c(?:p(?:[\s\x0b&\)<>\|]|dump|ing|traceroute)|l?sh)|e(?:[ex][\s\x0b&\)<>\|]|lnet)|i(?:c[\s\x0b&\)<>\|]|me(?:(?:out)?[\s\x0b&\)<>\|]|datectl))|o(?:p|uch[\s\x0b&\)<>\|])|ftp|mux|r(?:aceroute6?|off)|shark)|u(?:dp|l(?:imit)?[\s\x0b&\)<>\|]|n(?:ame|(?:compress|s(?:et|hare))[\s\x0b&\)<>\|]|expand|iq|l(?:ink[\s\x0b&\)<>\|]|z(?:4|ma))|(?:pig|x)z|rar|z(?:ip[\s\x0b&\)<>\|]|std))|p(?:2date[\s\x0b&\)<>\|]|date-alternatives)|ser(?:(?:ad|mo)d|del)|u(?:de|en)code)|v(?:i(?:(?:ew)?[\s\x0b&\)<>\|]|m(?:[\s\x0b&\)<>\|]|diff)|gr|pw|rsh|sudo)|algrind|olatility[\s\x0b&\)<>\|])|w(?:[\s\x0b&\)<>c\|]|h(?:o(?:[\s\x0b&\)<>\|]|ami|is)?|iptail[\s\x0b&\)<>\|])|a(?:ll|tch)[\s\x0b&\)<>\|]|i(?:reshark|sh[\s\x0b&\)<>\|]))|x(?:(?:x|pa)d|z(?:[\s\x0b&\)<>\|]|c(?:at|mp)|d(?:ec|iff)|[ef]?grep|less|more)|args|e(?:la)?tex|mo(?:dmap|re)|term)|y(?:(?:e(?:s|lp)|arn)[\s\x0b&\)<>\|]|um)|z(?:ip(?:[\s\x0b&\)<>\|]|c(?:loak|mp)|details|grep|info|(?:merg|not)e|split|tool)|s(?:h|oelim|td(?:(?:ca|m)t|grep|less)?)|athura|c(?:at|mp)|diff|e(?:grep|ro[\s\x0b&\)<>\|])|f?grep|less|more|run|ypper))(?:\b|[^0-9A-Z_a-z])" \
|
|
1617
|
+
"id:932237,\
|
|
1618
|
+
phase:1,\
|
|
1619
|
+
block,\
|
|
1620
|
+
capture,\
|
|
1621
|
+
t:none,t:cmdLine,t:normalizePath,\
|
|
1622
|
+
msg:'Remote Command Execution: Unix Shell Code Found in REQUEST_HEADERS',\
|
|
1623
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1624
|
+
tag:'application-multi',\
|
|
1625
|
+
tag:'language-shell',\
|
|
1626
|
+
tag:'platform-unix',\
|
|
1627
|
+
tag:'attack-rce',\
|
|
1628
|
+
tag:'paranoia-level/3',\
|
|
1629
|
+
tag:'OWASP_CRS',\
|
|
1630
|
+
tag:'capec/1000/152/248/88',\
|
|
1631
|
+
tag:'PCI/6.5.2',\
|
|
1632
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1633
|
+
severity:'CRITICAL',\
|
|
1634
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1635
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1636
|
+
|
|
1637
|
+
# [ Unix command injection ]
|
|
1638
|
+
#
|
|
1639
|
+
# Rule relations:
|
|
1640
|
+
#
|
|
1641
|
+
# .932230 (base rule, PL1, targets prefix + two and three character commands)
|
|
1642
|
+
# ..932231 (stricter sibling, PL2, targets prefix + the source shortcut command)
|
|
1643
|
+
# ..932232 (stricter sibling, PL3, targets prefix + additional command words)
|
|
1644
|
+
# .932235 (base rule, PL1, targets prefix + known command word of length > 3 without evasion)
|
|
1645
|
+
#
|
|
1646
|
+
# .932250 (base rule, PL1, targets two and three character commands)
|
|
1647
|
+
# .932260 (base rule, PL1, targets known command word of length > 3 without evasion)
|
|
1648
|
+
#
|
|
1649
|
+
# .932240 (generic detection, PL2, targets generic evasion attempts)
|
|
1650
|
+
# .932236 (stricter sibling of 932230, 932235, 932250, 932260, PL2,
|
|
1651
|
+
# - with and without prefix
|
|
1652
|
+
# - words of any length)
|
|
1653
|
+
# ..932239 (sibling of 932236, PL2,
|
|
1654
|
+
# - with and without prefix
|
|
1655
|
+
# - words of any length
|
|
1656
|
+
# - targets request headers user-agent and referer only
|
|
1657
|
+
# - excluded words: known user-agents)
|
|
1658
|
+
# ..932238 (stricter sibling of 932236, PL3,
|
|
1659
|
+
# - no excluded words)
|
|
1660
|
+
# .932237 (stricter sibling of 932230, 932235, 932250, 932260, PL3,
|
|
1661
|
+
# - targets request headers user-agent and referer only
|
|
1662
|
+
# - without prefix
|
|
1663
|
+
# - with word boundaries
|
|
1664
|
+
# - words of any length
|
|
1665
|
+
# - excluded words: known user-agents)
|
|
1666
|
+
#
|
|
1667
|
+
#
|
|
1668
|
+
# Regular expression generated from regex-assembly/932238.ra.
|
|
1669
|
+
# To update the regular expression run the following shell script
|
|
1670
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1671
|
+
# crs-toolchain regex update 932238
|
|
1672
|
+
#
|
|
1673
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/*|REQUEST_HEADERS:Referer|REQUEST_HEADERS:User-Agent "@rx (?i)(?:^|b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?u[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?s[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?y[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?b[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?x|c[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?o[\"'\)\[\x5c]*(?:(?:(?:\|\||&&)[\s\x0b]*)?\$[!#\(\*\-0-9\?@_a-\{]*)?\x5c?m[\"'\)\[\x5c]*(?:(?:(?:\|\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
|
+
capture,\
|
|
1678
|
+
t:none,t:cmdLine,t:normalizePath,\
|
|
1679
|
+
msg:'Remote Command Execution: Unix Shell Code Found in REQUEST_HEADERS',\
|
|
1680
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1681
|
+
tag:'application-multi',\
|
|
1682
|
+
tag:'language-shell',\
|
|
1683
|
+
tag:'platform-unix',\
|
|
1684
|
+
tag:'attack-rce',\
|
|
1685
|
+
tag:'paranoia-level/3',\
|
|
1686
|
+
tag:'OWASP_CRS',\
|
|
1687
|
+
tag:'capec/1000/152/248/88',\
|
|
1688
|
+
tag:'PCI/6.5.2',\
|
|
1689
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1690
|
+
severity:'CRITICAL',\
|
|
1691
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1692
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
#
|
|
1696
|
+
# -=[ Bypass Rule 930120 (wildcard) ]=-
|
|
1697
|
+
#
|
|
1698
|
+
# When Paranoia Level is set to 1 and 2, a Remote Command Execution
|
|
1699
|
+
# could be exploited bypassing rule 930120 (OS File Access Attempt)
|
|
1700
|
+
# by using wildcard characters.
|
|
1701
|
+
#
|
|
1702
|
+
# In some other cases, it could be bypassed even if the Paranoia Level is set to 3.
|
|
1703
|
+
# Please, keep in mind that this rule could lead to many false positives.
|
|
1704
|
+
#
|
|
1705
|
+
# The following two blog posts explain the evasions this rule is designed to detect:
|
|
1706
|
+
# - https://medium.com/secjuice/waf-evasion-techniques-718026d693d8
|
|
1707
|
+
# - https://medium.com/secjuice/web-application-firewall-waf-evasion-techniques-2-125995f3e7b0
|
|
1708
|
+
|
|
1709
|
+
SecRule ARGS "@rx /(?:[?*]+[a-z/]+|[a-z/]+[?*]+)" \
|
|
1710
|
+
"id:932190,\
|
|
1711
|
+
phase:2,\
|
|
1712
|
+
block,\
|
|
1713
|
+
capture,\
|
|
1714
|
+
t:none,t:normalizePath,t:cmdLine,\
|
|
1715
|
+
msg:'Remote Command Execution: Wildcard bypass technique attempt',\
|
|
1716
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1717
|
+
tag:'application-multi',\
|
|
1718
|
+
tag:'language-shell',\
|
|
1719
|
+
tag:'platform-unix',\
|
|
1720
|
+
tag:'attack-rce',\
|
|
1721
|
+
tag:'paranoia-level/3',\
|
|
1722
|
+
tag:'OWASP_CRS',\
|
|
1723
|
+
tag:'capec/1000/152/248/88',\
|
|
1724
|
+
tag:'PCI/6.5.2',\
|
|
1725
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1726
|
+
severity:'CRITICAL',\
|
|
1727
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1728
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
# -=[ SMTP commands ]=-
|
|
1732
|
+
#
|
|
1733
|
+
# This rule prevents execution of SMTP related system commands.
|
|
1734
|
+
#
|
|
1735
|
+
# These commands may have a higher risk of false positives.
|
|
1736
|
+
# For explanation of this rule, see above rule 932300.
|
|
1737
|
+
#
|
|
1738
|
+
# Rule 932301 is a stricter sibling of rule 932300.
|
|
1739
|
+
#
|
|
1740
|
+
# Regular expression generated from regex-assembly/932301.ra.
|
|
1741
|
+
# To update the regular expression run the following shell script
|
|
1742
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1743
|
+
# crs-toolchain regex update 932301
|
|
1744
|
+
#
|
|
1745
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \r\n.*?\b(?:DATA|QUIT|HELP(?: .{1,255})?)" \
|
|
1746
|
+
"id:932301,\
|
|
1747
|
+
phase:2,\
|
|
1748
|
+
block,\
|
|
1749
|
+
t:none,t:escapeSeqDecode,\
|
|
1750
|
+
msg:'Remote Command Execution: SMTP Command Execution',\
|
|
1751
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1752
|
+
tag:'application-multi',\
|
|
1753
|
+
tag:'platform-multi',\
|
|
1754
|
+
tag:'attack-rce',\
|
|
1755
|
+
tag:'paranoia-level/3',\
|
|
1756
|
+
tag:'OWASP_CRS',\
|
|
1757
|
+
tag:'capec/137/134',\
|
|
1758
|
+
tag:'PCI/6.5.2',\
|
|
1759
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1760
|
+
severity:'CRITICAL',\
|
|
1761
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1762
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1763
|
+
|
|
1764
|
+
# =[ IMAP4 Command Execution ]=
|
|
1765
|
+
#
|
|
1766
|
+
# This rule prevents execution of IMAP4 related system commands.
|
|
1767
|
+
#
|
|
1768
|
+
# These commands may have a higher risk of false positives.
|
|
1769
|
+
# For explanation of this rule, see above rule 932310.
|
|
1770
|
+
#
|
|
1771
|
+
# Rule 932311 is a stricter sibling of rule 932310.
|
|
1772
|
+
#
|
|
1773
|
+
# Regular expression generated from regex-assembly/932311.ra.
|
|
1774
|
+
# To update the regular expression run the following shell script
|
|
1775
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1776
|
+
# crs-toolchain regex update 932311
|
|
1777
|
+
#
|
|
1778
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?is)\r\n[0-9A-Z_a-z]{1,50}\b (?:C(?:(?:REATE|OPY [\*,0-:]+) [\"#%&\*\--9A-Z\x5c_a-z]+|APABILITY|HECK|LOSE)|DELETE [\"#%&\*\-\.0-9A-Z\x5c_a-z]+|EX(?:AMINE [\"#%&\*\-\.0-9A-Z\x5c_a-z]+|PUNGE)|FETCH [\*,0-:]+|L(?:IST [\"#\*\--9A-Z\x5c_a-z~]+? [\"#%&\*\--9A-Z\x5c_a-z]+|OG(?:IN [\-\.0-9@_a-z]{1,40} .*?|OUT))|RENAME [\"#%&\*\--9A-Z\x5c_a-z]+? [\"#%&\*\--9A-Z\x5c_a-z]+|S(?:E(?:LECT [\"#%&\*\--9A-Z\x5c_a-z]+|ARCH(?: CHARSET [\-\.0-9A-Z_a-z]{1,40})? (?:(KEYWORD \x5c)?(?:A(?:LL|NSWERED)|BCC|D(?:ELETED|RAFT)|(?:FLAGGE|OL)D|RECENT|SEEN|UN(?:(?:ANSWER|FLAGG)ED|D(?:ELETED|RAFT)|SEEN)|NEW)|(?:BODY|CC|FROM|HEADER .{1,100}|NOT|OR .{1,255}|T(?:EXT|O)) .{1,255}|LARGER [0-9]{1,20}|[\*,0-:]+|(?:BEFORE|ON|S(?:ENT(?:(?:BEFOR|SINC)E|ON)|INCE)) \"?[0-9]{1,2}-[0-9A-Z_a-z]{3}-[0-9]{4}\"?|S(?:MALLER [0-9]{1,20}|UBJECT .{1,255})|U(?:ID [\*,0-:]+?|NKEYWORD \x5c(Seen|(?:Answer|Flagg)ed|D(?:eleted|raft)|Recent))))|T(?:ORE [\*,0-:]+? [\+\-]?FLAGS(?:\.SILENT)? (?:\(\x5c[a-z]{1,20}\))?|ARTTLS)|UBSCRIBE [\"#%&\*\--9A-Z\x5c_a-z]+)|UN(?:SUBSCRIBE [\"#%&\*\--9A-Z\x5c_a-z]+|AUTHENTICATE)|NOOP)" \
|
|
1779
|
+
"id:932311,\
|
|
1780
|
+
phase:2,\
|
|
1781
|
+
block,\
|
|
1782
|
+
t:none,t:escapeSeqDecode,\
|
|
1783
|
+
msg:'Remote Command Execution: IMAP Command Execution',\
|
|
1784
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1785
|
+
tag:'application-multi',\
|
|
1786
|
+
tag:'platform-multi',\
|
|
1787
|
+
tag:'attack-rce',\
|
|
1788
|
+
tag:'paranoia-level/3',\
|
|
1789
|
+
tag:'OWASP_CRS',\
|
|
1790
|
+
tag:'capec/137/134',\
|
|
1791
|
+
tag:'PCI/6.5.2',\
|
|
1792
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1793
|
+
severity:'CRITICAL',\
|
|
1794
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1795
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1796
|
+
|
|
1797
|
+
# =[ POP3 Command Execution ]=
|
|
1798
|
+
#
|
|
1799
|
+
# This rule prevents execution of POP3 related system commands.
|
|
1800
|
+
#
|
|
1801
|
+
# These commands may have a higher risk of false positives.
|
|
1802
|
+
# For explanation of this rule, see above rule 932320.
|
|
1803
|
+
#
|
|
1804
|
+
# Rule 932321 is a stricter sibling of rule 932320.
|
|
1805
|
+
#
|
|
1806
|
+
# Regular expression generated from regex-assembly/932321.ra.
|
|
1807
|
+
# To update the regular expression run the following shell script
|
|
1808
|
+
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
|
1809
|
+
# crs-toolchain regex update 932321
|
|
1810
|
+
#
|
|
1811
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \r\n.*?\b(?:(?:QUI|STA|RSE)T|NOOP|CAPA)" \
|
|
1812
|
+
"id:932321,\
|
|
1813
|
+
phase:2,\
|
|
1814
|
+
block,\
|
|
1815
|
+
t:none,t:escapeSeqDecode,\
|
|
1816
|
+
msg:'Remote Command Execution: POP3 Command Execution',\
|
|
1817
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1818
|
+
tag:'application-multi',\
|
|
1819
|
+
tag:'platform-multi',\
|
|
1820
|
+
tag:'attack-rce',\
|
|
1821
|
+
tag:'paranoia-level/3',\
|
|
1822
|
+
tag:'OWASP_CRS',\
|
|
1823
|
+
tag:'capec/137/134',\
|
|
1824
|
+
tag:'PCI/6.5.2',\
|
|
1825
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1826
|
+
severity:'CRITICAL',\
|
|
1827
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1828
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1829
|
+
|
|
1830
|
+
|
|
1831
|
+
# =[ Unix shell history invocation ]=
|
|
1832
|
+
#
|
|
1833
|
+
# This rule is a stricter sibling of 932330.
|
|
1834
|
+
# Shell history can also be invoked by providing an absolute position: '!1' or by repeating the last command '!!'.
|
|
1835
|
+
# The latter might seem harmless as you would expect that it already requires a successful exploitation, but it is a threat in disguise.
|
|
1836
|
+
#
|
|
1837
|
+
# Imagine the following requests:
|
|
1838
|
+
# GET /?rce=c
|
|
1839
|
+
# GET /?rce=!!!!
|
|
1840
|
+
# The last request will invoke /usr/bin/cc, which is otherwise blocked by 932250.
|
|
1841
|
+
#
|
|
1842
|
+
# Neither !1 nor !! is necessarily valid speech, but blocking either of them is much more likely to cause false-positives than 932330.
|
|
1843
|
+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx !(?:\d|!)" \
|
|
1844
|
+
"id:932331,\
|
|
1845
|
+
phase:2,\
|
|
1846
|
+
block,\
|
|
1847
|
+
t:none,\
|
|
1848
|
+
msg:'Remote Command Execution: Unix shell history invocation',\
|
|
1849
|
+
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
|
1850
|
+
tag:'application-multi',\
|
|
1851
|
+
tag:'language-shell',\
|
|
1852
|
+
tag:'platform-unix',\
|
|
1853
|
+
tag:'attack-rce',\
|
|
1854
|
+
tag:'paranoia-level/3',\
|
|
1855
|
+
tag:'OWASP_CRS',\
|
|
1856
|
+
tag:'capec/1000/152/248/88',\
|
|
1857
|
+
tag:'PCI/6.5.2',\
|
|
1858
|
+
ver:'OWASP_CRS/4.9.0',\
|
|
1859
|
+
severity:'CRITICAL',\
|
|
1860
|
+
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
|
|
1861
|
+
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:932017,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
1865
|
+
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:932018,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
|
|
1866
|
+
#
|
|
1867
|
+
# -= Paranoia Level 4 =- (apply only when tx.detection_paranoia_level is sufficiently high: 4 or higher)
|
|
1868
|
+
#
|
|
1869
|
+
|
|
1870
|
+
|
|
1871
|
+
|
|
1872
|
+
#
|
|
1873
|
+
# -= Paranoia Levels Finished =-
|
|
1874
|
+
#
|
|
1875
|
+
SecMarker "END-REQUEST-932-APPLICATION-ATTACK-RCE"
|