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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/lib/nginx/includes/security/crs4/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example +200 -0
  2. package/lib/nginx/includes/security/crs4/rules/REQUEST-901-INITIALIZATION.conf +470 -0
  3. package/lib/nginx/includes/security/crs4/rules/REQUEST-905-COMMON-EXCEPTIONS.conf +57 -0
  4. package/lib/nginx/includes/security/crs4/rules/REQUEST-911-METHOD-ENFORCEMENT.conf +76 -0
  5. package/lib/nginx/includes/security/crs4/rules/REQUEST-913-SCANNER-DETECTION.conf +86 -0
  6. package/lib/nginx/includes/security/crs4/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf +1915 -0
  7. package/lib/nginx/includes/security/crs4/rules/REQUEST-921-PROTOCOL-ATTACK.conf +558 -0
  8. package/lib/nginx/includes/security/crs4/rules/REQUEST-922-MULTIPART-ATTACK.conf +120 -0
  9. package/lib/nginx/includes/security/crs4/rules/REQUEST-930-APPLICATION-ATTACK-LFI.conf +203 -0
  10. package/lib/nginx/includes/security/crs4/rules/REQUEST-931-APPLICATION-ATTACK-RFI.conf +189 -0
  11. package/lib/nginx/includes/security/crs4/rules/REQUEST-932-APPLICATION-ATTACK-RCE.conf +1875 -0
  12. package/lib/nginx/includes/security/crs4/rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf +774 -0
  13. package/lib/nginx/includes/security/crs4/rules/REQUEST-934-APPLICATION-ATTACK-GENERIC.conf +366 -0
  14. package/lib/nginx/includes/security/crs4/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf +1071 -0
  15. package/lib/nginx/includes/security/crs4/rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf +1978 -0
  16. package/lib/nginx/includes/security/crs4/rules/REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION.conf +132 -0
  17. package/lib/nginx/includes/security/crs4/rules/REQUEST-944-APPLICATION-ATTACK-JAVA.conf +463 -0
  18. package/lib/nginx/includes/security/crs4/rules/REQUEST-949-BLOCKING-EVALUATION.conf +270 -0
  19. package/lib/nginx/includes/security/crs4/rules/RESPONSE-950-DATA-LEAKAGES.conf +156 -0
  20. package/lib/nginx/includes/security/crs4/rules/RESPONSE-951-DATA-LEAKAGES-SQL.conf +417 -0
  21. package/lib/nginx/includes/security/crs4/rules/RESPONSE-952-DATA-LEAKAGES-JAVA.conf +108 -0
  22. package/lib/nginx/includes/security/crs4/rules/RESPONSE-953-DATA-LEAKAGES-PHP.conf +158 -0
  23. package/lib/nginx/includes/security/crs4/rules/RESPONSE-954-DATA-LEAKAGES-IIS.conf +152 -0
  24. package/lib/nginx/includes/security/crs4/rules/RESPONSE-955-WEB-SHELLS.conf +558 -0
  25. package/lib/nginx/includes/security/crs4/rules/RESPONSE-959-BLOCKING-EVALUATION.conf +280 -0
  26. package/lib/nginx/includes/security/crs4/rules/RESPONSE-980-CORRELATION.conf +138 -0
  27. package/lib/nginx/includes/security/crs4/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example +76 -0
  28. package/lib/nginx/includes/security/crs4/rules/iis-errors.data +59 -0
  29. package/lib/nginx/includes/security/crs4/rules/java-classes.data +64 -0
  30. package/lib/nginx/includes/security/crs4/rules/java-code-leakages.data +17 -0
  31. package/lib/nginx/includes/security/crs4/rules/java-errors.data +10 -0
  32. package/lib/nginx/includes/security/crs4/rules/lfi-os-files.data +722 -0
  33. package/lib/nginx/includes/security/crs4/rules/php-config-directives.data +571 -0
  34. package/lib/nginx/includes/security/crs4/rules/php-errors-pl2.data +7 -0
  35. package/lib/nginx/includes/security/crs4/rules/php-errors.data +2147 -0
  36. package/lib/nginx/includes/security/crs4/rules/php-function-names-933150.data +245 -0
  37. package/lib/nginx/includes/security/crs4/rules/php-function-names-933151.data +2201 -0
  38. package/lib/nginx/includes/security/crs4/rules/php-variables.data +30 -0
  39. package/lib/nginx/includes/security/crs4/rules/restricted-files.data +284 -0
  40. package/lib/nginx/includes/security/crs4/rules/restricted-upload.data +177 -0
  41. package/lib/nginx/includes/security/crs4/rules/scanners-user-agents.data +119 -0
  42. package/lib/nginx/includes/security/crs4/rules/sql-errors.data +172 -0
  43. package/lib/nginx/includes/security/crs4/rules/ssrf.data +177 -0
  44. package/lib/nginx/includes/security/crs4/rules/unix-shell.data +670 -0
  45. package/lib/nginx/includes/security/crs4/rules/web-shells-php.data +167 -0
  46. package/lib/nginx/includes/security/crs4/rules/windows-powershell-commands.data +425 -0
  47. package/lib/nginx/includes/security/unicode.mapping +96 -0
  48. package/lib/nginx/index.js +50 -3
  49. package/lib/nginx/templates/security/crs4/crs-setup.conf.js +857 -0
  50. package/lib/nginx/templates/security/modsecurity.conf.js +244 -0
  51. package/package.json +7 -6
@@ -0,0 +1,1071 @@
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:941011,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
18
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:941012,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
19
+ #
20
+ # -= Paranoia Level 1 (default) =- (apply only when tx.detection_paranoia_level is sufficiently high: 1 or higher)
21
+ #
22
+
23
+
24
+ # In CRS v4.0, we have added REQUEST_FILENAME to the list of variables to
25
+ # be checked for XSS to catch path-based XSS exploits such as:
26
+ # /index.php/%3Csvg/onload=alert()
27
+ #
28
+ # However, the REQUEST_FILENAME is always populated (while ARGS etc. are
29
+ # only set on some requests) and we found that always checking the
30
+ # REQUEST_FILENAME has a significant performance impact.
31
+ # Therefore, we are disabling the REQUEST_FILENAME XSS checks when the
32
+ # REQUEST_FILENAME is clearly not containing special characters necessary
33
+ # for a successful XSS.
34
+ #
35
+ # Some bona-fide REQUEST_FILENAMEs will still contain special characters
36
+ # and will be checked by the rules, but it will be a much lower amount,
37
+ # and that is a trade-off we are willing to make.
38
+ #
39
+ # So, we check for XSS in REQUEST_FILENAME only if it contains
40
+ # other characters than alphanumeric characters, hyphens, underscores etc.
41
+ # typically found in filenames and paths:
42
+ #
43
+ # - ascii 20 (whitespace)
44
+ # - ascii 45-47 (- . /)
45
+ # - ascii 48-57 (0-9)
46
+ # - ascii 65-90 (A-Z)
47
+ # - ascii 95 (underscore)
48
+ # - ascii 97-122 (a-z)
49
+ #
50
+ # If just these characters are present, we make use of a special tag to remove
51
+ # REQUEST_FILENAME from the target list of all the 941xxx rules starting 941100.
52
+ #
53
+ # Please note that it would be preferable to start without REQUEST_FILENAME in the
54
+ # target list and to add it on a case to case base, but the rule language does not
55
+ # support this feature at runtime.
56
+ #
57
+ SecRule REQUEST_FILENAME "!@validateByteRange 20, 45-47, 48-57, 65-90, 95, 97-122" \
58
+ "id:941010,\
59
+ phase:1,\
60
+ pass,\
61
+ t:none,\
62
+ nolog,\
63
+ tag:'OWASP_CRS',\
64
+ ctl:ruleRemoveTargetByTag=xss-perf-disable;REQUEST_FILENAME,\
65
+ ver:'OWASP_CRS/4.9.0'"
66
+
67
+
68
+ #
69
+ # -=[ Libinjection - XSS Detection ]=-
70
+ #
71
+ # Ref: https://github.com/client9/libinjection
72
+ # Ref: https://speakerdeck.com/ngalbreath/libinjection-from-sqli-to-xss
73
+ #
74
+ # -=[ Targets ]=-
75
+ #
76
+ # 941100: PL1 : REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|
77
+ # REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|
78
+ # ARGS_NAMES|ARGS|XML:/*
79
+ #
80
+ # 941101: PL2 : REQUEST_FILENAME|REQUEST_HEADERS:Referer
81
+ #
82
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|ARGS_NAMES|ARGS|XML:/* "@detectXSS" \
83
+ "id:941100,\
84
+ phase:2,\
85
+ block,\
86
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
87
+ msg:'XSS Attack Detected via libinjection',\
88
+ logdata:'Matched Data: XSS data found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
89
+ tag:'application-multi',\
90
+ tag:'language-multi',\
91
+ tag:'platform-multi',\
92
+ tag:'attack-xss',\
93
+ tag:'xss-perf-disable',\
94
+ tag:'paranoia-level/1',\
95
+ tag:'OWASP_CRS',\
96
+ tag:'capec/1000/152/242',\
97
+ ver:'OWASP_CRS/4.9.0',\
98
+ severity:'CRITICAL',\
99
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
100
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
101
+
102
+
103
+ #
104
+ # -=[ XSS Filters - Category 1 ]=-
105
+ # http://xssplayground.net23.net/xssfilter.html
106
+ # script tag based XSS vectors, e.g., <script> alert(1)</script>
107
+ #
108
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@rx (?i)<script[^>]*>[\s\S]*?" \
109
+ "id:941110,\
110
+ phase:2,\
111
+ block,\
112
+ capture,\
113
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
114
+ msg:'XSS Filter - Category 1: Script Tag Vector',\
115
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
116
+ tag:'application-multi',\
117
+ tag:'language-multi',\
118
+ tag:'platform-multi',\
119
+ tag:'attack-xss',\
120
+ tag:'xss-perf-disable',\
121
+ tag:'paranoia-level/1',\
122
+ tag:'OWASP_CRS',\
123
+ tag:'capec/1000/152/242',\
124
+ ver:'OWASP_CRS/4.9.0',\
125
+ severity:'CRITICAL',\
126
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
127
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
128
+
129
+
130
+ #
131
+ # -=[ XSS Filters - Category 3 ]=-
132
+ #
133
+ # Regular expression generated from regex-assembly/941130.ra.
134
+ # To update the regular expression run the following shell script
135
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
136
+ # crs-toolchain regex update 941130
137
+ #
138
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i).(?:\b(?:x(?:link:href|html|mlns)|data:text/html|formaction|pattern\b.*?=)|!ENTITY[\s\x0b]+(?:%[\s\x0b]+)?[^\s\x0b]+[\s\x0b]+(?:SYSTEM|PUBLIC)|@import|;base64)\b" \
139
+ "id:941130,\
140
+ phase:2,\
141
+ block,\
142
+ capture,\
143
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
144
+ msg:'XSS Filter - Category 3: Attribute Vector',\
145
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
146
+ tag:'application-multi',\
147
+ tag:'language-multi',\
148
+ tag:'platform-multi',\
149
+ tag:'attack-xss',\
150
+ tag:'xss-perf-disable',\
151
+ tag:'paranoia-level/1',\
152
+ tag:'OWASP_CRS',\
153
+ tag:'capec/1000/152/242',\
154
+ ver:'OWASP_CRS/4.9.0',\
155
+ severity:'CRITICAL',\
156
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
157
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
158
+
159
+
160
+ #
161
+ # -=[ XSS Filters - Category 4 ]=-
162
+ # XSS vectors making use of javascript uri and tags, e.g., <p style="background:url(javascript:alert(1))">
163
+ # https://portswigger.net/web-security/cross-site-scripting/cheat-sheet#css-expressions-ie7
164
+ # https://portswigger.net/web-security/cross-site-scripting/cheat-sheet#behaviors-for-older-modes-of-ie
165
+ # examples: https://regex101.com/r/FFEpsh/1
166
+ #
167
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)[a-z]+=(?:[^:=]+:.+;)*?[^:=]+:url\(javascript" \
168
+ "id:941140,\
169
+ phase:2,\
170
+ block,\
171
+ capture,\
172
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,t:removeWhitespace,\
173
+ msg:'XSS Filter - Category 4: Javascript URI Vector',\
174
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
175
+ tag:'application-multi',\
176
+ tag:'language-multi',\
177
+ tag:'platform-multi',\
178
+ tag:'attack-xss',\
179
+ tag:'xss-perf-disable',\
180
+ tag:'paranoia-level/1',\
181
+ tag:'OWASP_CRS',\
182
+ tag:'capec/1000/152/242',\
183
+ ver:'OWASP_CRS/4.9.0',\
184
+ severity:'CRITICAL',\
185
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
186
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
187
+
188
+
189
+ #
190
+ # -=[ NoScript XSS Filters ]=-
191
+ # Ref: http://noscript.net/
192
+ #
193
+ # [NoScript InjectionChecker] HTML injection
194
+ #
195
+ # Regular expression generated from regex-assembly/941160.ra.
196
+ # To update the regular expression run the following shell script
197
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
198
+ # crs-toolchain regex update 941160
199
+ #
200
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)<[^0-9<>A-Z_a-z]*(?:[^\s\x0b\"'<>]*:)?[^0-9<>A-Z_a-z]*[^0-9A-Z_a-z]*?(?:s[^0-9A-Z_a-z]*?(?:c[^0-9A-Z_a-z]*?r[^0-9A-Z_a-z]*?i[^0-9A-Z_a-z]*?p[^0-9A-Z_a-z]*?t|t[^0-9A-Z_a-z]*?y[^0-9A-Z_a-z]*?l[^0-9A-Z_a-z]*?e|v[^0-9A-Z_a-z]*?g|e[^0-9A-Z_a-z]*?t[^0-9>A-Z_a-z])|f[^0-9A-Z_a-z]*?o[^0-9A-Z_a-z]*?r[^0-9A-Z_a-z]*?m|d[^0-9A-Z_a-z]*?i[^0-9A-Z_a-z]*?a[^0-9A-Z_a-z]*?l[^0-9A-Z_a-z]*?o[^0-9A-Z_a-z]*?g|m[^0-9A-Z_a-z]*?(?:a[^0-9A-Z_a-z]*?r[^0-9A-Z_a-z]*?q[^0-9A-Z_a-z]*?u[^0-9A-Z_a-z]*?e[^0-9A-Z_a-z]*?e|e[^0-9A-Z_a-z]*?t[^0-9A-Z_a-z]*?a[^0-9>A-Z_a-z])|(?:l[^0-9A-Z_a-z]*?i[^0-9A-Z_a-z]*?n[^0-9A-Z_a-z]*?k|o[^0-9A-Z_a-z]*?b[^0-9A-Z_a-z]*?j[^0-9A-Z_a-z]*?e[^0-9A-Z_a-z]*?c[^0-9A-Z_a-z]*?t|e[^0-9A-Z_a-z]*?m[^0-9A-Z_a-z]*?b[^0-9A-Z_a-z]*?e[^0-9A-Z_a-z]*?d|a[^0-9A-Z_a-z]*?(?:p[^0-9A-Z_a-z]*?p[^0-9A-Z_a-z]*?l[^0-9A-Z_a-z]*?e[^0-9A-Z_a-z]*?t|u[^0-9A-Z_a-z]*?d[^0-9A-Z_a-z]*?i[^0-9A-Z_a-z]*?o|n[^0-9A-Z_a-z]*?i[^0-9A-Z_a-z]*?m[^0-9A-Z_a-z]*?a[^0-9A-Z_a-z]*?t[^0-9A-Z_a-z]*?e)|p[^0-9A-Z_a-z]*?a[^0-9A-Z_a-z]*?r[^0-9A-Z_a-z]*?a[^0-9A-Z_a-z]*?m|i?[^0-9A-Z_a-z]*?f[^0-9A-Z_a-z]*?r[^0-9A-Z_a-z]*?a[^0-9A-Z_a-z]*?m[^0-9A-Z_a-z]*?e|b[^0-9A-Z_a-z]*?(?:a[^0-9A-Z_a-z]*?s[^0-9A-Z_a-z]*?e|o[^0-9A-Z_a-z]*?d[^0-9A-Z_a-z]*?y|i[^0-9A-Z_a-z]*?n[^0-9A-Z_a-z]*?d[^0-9A-Z_a-z]*?i[^0-9A-Z_a-z]*?n[^0-9A-Z_a-z]*?g[^0-9A-Z_a-z]*?s)|i[^0-9A-Z_a-z]*?m[^0-9A-Z_a-z]*?a?[^0-9A-Z_a-z]*?g[^0-9A-Z_a-z]*?e?|v[^0-9A-Z_a-z]*?i[^0-9A-Z_a-z]*?d[^0-9A-Z_a-z]*?e[^0-9A-Z_a-z]*?o)[^0-9>A-Z_a-z])|(?:<[0-9A-Z_a-z].*[\s\x0b/]|[\"'](?:.*[\s\x0b/])?)(?:background|formaction|lowsrc|on(?:a(?:bort|ctivate|d(?:apteradded|dtrack)|fter(?:print|(?:scriptexecu|upda)te)|lerting|n(?:imation(?:cancel|end|iteration|start)|tennastatechange)|ppcommand|u(?:dio(?:end|process|start)|xclick))|b(?:e(?:fore(?:(?:(?:(?:de)?activa|scriptexecu)t|toggl)e|c(?:opy|ut)|editfocus|input|p(?:aste|rint)|u(?:nload|pdate))|gin(?:Event)?)|l(?:ocked|ur)|oun(?:ce|dary)|roadcast|usy)|c(?:a(?:(?:ch|llschang)ed|nplay(?:through)?|rdstatechange)|(?:ell|fstate)change|h(?:a(?:rging(?:time)?cha)?nge|ecking)|l(?:ick|ose)|o(?:m(?:mand(?:update)?|p(?:lete|osition(?:end|start|update)))|n(?:nect(?:ed|ing)|t(?:extmenu|rolselect))|py)|u(?:echange|t))|d(?:ata(?:(?:availabl|chang)e|error|setc(?:hanged|omplete))|blclick|e(?:activate|livery(?:error|success)|vice(?:found|light|(?:mo|orienta)tion|proximity))|i(?:aling|s(?:abled|c(?:hargingtimechange|onnect(?:ed|ing))))|o(?:m(?:a(?:ctivate|ttrmodified)|(?:characterdata|subtree)modified|focus(?:in|out)|mousescroll|node(?:inserted(?:intodocument)?|removed(?:fromdocument)?))|wnloading)|r(?:ag(?:drop|e(?:n(?:d|ter)|xit)|(?:gestur|leav)e|over|start)|op)|urationchange)|e(?:mptied|n(?:abled|d(?:ed|Event)?|ter)|rror(?:update)?|xit)|f(?:ailed|i(?:lterchange|nish)|o(?:cus(?:in|out)?|rm(?:change|input))|ullscreenchange)|g(?:amepad(?:axismove|button(?:down|up)|(?:dis)?connected)|et)|h(?:ashchange|e(?:adphoneschange|l[dp])|olding)|i(?:cc(?:cardlockerror|infochange)|n(?:coming|put|valid))|key(?:down|press|up)|l(?:evelchange|o(?:ad(?:e(?:d(?:meta)?data|nd)|start)?|secapture)|y)|m(?:ark|essage|o(?:use(?:down|enter|(?:lea|mo)ve|o(?:ut|ver)|up|wheel)|ve(?:end|start)?|z(?:a(?:fterpaint|udioavailable)|(?:beforeresiz|orientationchang|t(?:apgestur|imechang))e|(?:edgeui(?:c(?:ancel|omplet)|start)e|network(?:down|up)loa)d|fullscreen(?:change|error)|m(?:agnifygesture(?:start|update)?|ouse(?:hittest|pixelscroll))|p(?:ointerlock(?:change|error)|resstapgesture)|rotategesture(?:start|update)?|s(?:crolledareachanged|wipegesture(?:end|start|update)?))))|no(?:match|update)|o(?:(?:bsolet|(?:ff|n)lin)e|pen|verflow(?:changed)?)|p(?:a(?:ge(?:hide|show)|int|(?:st|us)e)|lay(?:ing)?|o(?:inter(?:down|enter|(?:(?:lea|mo)v|rawupdat)e|o(?:ut|ver)|up)|p(?:state|up(?:hid(?:den|ing)|show(?:ing|n))))|ro(?:gress|pertychange))|r(?:atechange|e(?:adystatechange|ceived|movetrack|peat(?:Event)?|quest|s(?:et|ize|u(?:lt|m(?:e|ing)))|trieving)|ow(?:e(?:nter|xit)|s(?:delete|inserted)))|s(?:croll(?:end)?|e(?:arch|ek(?:complete|ed|ing)|lect(?:ionchange|start)?|n(?:ding|t)|t)|how|(?:ound|peech)(?:end|start)|t(?:a(?:lled|rt|t(?:echange|uschanged))|k(?:comma|sessione)nd|op)|u(?:bmit|ccess|spend)|vg(?:abort|error|(?:un)?load|resize|scroll|zoom))|t(?:ext|ime(?:out|update)|o(?:ggle|uch(?:cancel|en(?:d|ter)|(?:lea|mo)ve|start))|ransition(?:cancel|end|run|start))|u(?:n(?:derflow|handledrejection|load)|p(?:dateready|gradeneeded)|s(?:erproximity|sdreceived))|v(?:ersion|o(?:ic|lum)e)change|w(?:a(?:it|rn)ing|ebkit(?:animation(?:end|iteration|start)|(?:playbacktargetavailabilitychange|transitionen)d)|heel)|zoom)|ping|s(?:rc|tyle))[\x08-\n\f\r ]*?=" \
201
+ "id:941160,\
202
+ phase:2,\
203
+ block,\
204
+ capture,\
205
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
206
+ msg:'NoScript XSS InjectionChecker: HTML Injection',\
207
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
208
+ tag:'application-multi',\
209
+ tag:'language-multi',\
210
+ tag:'platform-multi',\
211
+ tag:'attack-xss',\
212
+ tag:'xss-perf-disable',\
213
+ tag:'paranoia-level/1',\
214
+ tag:'OWASP_CRS',\
215
+ tag:'capec/1000/152/242',\
216
+ ver:'OWASP_CRS/4.9.0',\
217
+ severity:'CRITICAL',\
218
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
219
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
220
+
221
+
222
+ #
223
+ # [NoScript InjectionChecker] Attributes injection
224
+ #
225
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)(?:\W|^)(?:javascript:(?:[\s\S]+[=\x5c\(\[\.<]|[\s\S]*?(?:\bname\b|\x5c[ux]\d))|data:(?:(?:[a-z]\w+/\w[\w+-]+\w)?[;,]|[\s\S]*?;[\s\S]*?\b(?:base64|charset=)|[\s\S]*?,[\s\S]*?<[\s\S]*?\w[\s\S]*?>))|@\W*?i\W*?m\W*?p\W*?o\W*?r\W*?t\W*?(?:/\*[\s\S]*?)?(?:[\"']|\W*?u\W*?r\W*?l[\s\S]*?\()|[^-]*?-\W*?m\W*?o\W*?z\W*?-\W*?b\W*?i\W*?n\W*?d\W*?i\W*?n\W*?g[^:]*?:\W*?u\W*?r\W*?l[\s\S]*?\(" \
226
+ "id:941170,\
227
+ phase:2,\
228
+ block,\
229
+ capture,\
230
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
231
+ msg:'NoScript XSS InjectionChecker: Attribute Injection',\
232
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
233
+ tag:'application-multi',\
234
+ tag:'language-multi',\
235
+ tag:'platform-multi',\
236
+ tag:'attack-xss',\
237
+ tag:'xss-perf-disable',\
238
+ tag:'paranoia-level/1',\
239
+ tag:'OWASP_CRS',\
240
+ tag:'capec/1000/152/242',\
241
+ ver:'OWASP_CRS/4.9.0',\
242
+ severity:'CRITICAL',\
243
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
244
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
245
+
246
+
247
+ #
248
+ # [Deny List Keywords from Node-Validator]
249
+ # https://github.com/validatorjs/validator.js/
250
+ # This rule has a stricter sibling 941181 (PL2) that covers the additional payload "-->"
251
+ #
252
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@pm document.cookie document.domain document.write .parentnode .innerhtml window.location -moz-binding <!-- <![cdata[" \
253
+ "id:941180,\
254
+ phase:2,\
255
+ block,\
256
+ capture,\
257
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
258
+ msg:'Node-Validator Deny List Keywords',\
259
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
260
+ tag:'application-multi',\
261
+ tag:'language-multi',\
262
+ tag:'platform-multi',\
263
+ tag:'attack-xss',\
264
+ tag:'xss-perf-disable',\
265
+ tag:'paranoia-level/1',\
266
+ tag:'OWASP_CRS',\
267
+ tag:'capec/1000/152/242',\
268
+ ver:'OWASP_CRS/4.9.0',\
269
+ severity:'CRITICAL',\
270
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
271
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
272
+
273
+
274
+ #
275
+ # -=[ XSS Filters from IE ]=-
276
+ # Ref: http://blogs.technet.com/srd/archive/2008/08/18/ie-8-xss-filter-architecture-implementation.aspx
277
+ # Ref: http://xss.cx/examples/ie/internet-exploror-ie9-xss-filter-rules-example-regexp-mshtmldll.txt
278
+ #
279
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i:<style.*?>.*?(?:@[i\x5c]|(?:[:=]|&#x?0*(?:58|3A|61|3D);?).*?(?:[(\x5c]|&#x?0*(?:40|28|92|5C);?)))" \
280
+ "id:941190,\
281
+ phase:2,\
282
+ block,\
283
+ capture,\
284
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
285
+ msg:'IE XSS Filters - Attack Detected',\
286
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
287
+ tag:'application-multi',\
288
+ tag:'language-multi',\
289
+ tag:'platform-multi',\
290
+ tag:'attack-xss',\
291
+ tag:'xss-perf-disable',\
292
+ tag:'paranoia-level/1',\
293
+ tag:'OWASP_CRS',\
294
+ tag:'capec/1000/152/242',\
295
+ ver:'OWASP_CRS/4.9.0',\
296
+ severity:'CRITICAL',\
297
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
298
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
299
+
300
+
301
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i:<.*[:]?vmlframe.*?[\s/+]*?src[\s/+]*=)" \
302
+ "id:941200,\
303
+ phase:2,\
304
+ block,\
305
+ capture,\
306
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
307
+ msg:'IE XSS Filters - Attack Detected',\
308
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
309
+ tag:'application-multi',\
310
+ tag:'language-multi',\
311
+ tag:'platform-multi',\
312
+ tag:'attack-xss',\
313
+ tag:'xss-perf-disable',\
314
+ tag:'paranoia-level/1',\
315
+ tag:'OWASP_CRS',\
316
+ tag:'capec/1000/152/242',\
317
+ ver:'OWASP_CRS/4.9.0',\
318
+ severity:'CRITICAL',\
319
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
320
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
321
+
322
+
323
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)(?:j|&#(?:0*(?:74|106)|x0*[46]A);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:a|&#(?:0*(?:65|97)|x0*[46]1);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:v|&#(?:0*(?:86|118)|x0*[57]6);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:a|&#(?:0*(?:65|97)|x0*[46]1);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:s|&#(?:0*(?:115|83)|x0*[57]3);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:c|&#(?:x0*[46]3|0*(?:99|67));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:r|&#(?:x0*[57]2|0*(?:114|82));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:i|&#(?:x0*[46]9|0*(?:105|73));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:p|&#(?:x0*[57]0|0*(?:112|80));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:t|&#(?:x0*[57]4|0*(?:116|84));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?::|&(?:#(?:0*58|x0*3A);?|colon;))." \
324
+ "id:941210,\
325
+ phase:2,\
326
+ block,\
327
+ capture,\
328
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
329
+ msg:'IE XSS Filters - Attack Detected',\
330
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
331
+ tag:'application-multi',\
332
+ tag:'language-multi',\
333
+ tag:'platform-multi',\
334
+ tag:'attack-xss',\
335
+ tag:'xss-perf-disable',\
336
+ tag:'paranoia-level/1',\
337
+ tag:'OWASP_CRS',\
338
+ tag:'capec/1000/152/242',\
339
+ ver:'OWASP_CRS/4.9.0',\
340
+ severity:'CRITICAL',\
341
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
342
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
343
+
344
+
345
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)(?:v|&#(?:0*(?:118|86)|x0*[57]6);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:b|&#(?:0*(?:98|66)|x0*[46]2);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:s|&#(?:0*(?:115|83)|x0*[57]3);)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:c|&#(?:x0*[46]3|0*(?:99|67));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:r|&#(?:x0*[57]2|0*(?:114|82));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:i|&#(?:x0*[46]9|0*(?:105|73));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:p|&#(?:x0*[57]0|0*(?:112|80));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?:t|&#(?:x0*[57]4|0*(?:116|84));)(?:[\t\n\r]|&(?:#(?:0*(?:9|1[03])|x0*[AD]);?|(?:tab|newline);))*(?::|&(?:#(?:0*58|x0*3A);?|colon;))." \
346
+ "id:941220,\
347
+ phase:2,\
348
+ block,\
349
+ capture,\
350
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
351
+ msg:'IE XSS Filters - Attack Detected',\
352
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
353
+ tag:'application-multi',\
354
+ tag:'language-multi',\
355
+ tag:'platform-multi',\
356
+ tag:'attack-xss',\
357
+ tag:'xss-perf-disable',\
358
+ tag:'paranoia-level/1',\
359
+ tag:'OWASP_CRS',\
360
+ tag:'capec/1000/152/242',\
361
+ ver:'OWASP_CRS/4.9.0',\
362
+ severity:'CRITICAL',\
363
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
364
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
365
+
366
+
367
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)<EMBED[\s/+].*?(?:src|type).*?=" \
368
+ "id:941230,\
369
+ phase:2,\
370
+ block,\
371
+ capture,\
372
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
373
+ msg:'IE XSS Filters - Attack Detected',\
374
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
375
+ tag:'application-multi',\
376
+ tag:'language-multi',\
377
+ tag:'platform-multi',\
378
+ tag:'attack-xss',\
379
+ tag:'xss-perf-disable',\
380
+ tag:'paranoia-level/1',\
381
+ tag:'OWASP_CRS',\
382
+ tag:'capec/1000/152/242',\
383
+ ver:'OWASP_CRS/4.9.0',\
384
+ severity:'CRITICAL',\
385
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
386
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
387
+
388
+
389
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx <[?]?import[\s/+\S]*?implementation[\s/+]*?=" \
390
+ "id:941240,\
391
+ phase:2,\
392
+ block,\
393
+ capture,\
394
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:lowercase,t:removeNulls,\
395
+ msg:'IE XSS Filters - Attack Detected',\
396
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
397
+ tag:'application-multi',\
398
+ tag:'language-multi',\
399
+ tag:'platform-multi',\
400
+ tag:'attack-xss',\
401
+ tag:'xss-perf-disable',\
402
+ tag:'paranoia-level/1',\
403
+ tag:'OWASP_CRS',\
404
+ tag:'capec/1000/152/242',\
405
+ ver:'OWASP_CRS/4.9.0',\
406
+ severity:'CRITICAL',\
407
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
408
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
409
+
410
+
411
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i:<META[\s/+].*?http-equiv[\s/+]*=[\s/+]*[\"'`]?(?:(?:c|&#x?0*(?:67|43|99|63);?)|(?:r|&#x?0*(?:82|52|114|72);?)|(?:s|&#x?0*(?:83|53|115|73);?)))" \
412
+ "id:941250,\
413
+ phase:2,\
414
+ block,\
415
+ capture,\
416
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
417
+ msg:'IE XSS Filters - Attack Detected',\
418
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
419
+ tag:'application-multi',\
420
+ tag:'language-multi',\
421
+ tag:'platform-multi',\
422
+ tag:'attack-xss',\
423
+ tag:'xss-perf-disable',\
424
+ tag:'paranoia-level/1',\
425
+ tag:'OWASP_CRS',\
426
+ tag:'capec/1000/152/242',\
427
+ ver:'OWASP_CRS/4.9.0',\
428
+ severity:'CRITICAL',\
429
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
430
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
431
+
432
+
433
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i:<META[\s/+].*?charset[\s/+]*=)" \
434
+ "id:941260,\
435
+ phase:2,\
436
+ block,\
437
+ capture,\
438
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
439
+ msg:'IE XSS Filters - Attack Detected',\
440
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
441
+ tag:'application-multi',\
442
+ tag:'language-multi',\
443
+ tag:'platform-multi',\
444
+ tag:'attack-xss',\
445
+ tag:'xss-perf-disable',\
446
+ tag:'paranoia-level/1',\
447
+ tag:'OWASP_CRS',\
448
+ tag:'capec/1000/152/242',\
449
+ ver:'OWASP_CRS/4.9.0',\
450
+ severity:'CRITICAL',\
451
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
452
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
453
+
454
+
455
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)<LINK[\s/+].*?href[\s/+]*=" \
456
+ "id:941270,\
457
+ phase:2,\
458
+ block,\
459
+ capture,\
460
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
461
+ msg:'IE XSS Filters - Attack Detected',\
462
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
463
+ tag:'application-multi',\
464
+ tag:'language-multi',\
465
+ tag:'platform-multi',\
466
+ tag:'attack-xss',\
467
+ tag:'xss-perf-disable',\
468
+ tag:'paranoia-level/1',\
469
+ tag:'OWASP_CRS',\
470
+ tag:'capec/1000/152/242',\
471
+ ver:'OWASP_CRS/4.9.0',\
472
+ severity:'CRITICAL',\
473
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
474
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
475
+
476
+
477
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)<BASE[\s/+].*?href[\s/+]*=" \
478
+ "id:941280,\
479
+ phase:2,\
480
+ block,\
481
+ capture,\
482
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
483
+ msg:'IE XSS Filters - Attack Detected',\
484
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
485
+ tag:'application-multi',\
486
+ tag:'language-multi',\
487
+ tag:'platform-multi',\
488
+ tag:'attack-xss',\
489
+ tag:'xss-perf-disable',\
490
+ tag:'paranoia-level/1',\
491
+ tag:'OWASP_CRS',\
492
+ tag:'capec/1000/152/242',\
493
+ ver:'OWASP_CRS/4.9.0',\
494
+ severity:'CRITICAL',\
495
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
496
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
497
+
498
+
499
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)<APPLET[\s/+>]" \
500
+ "id:941290,\
501
+ phase:2,\
502
+ block,\
503
+ capture,\
504
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
505
+ msg:'IE XSS Filters - Attack Detected',\
506
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
507
+ tag:'application-multi',\
508
+ tag:'language-multi',\
509
+ tag:'platform-multi',\
510
+ tag:'attack-xss',\
511
+ tag:'xss-perf-disable',\
512
+ tag:'paranoia-level/1',\
513
+ tag:'OWASP_CRS',\
514
+ tag:'capec/1000/152/242',\
515
+ ver:'OWASP_CRS/4.9.0',\
516
+ severity:'CRITICAL',\
517
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
518
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
519
+
520
+
521
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)<OBJECT[\s/+].*?(?:type|codetype|classid|code|data)[\s/+]*=" \
522
+ "id:941300,\
523
+ phase:2,\
524
+ block,\
525
+ capture,\
526
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
527
+ msg:'IE XSS Filters - Attack Detected',\
528
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
529
+ tag:'application-multi',\
530
+ tag:'language-multi',\
531
+ tag:'platform-multi',\
532
+ tag:'attack-xss',\
533
+ tag:'xss-perf-disable',\
534
+ tag:'paranoia-level/1',\
535
+ tag:'OWASP_CRS',\
536
+ tag:'capec/1000/152/242',\
537
+ ver:'OWASP_CRS/4.9.0',\
538
+ severity:'CRITICAL',\
539
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
540
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
541
+
542
+ #
543
+ # https://cheatsheetseries.owasp.org/cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html
544
+ # US-ASCII encoding bypass listed on XSS filter evasion
545
+ # Reported by Mazin Ahmed
546
+ #
547
+ # This evasion covered by this chain of rules is specific to webservers that deliver content in US-ASCII.
548
+ # Only Apache Tomcat is known (according to the page linked above) to be vulnerable to this and probably has to be
549
+ # misconfigured for this to happen.
550
+ #
551
+ # Since US-ASCII is a seven bit encoding, bit 8 is ignored. Consider the following ISO 8859-1 sequence:
552
+ #
553
+ # ¼script¾alert(¢XSS¢)¼/script¾
554
+ #
555
+ # A filter looking for tags will usually not match against this sequence because there are no angle brackets (< / >). However,
556
+ # the characters where the brackets would be are ISO 8859-1 characters:
557
+ # - ¼: 0x00BC
558
+ # - ¾: 0x00BE
559
+ # - ¢: 0x00A2
560
+ #
561
+ # And this is how the sequence looks in in US-ASCII:
562
+ #
563
+ # <script>alert("XSSB")</script/>
564
+ #
565
+ # This enables an attacker to craft a string that will be delivered in a form that a browser will execute as script
566
+ # while being ignored by input filters.
567
+ #
568
+ # This rule looks for a start tag sequence that looks like "<...>" (checks for hex and plain to be sure).
569
+ # Because the bytes matched occur in many different languages encoded as multibyte characters (e.g. UTF-8)
570
+ # (e.g. German umlauts, Russian characters) this isn't very helpful and can cause many false positives. We, therefore,
571
+ # use a chained rule to also look for an end tag sequence that looks like "</...>". Only if the chained rule matches will
572
+ # the request be blocked.
573
+ #
574
+ # This is of course still not perfect but should at least make it harder to hide most tags using this technique while
575
+ # requiring very specific patterns in a language to match, which should get rid of most false positives.
576
+ # These rules would, for example, not guard against an element without an end tag, e.g. "<img... />".
577
+ #
578
+ # US-ASCII on Wikipedia: https://en.wikipedia.org/wiki/ASCII
579
+ # ISO 8859-1 on Wikipedia: https://en.wikipedia.org/wiki/ISO/IEC_8859-1
580
+
581
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx \xbc[^\xbe>]*[\xbe>]|<[^\xbe]*\xbe" \
582
+ "id:941310,\
583
+ phase:2,\
584
+ block,\
585
+ capture,\
586
+ t:none,t:lowercase,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,\
587
+ msg:'US-ASCII Malformed Encoding XSS Filter - Attack Detected',\
588
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
589
+ tag:'application-multi',\
590
+ tag:'language-multi',\
591
+ tag:'platform-tomcat',\
592
+ tag:'attack-xss',\
593
+ tag:'xss-perf-disable',\
594
+ tag:'paranoia-level/1',\
595
+ tag:'OWASP_CRS',\
596
+ tag:'capec/1000/152/242',\
597
+ ver:'OWASP_CRS/4.9.0',\
598
+ severity:'CRITICAL',\
599
+ chain"
600
+ SecRule MATCHED_VARS "@rx (?:\xbc\s*/\s*[^\xbe>]*[\xbe>])|(?:<\s*/\s*[^\xbe]*\xbe)" \
601
+ "setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
602
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
603
+
604
+ #
605
+ # https://nedbatchelder.com/blog/200704/xss_with_utf7.html
606
+ # UTF-7 encoding XSS filter evasion for IE.
607
+ # Reported by Vladimir Ivanov
608
+ #
609
+
610
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx \+ADw-.*(?:\+AD4-|>)|<.*\+AD4-" \
611
+ "id:941350,\
612
+ phase:2,\
613
+ block,\
614
+ capture,\
615
+ t:none,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,\
616
+ msg:'UTF-7 Encoding IE XSS - Attack Detected',\
617
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
618
+ tag:'application-multi',\
619
+ tag:'language-multi',\
620
+ tag:'platform-internet-explorer',\
621
+ tag:'attack-xss',\
622
+ tag:'xss-perf-disable',\
623
+ tag:'paranoia-level/1',\
624
+ tag:'OWASP_CRS',\
625
+ tag:'capec/1000/152/242',\
626
+ ver:'OWASP_CRS/4.9.0',\
627
+ severity:'CRITICAL',\
628
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
629
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
630
+
631
+ #
632
+ # Defend against JSFuck and Hieroglyphy obfuscation of Javascript code
633
+ #
634
+ # https://en.wikipedia.org/wiki/JSFuck
635
+ # https://github.com/alcuadrado/hieroglyphy
636
+ #
637
+ # These JS obfuscations mostly aim for client side XSS exploits, hence the
638
+ # integration of this rule into the XSS rule group. But serverside JS could
639
+ # also be attacked via these techniques.
640
+ #
641
+ # Detection pattern / Core elements of JSFuck and Hieroglyphy are the
642
+ # following two items:
643
+ # !![]
644
+ # !+[]
645
+ #
646
+ # ModSecurity always transforms "+" into " " with query strings and the
647
+ # URLENCODE body processor (but not for JSON). So we need to check for
648
+ # the following patterns:
649
+ # !![]
650
+ # !+[]
651
+ # ! []
652
+
653
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx ![!+ ]\[\]" \
654
+ "id:941360,\
655
+ phase:2,\
656
+ block,\
657
+ capture,\
658
+ t:none,\
659
+ msg:'JSFuck / Hieroglyphy obfuscation detected',\
660
+ logdata:'Matched Data: Suspicious payload found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
661
+ tag:'application-multi',\
662
+ tag:'language-multi',\
663
+ tag:'attack-xss',\
664
+ tag:'xss-perf-disable',\
665
+ tag:'paranoia-level/1',\
666
+ tag:'OWASP_CRS',\
667
+ tag:'capec/1000/152/242/63',\
668
+ ver:'OWASP_CRS/4.9.0',\
669
+ severity:'CRITICAL',\
670
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
671
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
672
+
673
+ #
674
+ # Prevent 941180 bypass by using JavaScript global variables
675
+ # Refer to: https://www.secjuice.com/bypass-xss-filters-using-javascript-global-variables/
676
+ #
677
+ # Examples:
678
+ # - /?search=/?a=";+alert(self["document"]["cookie"]);//
679
+ # - /?search=/?a=";+document+/*foo*/+.+/*bar*/+cookie;//
680
+ #
681
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?:self|document|this|top|window)\s*(?:/\*|[\[)]).+?(?:\]|\*/)" \
682
+ "id:941370,\
683
+ phase:2,\
684
+ block,\
685
+ capture,\
686
+ t:none,t:urlDecodeUni,t:compressWhitespace,\
687
+ msg:'JavaScript global variable found',\
688
+ logdata:'Matched Data: Suspicious JS global variable found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
689
+ tag:'application-multi',\
690
+ tag:'language-multi',\
691
+ tag:'attack-xss',\
692
+ tag:'xss-perf-disable',\
693
+ tag:'paranoia-level/1',\
694
+ tag:'OWASP_CRS',\
695
+ tag:'capec/1000/152/242/63',\
696
+ ver:'OWASP_CRS/4.9.0',\
697
+ severity:'CRITICAL',\
698
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
699
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
700
+
701
+ #
702
+ # JavaScript methods which take code as a string types are considered unsafe.
703
+ # Unsafe JS functions like eval(), setInterval(), setTimeout()
704
+ # Unsafe JS constructor new Function()
705
+ # https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#dangerous-contexts
706
+ # https://snyk.io/blog/5-ways-to-prevent-code-injection-in-javascript-and-node-js/
707
+ #
708
+ # Regular expression generated from regex-assembly/941390.ra.
709
+ # To update the regular expression run the following shell script
710
+ # (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
711
+ # crs-toolchain regex update 941390
712
+ #
713
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)\b(?:eval|set(?:timeout|interval)|new[\s\x0b]+Function|a(?:lert|tob)|btoa|prompt|confirm)[\s\x0b]*\(" \
714
+ "id:941390,\
715
+ phase:2,\
716
+ block,\
717
+ capture,\
718
+ t:none,t:htmlEntityDecode,t:jsDecode,\
719
+ msg:'Javascript method detected',\
720
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
721
+ tag:'application-multi',\
722
+ tag:'language-multi',\
723
+ tag:'attack-xss',\
724
+ tag:'xss-perf-disable',\
725
+ tag:'paranoia-level/1',\
726
+ tag:'OWASP_CRS',\
727
+ tag:'capec/1000/152/242',\
728
+ ver:'OWASP_CRS/4.9.0',\
729
+ severity:'CRITICAL',\
730
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
731
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
732
+
733
+
734
+ #
735
+ # JavaScript function without parentheses
736
+ # Reference: https://portswigger.net/research/the-seventh-way-to-call-a-javascript-function-without-parentheses
737
+ #
738
+ # Example Payloads:
739
+ # [].sort.call`${alert}1337`
740
+ # [].map.call`${eval}\\u{61}lert\x281337\x29`
741
+ # Reflect.apply.call`${navigation.navigate}${navigation}${[name]}`
742
+ #
743
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx ((?:\[[^\]]*\][^.]*\.)|Reflect[^.]*\.).*(?:map|sort|apply)[^.]*\..*call[^`]*`.*`" \
744
+ "id:941400,\
745
+ phase:2,\
746
+ block,\
747
+ capture,\
748
+ t:none,t:urlDecodeUni,t:compressWhitespace,\
749
+ msg:'XSS JavaScript function without parentheses',\
750
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
751
+ tag:'application-multi',\
752
+ tag:'language-multi',\
753
+ tag:'attack-xss',\
754
+ tag:'xss-perf-disable',\
755
+ tag:'paranoia-level/1',\
756
+ tag:'OWASP_CRS',\
757
+ tag:'capec/1000/152/242',\
758
+ ver:'OWASP_CRS/4.9.0',\
759
+ severity:'CRITICAL',\
760
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
761
+ setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
762
+
763
+
764
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:941013,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
765
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:941014,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
766
+ #
767
+ # -= Paranoia Level 2 =- (apply only when tx.detection_paranoia_level is sufficiently high: 2 or higher)
768
+ #
769
+
770
+ #
771
+ # This is a stricter sibling of rule 941100.
772
+ #
773
+ SecRule REQUEST_FILENAME|REQUEST_HEADERS:Referer "@detectXSS" \
774
+ "id:941101,\
775
+ phase:1,\
776
+ block,\
777
+ capture,\
778
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
779
+ msg:'XSS Attack Detected via libinjection',\
780
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
781
+ tag:'application-multi',\
782
+ tag:'language-multi',\
783
+ tag:'platform-multi',\
784
+ tag:'attack-xss',\
785
+ tag:'xss-perf-disable',\
786
+ tag:'paranoia-level/2',\
787
+ tag:'OWASP_CRS',\
788
+ tag:'capec/1000/152/242',\
789
+ ver:'OWASP_CRS/4.9.0',\
790
+ severity:'CRITICAL',\
791
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
792
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
793
+
794
+
795
+ #
796
+ # -=[ XSS Filters - Category 2 ]=-
797
+ # XSS vectors making use of event handlers like onerror, onload etc, e.g., <body onload="alert(1)">
798
+ #
799
+ # We are not listing all the known event handlers like rule 941160, but we
800
+ # limit the alerts to keywords of 3-50 characters after the prefix ("on").
801
+ #
802
+ # The shortest known event is "onget". The longest known event is "onwebkitplaybacktargetavailabilitychanged"
803
+ # with 39 chars after the prefix. 50 chars adds a little bit of safety.
804
+ #
805
+ # This rule has been moved to PL2 since it has a tendency to trigger on random input.
806
+ #
807
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)[\s\"'`;/0-9=\x0B\x09\x0C\x3B\x2C\x28\x3B]on[a-zA-Z]{3,50}[\s\x0B\x09\x0C\x3B\x2C\x28\x3B]*?=[^=]" \
808
+ "id:941120,\
809
+ phase:2,\
810
+ block,\
811
+ capture,\
812
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
813
+ msg:'XSS Filter - Category 2: Event Handler Vector',\
814
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
815
+ tag:'application-multi',\
816
+ tag:'language-multi',\
817
+ tag:'platform-multi',\
818
+ tag:'attack-xss',\
819
+ tag:'xss-perf-disable',\
820
+ tag:'paranoia-level/2',\
821
+ tag:'OWASP_CRS',\
822
+ tag:'capec/1000/152/242',\
823
+ ver:'OWASP_CRS/4.9.0',\
824
+ severity:'CRITICAL',\
825
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
826
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
827
+
828
+
829
+ #
830
+ # -=[ XSS Filters - Category 5 ]=-
831
+ # HTML attributes - src, style and href
832
+ #
833
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)\b(?:s(?:tyle|rc)|href)\b[\s\S]*?=" \
834
+ "id:941150,\
835
+ phase:2,\
836
+ block,\
837
+ capture,\
838
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\
839
+ msg:'XSS Filter - Category 5: Disallowed HTML Attributes',\
840
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
841
+ tag:'application-multi',\
842
+ tag:'language-multi',\
843
+ tag:'platform-multi',\
844
+ tag:'attack-xss',\
845
+ tag:'xss-perf-disable',\
846
+ tag:'paranoia-level/2',\
847
+ tag:'OWASP_CRS',\
848
+ tag:'capec/1000/152/242',\
849
+ ver:'OWASP_CRS/4.9.0',\
850
+ severity:'CRITICAL',\
851
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
852
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
853
+
854
+
855
+
856
+ #
857
+ # [Deny List Keywords from Node-Validator]
858
+ # https://github.com/validatorjs/validator.js/
859
+ # This rule is a stricter sibling of 941180 (PL1)
860
+ #
861
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@contains -->" \
862
+ "id:941181,\
863
+ phase:2,\
864
+ block,\
865
+ capture,\
866
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:lowercase,t:removeNulls,\
867
+ msg:'Node-Validator Deny List Keywords',\
868
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
869
+ tag:'application-multi',\
870
+ tag:'language-multi',\
871
+ tag:'platform-multi',\
872
+ tag:'attack-xss',\
873
+ tag:'xss-perf-disable',\
874
+ tag:'paranoia-level/2',\
875
+ tag:'OWASP_CRS',\
876
+ tag:'capec/1000/152/242',\
877
+ ver:'OWASP_CRS/4.9.0',\
878
+ severity:'CRITICAL',\
879
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
880
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
881
+
882
+
883
+
884
+ #
885
+ # -=[ XSS Filters from IE ]=-
886
+
887
+ # Detect tags that are the most common direct HTML injection points.
888
+ #
889
+ # <a href=javascript:...
890
+ # <applet src="..." type=text/html>
891
+ # <applet src="data:text/html;base64,PHNjcmlwdD5hbGVydCgvWFNTLyk8L3NjcmlwdD4" type=text/html>
892
+ # <base href=javascript:...
893
+ # <base href=... // change base URL to something else to exploit relative filename inclusion
894
+ # <bgsound src=javascript:...
895
+ # <body background=javascript:...
896
+ # <body onload=...
897
+ # <embed src=http://www.example.com/flash.swf allowScriptAccess=always
898
+ # <embed src="data:image/svg+xml;
899
+ # <frameset><frame src="javascript:..."></frameset>
900
+ # <iframe src=javascript:...
901
+ # <img src=x onerror=...
902
+ # <input type=image src=javascript:...
903
+ # <layer src=...
904
+ # <link href="javascript:..." rel="stylesheet" type="text/css"
905
+ # <link href="http://www.example.com/xss.css" rel="stylesheet" type="text/css"
906
+ # <meta http-equiv="refresh" content="0;url=javascript:..."
907
+ # <meta http-equiv="refresh" content="0;url=http://;javascript:..." // evasion
908
+ # <meta http-equiv="link" rel=stylesheet content="http://www.example.com/xss.css">
909
+ # <meta http-equiv="Set-Cookie" content="NEW_COOKIE_VALUE">
910
+ # <object data=http://www.example.com
911
+ # <object type=text/x-scriptlet data=...
912
+ # <object type=application/x-shockwave-flash data=xss.swf>
913
+ # <object classid=clsid:ae24fdae-03c6-11d1-8b76-0080c744f389><param name=url value=javascript:...></object> // not verified
914
+ # <script>...</script>
915
+ # <script src=http://www.example.com/xss.js></script> - TODO add another rule for this
916
+ # <script src="data:text/javascript,alert(1)"></script>
917
+ # <script src="data:text/javascript;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5jb29raWUpOzwvc2NyaXB0Pg=="></script>
918
+ # <style>STYLE</style>
919
+ # <style type=text/css>STYLE</style>
920
+ # <style type=text/javascript>alert('xss')</style>
921
+ # <table background=javascript:...
922
+ # <td background=javascript:
923
+ #
924
+ #
925
+ # NOTES
926
+ #
927
+ # - Reference the WASC Script Mapping Project - http://projects.webappsec.org/Script-Mapping
928
+ #
929
+ # - Not using closing brackets because they are not needed for the
930
+ # attacks to succeed. The following seems to work in FF: <body/s/onload=...
931
+ #
932
+ # - Also, browsers sometimes tend to translate < into >, in order to "repair"
933
+ # what they think was a mistake made by the programmer/template designer.
934
+ #
935
+ # - Browsers are flexible when it comes to what they accept as separator between
936
+ # tag names and attributes. The following is commonly used in payloads: <img/src=...
937
+ # A better example: <BODY onload!#$%&amp;()*~+-_.,:;?@[/|\]^=alert("XSS")>
938
+ #
939
+ # - Grave accents are sometimes used as an evasion technique (as a replacement for quotes),
940
+ # but I don't believe we need to look for quotes anywhere.
941
+ #
942
+ # - Links do not have to be fully qualified. For example, the following works:
943
+ # <script src="//ha.ckers.org/.j">
944
+ #
945
+ # This rule is also triggered by the following exploit(s):
946
+ # [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
947
+ #
948
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx <(?:a|abbr|acronym|address|applet|area|audioscope|b|base|basefront|bdo|bgsound|big|blackface|blink|blockquote|body|bq|br|button|caption|center|cite|code|col|colgroup|comment|dd|del|dfn|dir|div|dl|dt|em|embed|fieldset|fn|font|form|frame|frameset|h1|head|hr|html|i|iframe|ilayer|img|input|ins|isindex|kdb|keygen|label|layer|legend|li|limittext|link|listing|map|marquee|menu|meta|multicol|nobr|noembed|noframes|noscript|nosmartquotes|object|ol|optgroup|option|p|param|plaintext|pre|q|rt|ruby|s|samp|script|select|server|shadow|sidebar|small|spacer|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|ul|var|wbr|xml|xmp)\W" \
949
+ "id:941320,\
950
+ phase:2,\
951
+ block,\
952
+ capture,\
953
+ t:none,t:jsDecode,t:lowercase,\
954
+ msg:'Possible XSS Attack Detected - HTML Tag Handler',\
955
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
956
+ tag:'application-multi',\
957
+ tag:'language-multi',\
958
+ tag:'platform-multi',\
959
+ tag:'attack-xss',\
960
+ tag:'xss-perf-disable',\
961
+ tag:'paranoia-level/2',\
962
+ tag:'OWASP_CRS',\
963
+ tag:'capec/1000/152/242/63',\
964
+ tag:'PCI/6.5.1',\
965
+ ver:'OWASP_CRS/4.9.0',\
966
+ severity:'CRITICAL',\
967
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
968
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
969
+
970
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i:[\"'][ ]*(?:[^a-z0-9~_:' ]|in).*?(?:(?:l|\x5cu006C)(?:o|\x5cu006F)(?:c|\x5cu0063)(?:a|\x5cu0061)(?:t|\x5cu0074)(?:i|\x5cu0069)(?:o|\x5cu006F)(?:n|\x5cu006E)|(?:n|\x5cu006E)(?:a|\x5cu0061)(?:m|\x5cu006D)(?:e|\x5cu0065)|(?:o|\x5cu006F)(?:n|\x5cu006E)(?:e|\x5cu0065)(?:r|\x5cu0072)(?:r|\x5cu0072)(?:o|\x5cu006F)(?:r|\x5cu0072)|(?:v|\x5cu0076)(?:a|\x5cu0061)(?:l|\x5cu006C)(?:u|\x5cu0075)(?:e|\x5cu0065)(?:O|\x5cu004F)(?:f|\x5cu0066)).*?=)" \
971
+ "id:941330,\
972
+ phase:2,\
973
+ block,\
974
+ capture,\
975
+ t:none,t:htmlEntityDecode,t:compressWhitespace,\
976
+ msg:'IE XSS Filters - Attack Detected',\
977
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
978
+ tag:'application-multi',\
979
+ tag:'language-multi',\
980
+ tag:'platform-multi',\
981
+ tag:'attack-xss',\
982
+ tag:'xss-perf-disable',\
983
+ tag:'paranoia-level/2',\
984
+ tag:'OWASP_CRS',\
985
+ tag:'capec/1000/152/242',\
986
+ tag:'PCI/6.5.1',\
987
+ ver:'OWASP_CRS/4.9.0',\
988
+ severity:'CRITICAL',\
989
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
990
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
991
+
992
+ # This rule is also triggered by the following exploit(s):
993
+ # [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
994
+ #
995
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)[\"\'][ ]*(?:[^a-z0-9~_:\' ]|in).+?[.].+?=" \
996
+ "id:941340,\
997
+ phase:2,\
998
+ block,\
999
+ capture,\
1000
+ t:none,t:htmlEntityDecode,t:compressWhitespace,\
1001
+ msg:'IE XSS Filters - Attack Detected',\
1002
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
1003
+ tag:'application-multi',\
1004
+ tag:'language-multi',\
1005
+ tag:'platform-multi',\
1006
+ tag:'attack-xss',\
1007
+ tag:'xss-perf-disable',\
1008
+ tag:'paranoia-level/2',\
1009
+ tag:'OWASP_CRS',\
1010
+ tag:'capec/1000/152/242',\
1011
+ tag:'PCI/6.5.1',\
1012
+ ver:'OWASP_CRS/4.9.0',\
1013
+ severity:'CRITICAL',\
1014
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
1015
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
1016
+
1017
+ #
1018
+ # Defend against AngularJS client side template injection
1019
+ #
1020
+ # Of course, pure client-side AngularJS commands can not be intercepted.
1021
+ # But once a command is sent to the server, the CRS will trigger.
1022
+ #
1023
+ # https://portswigger.net/research/xss-without-html-client-side-template-injection-with-angularjs
1024
+ #
1025
+ # Example payload:
1026
+ # http://localhost/login?user=%20x%20%7B%7Bconstructor.constructor(%27alert(1)%27)()%7D%7D%20.%20ff
1027
+ # Decoded argument:
1028
+ # {{constructor.constructor('alert(1)')()}}
1029
+ #
1030
+ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx {{.*?}}" \
1031
+ "id:941380,\
1032
+ phase:2,\
1033
+ block,\
1034
+ capture,\
1035
+ t:none,\
1036
+ msg:'AngularJS client side template injection detected',\
1037
+ logdata:'Matched Data: Suspicious payload found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
1038
+ tag:'application-multi',\
1039
+ tag:'language-multi',\
1040
+ tag:'attack-xss',\
1041
+ tag:'xss-perf-disable',\
1042
+ tag:'paranoia-level/2',\
1043
+ tag:'OWASP_CRS',\
1044
+ tag:'capec/1000/152/242/63',\
1045
+ ver:'OWASP_CRS/4.9.0',\
1046
+ severity:'CRITICAL',\
1047
+ setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
1048
+ setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
1049
+
1050
+
1051
+
1052
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:941015,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
1053
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:941016,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
1054
+ #
1055
+ # -= Paranoia Level 3 =- (apply only when tx.detection_paranoia_level is sufficiently high: 3 or higher)
1056
+ #
1057
+
1058
+
1059
+
1060
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:941017,phase:1,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
1061
+ SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:941018,phase:2,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.9.0',skipAfter:END-REQUEST-941-APPLICATION-ATTACK-XSS"
1062
+ #
1063
+ # -= Paranoia Level 4 =- (apply only when tx.detection_paranoia_level is sufficiently high: 4 or higher)
1064
+ #
1065
+
1066
+
1067
+
1068
+ #
1069
+ # -= Paranoia Levels Finished =-
1070
+ #
1071
+ SecMarker "END-REQUEST-941-APPLICATION-ATTACK-XSS"