diff --git a/Dockerfile b/Dockerfile
index 470bb2d..7beaf91 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,7 @@ RUN apk --no-cache add php7-fpm certbot libstdc++ libmaxminddb geoip pcre yajl &
mkdir /www && \
adduser -h /dev/null -g '' -s /sbin/nologin -D -H nginx
-VOLUME /www /confs
+VOLUME /www /http-confs /server-confs /modsec-confs /modsec-crs-confs
EXPOSE 80/tcp 443/tcp
diff --git a/confs/modsecurity-rules.conf b/confs/modsecurity-rules.conf
index bf74b09..bdfc18f 100644
--- a/confs/modsecurity-rules.conf
+++ b/confs/modsecurity-rules.conf
@@ -54,6 +54,10 @@ SecAuditLogRelevantStatus "^(?:5|4(?!04))"
SecAuditLogType Serial
SecAuditLog /var/log/modsec_audit.log
+# include custom rules
+%MODSECURITY_INCLUDE_CUSTOM_RULES%
+
# include OWASP CRS rules
-include /etc/nginx/owasp-crs.conf
-include /etc/nginx/owasp-crs/*.conf
+%MODSECURITY_INCLUDE_CRS%
+%MODSECURITY_INCLUDE_CUSTOM_CRS%
+%MODSECURITY_INCLUDE_CRS_RULES%
diff --git a/confs/nginx.conf b/confs/nginx.conf
index f9e708e..b2350cc 100644
--- a/confs/nginx.conf
+++ b/confs/nginx.conf
@@ -75,4 +75,7 @@ http {
# enable/disable ModSecurity
%USE_MODSECURITY%
+
+ # custom http confs
+ include /http-confs/*.conf;
}
diff --git a/confs/owasp-crs.conf b/confs/owasp-crs.conf
index bfc2395..8c0d4eb 100644
--- a/confs/owasp-crs.conf
+++ b/confs/owasp-crs.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -354,11 +354,12 @@ SecDefaultAction "phase:2,log,auditlog,pass"
# nolog,\
# pass,\
# t:none,\
+# setvar:tx.crs_exclusions_cpanel=1,\
# setvar:tx.crs_exclusions_drupal=1,\
-# setvar:tx.crs_exclusions_wordpress=1,\
-# setvar:tx.crs_exclusions_nextcloud=1,\
# setvar:tx.crs_exclusions_dokuwiki=1,\
-# setvar:tx.crs_exclusions_cpanel=1"
+# setvar:tx.crs_exclusions_nextcloud=1,\
+# setvar:tx.crs_exclusions_wordpress=1,\
+# setvar:tx.crs_exclusions_xenforo=1"
#
# -- [[ HTTP Policy Settings ]] ------------------------------------------------
@@ -389,7 +390,8 @@ SecDefaultAction "phase:2,log,auditlog,pass"
# Content-Types that a client is allowed to send in a request.
# Default: application/x-www-form-urlencoded|multipart/form-data|text/xml|\
# application/xml|application/soap+xml|application/x-amf|application/json|\
-# application/octet-stream|text/plain
+# application/octet-stream|application/csp-report|\
+# application/xss-auditor-report|text/plain
# Uncomment this rule to change the default.
#SecAction \
# "id:900220,\
@@ -397,20 +399,7 @@ SecDefaultAction "phase:2,log,auditlog,pass"
# nolog,\
# pass,\
# t:none,\
-# setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/soap+xml|application/x-amf|application/json|application/octet-stream|text/plain'"
-
-# Content-Types charsets that a client is allowed to send in a request.
-# Default: utf-8|iso-8859-1|iso-8859-15|windows-1252
-# Uncomment this rule to change the default.
-# Use "|" to separate multiple charsets like in the rule defining
-# tx.allowed_request_content_type.
-#SecAction \
-# "id:900270,\
-# phase:1,\
-# nolog,\
-# pass,\
-# t:none,\
-# setvar:'tx.allowed_request_content_type_charset=utf-8|iso-8859-1|iso-8859-15|windows-1252'"
+# setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/soap+xml|application/x-amf|application/json|application/octet-stream|application/csp-report|application/xss-auditor-report|text/plain'"
# Allowed HTTP versions.
# Default: HTTP/1.0 HTTP/1.1 HTTP/2 HTTP/2.0
@@ -428,8 +417,8 @@ SecDefaultAction "phase:2,log,auditlog,pass"
# Forbidden file extensions.
# Guards against unintended exposure of development/configuration files.
-# Default: .asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/
-# Example: .bak/ .config/ .conf/ .db/ .ini/ .log/ .old/ .pass/ .pdb/ .sql/
+# Default: .asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .rdb/ .resources/ .resx/ .sql/ .swp/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/
+# Example: .bak/ .config/ .conf/ .db/ .ini/ .log/ .old/ .pass/ .pdb/ .rdb/ .sql/
# Uncomment this rule to change the default.
#SecAction \
# "id:900240,\
@@ -437,7 +426,7 @@ SecDefaultAction "phase:2,log,auditlog,pass"
# nolog,\
# pass,\
# t:none,\
-# setvar:'tx.restricted_extensions=.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/'"
+# setvar:'tx.restricted_extensions=.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .rdb/ .resources/ .resx/ .sql/ .swp/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/'"
# Forbidden request headers.
# Header names should be lowercase, enclosed by /slashes/ as delimiters.
@@ -465,6 +454,18 @@ SecDefaultAction "phase:2,log,auditlog,pass"
# t:none,\
# setvar:'tx.static_extensions=/.jpg/ /.jpeg/ /.png/ /.gif/ /.js/ /.css/ /.ico/ /.svg/ /.webp/'"
+# Content-Types charsets that a client is allowed to send in a request.
+# Default: utf-8|iso-8859-1|iso-8859-15|windows-1252
+# Uncomment this rule to change the default.
+# Use "|" to separate multiple charsets like in the rule defining
+# tx.allowed_request_content_type.
+#SecAction \
+# "id:900280,\
+# phase:1,\
+# nolog,\
+# pass,\
+# t:none,\
+# setvar:'tx.allowed_request_content_type_charset=utf-8|iso-8859-1|iso-8859-15|windows-1252'"
#
# -- [[ HTTP Argument/Upload Limits ]] -----------------------------------------
@@ -779,52 +780,6 @@ SecDefaultAction "phase:2,log,auditlog,pass"
SecCollectionTimeout 600
-#
-# -- [[ Debug Mode ]] ----------------------------------------------------------
-#
-# To enable rule development and debugging, CRS has an optional debug mode
-# that does not block a request, but instead sends detection information
-# back to the HTTP client.
-#
-# This functionality is currently only supported with the Apache web server.
-# The Apache mod_headers module is required.
-#
-# In debug mode, the webserver inserts "X-WAF-Events" / "X-WAF-Score"
-# response headers whenever a debug client makes a request. Example:
-#
-# # curl -v 'http://192.168.1.100/?foo=../etc/passwd'
-# X-WAF-Events: TX:930110-OWASP_CRS/WEB_ATTACK/DIR_TRAVERSAL-REQUEST_URI,
-# TX:930120-OWASP_CRS/WEB_ATTACK/FILE_INJECTION-ARGS:foo,
-# TX:932160-OWASP_CRS/WEB_ATTACK/RCE-ARGS:foo
-# X-WAF-Score: Total=15; sqli=0; xss=0; rfi=0; lfi=10; rce=5; php=0; http=0; ses=0
-#
-# To enable debug mode, include the RESPONSE-981-DEBUG.conf file.
-# This file resides in a separate folder, as it is not compatible with
-# nginx and IIS.
-#
-# You must specify the source IP address/network where you will be running the
-# tests from. The source IP will BYPASS all CRS blocking, and will be sent the
-# response headers as specified above. Be careful to only list your private
-# IP addresses/networks here.
-#
-# Tip: for regression testing of CRS or your own ModSecurity rules, you may
-# be interested in using the OWASP CRS regression testing suite instead.
-# View the file util/regression-tests/README for more information.
-#
-# Uncomment these rules, filling in your CRS path and the source IP address,
-# to enable debug mode:
-#
-#Include /path/to/crs/util/debug/RESPONSE-981-DEBUG.conf
-#SecRule REMOTE_ADDR "@ipMatch 192.168.1.100" \
-# "id:900980,\
-# phase:1,\
-# nolog,\
-# pass,\
-# t:none,\
-# ctl:ruleEngine=DetectionOnly,\
-# setvar:tx.crs_debug_mode=1"
-
-
#
# -- [[ End of setup ]] --------------------------------------------------------
#
@@ -842,4 +797,4 @@ SecAction \
nolog,\
pass,\
t:none,\
- setvar:tx.crs_setup_version=311"
+ setvar:tx.crs_setup_version=320"
diff --git a/confs/owasp-crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example b/confs/owasp-crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example
index bd23616..1fb97cc 100644
--- a/confs/owasp-crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example
+++ b/confs/owasp-crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -141,7 +141,7 @@
# phase:2,\
# pass,\
# nolog,\
-# ctl:ruleRemoveTargetByTag=CRS;ARGS:pwd"
+# ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pwd"
#
# Example Exclusion Rule: Removing a range of rules
diff --git a/confs/owasp-crs/REQUEST-901-INITIALIZATION.conf b/confs/owasp-crs/REQUEST-901-INITIALIZATION.conf
index b893794..ec55d00 100644
--- a/confs/owasp-crs/REQUEST-901-INITIALIZATION.conf
+++ b/confs/owasp-crs/REQUEST-901-INITIALIZATION.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -21,11 +21,11 @@
#
# Rule version data is added to the "Producer" line of Section H of the Audit log:
#
-# - Producer: ModSecurity for Apache/2.9.3 (http://www.modsecurity.org/); OWASP_CRS/3.1.1.
+# - Producer: ModSecurity for Apache/2.9.1 (http://www.modsecurity.org/); OWASP_CRS/3.1.0.
#
# Ref: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#wiki-SecComponentSignature
#
-SecComponentSignature "OWASP_CRS/3.1.1"
+SecComponentSignature "OWASP_CRS/3.2.0"
#
# -=[ Default setup values ]=-
@@ -168,7 +168,7 @@ SecRule &TX:allowed_request_content_type "@eq 0" \
phase:1,\
pass,\
nolog,\
- setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/soap+xml|application/x-amf|application/json|application/octet-stream|text/plain'"
+ setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/soap+xml|application/x-amf|application/json|application/octet-stream|application/csp-report|application/xss-auditor-report|text/plain'"
# Default HTTP policy: allowed_request_content_type_charset (rule 900270)
SecRule &TX:allowed_request_content_type_charset "@eq 0" \
@@ -192,7 +192,7 @@ SecRule &TX:restricted_extensions "@eq 0" \
phase:1,\
pass,\
nolog,\
- setvar:'tx.restricted_extensions=.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/'"
+ setvar:'tx.restricted_extensions=.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .rdb/ .resources/ .resx/ .sql/ .swp/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/'"
# Default HTTP policy: restricted_headers (rule 900250)
SecRule &TX:restricted_headers "@eq 0" \
@@ -218,7 +218,6 @@ SecRule &TX:enforce_bodyproc_urlencoded "@eq 0" \
nolog,\
setvar:'tx.enforce_bodyproc_urlencoded=0'"
-
#
# -=[ Initialize internal variables ]=-
#
@@ -298,7 +297,7 @@ SecRule REQBODY_PROCESSOR "!@rx (?:URLENCODED|MULTIPART|XML|JSON)" \
msg:'Enabling body inspection',\
tag:'paranoia-level/1',\
ctl:forceRequestBodyVariable=On,\
- ver:'OWASP_CRS/3.1.1'"
+ ver:'OWASP_CRS/3.2.0'"
# Force body processor URLENCODED
SecRule TX:enforce_bodyproc_urlencoded "@eq 1" \
@@ -309,7 +308,7 @@ SecRule TX:enforce_bodyproc_urlencoded "@eq 1" \
nolog,\
noauditlog,\
msg:'Enabling forced body inspection for ASCII content',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
chain"
SecRule REQBODY_PROCESSOR "!@rx (?:URLENCODED|MULTIPART|XML|JSON)" \
"ctl:requestBodyProcessor=URLENCODED"
diff --git a/confs/owasp-crs/REQUEST-903.9001-DRUPAL-EXCLUSION-RULES.conf b/confs/owasp-crs/REQUEST-903.9001-DRUPAL-EXCLUSION-RULES.conf
index 1f511c3..0ba5a68 100644
--- a/confs/owasp-crs/REQUEST-903.9001-DRUPAL-EXCLUSION-RULES.conf
+++ b/confs/owasp-crs/REQUEST-903.9001-DRUPAL-EXCLUSION-RULES.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -117,8 +117,8 @@ SecRule REQUEST_FILENAME "@endsWith /core/install.php" \
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:account[pass][pass1],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:account[pass][pass2]"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:account[pass][pass1],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:account[pass][pass2]"
SecRule REQUEST_FILENAME "@endsWith /user/login" \
"id:9001112,\
@@ -126,24 +126,24 @@ SecRule REQUEST_FILENAME "@endsWith /user/login" \
pass,\
t:none,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass"
SecRule REQUEST_FILENAME "@endsWith /admin/people/create" \
"id:9001114,\
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass[pass1],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass[pass2]"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass[pass1],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass[pass2]"
SecRule REQUEST_FILENAME "@rx /user/[0-9]+/edit$" \
"id:9001116,\
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:current_pass,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass[pass1],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass[pass2]"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:current_pass,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass[pass1],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass[pass2]"
#
@@ -171,14 +171,14 @@ SecRule REQUEST_FILENAME "@endsWith /admin/config/people/accounts" \
nolog,\
ctl:ruleRemoveById=920271,\
ctl:ruleRemoveById=942440,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_cancel_confirm_body,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_password_reset_body,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_register_admin_created_body,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_register_no_approval_required_body,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_register_pending_approval_body,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_status_activated_body,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_status_blocked_body,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:user_mail_status_canceled_body"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_cancel_confirm_body,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_password_reset_body,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_register_admin_created_body,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_register_no_approval_required_body,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_register_pending_approval_body,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_status_activated_body,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_status_blocked_body,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:user_mail_status_canceled_body"
SecRule REQUEST_FILENAME "@endsWith /admin/config/development/configuration/single/import" \
"id:9001126,\
@@ -242,8 +242,8 @@ SecRule REQUEST_FILENAME "@endsWith /admin/config/content/formats/manage/full_ht
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:editor[settings][toolbar][button_groups],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:filters[filter_html][settings][allowed_html]"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:editor[settings][toolbar][button_groups],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:filters[filter_html][settings][allowed_html]"
#
@@ -296,7 +296,7 @@ SecRule REQUEST_METHOD "@streq POST" \
"chain"
SecRule REQUEST_HEADERS:Content-Length "@gt 31486341" \
"chain"
- SecRule REQUEST_HEADERS:Content-Type "@rx ^(?i)multipart/form-data" \
+ SecRule REQUEST_HEADERS:Content-Type "@rx ^(?i)multipart/form-data" \
"chain"
SecRule REQUEST_COOKIES:/S?SESS[a-f0-9]+/ "@rx ^[a-zA-Z0-9_-]+" \
"ctl:requestBodyAccess=Off"
@@ -316,7 +316,7 @@ SecRule REQUEST_FILENAME "@endsWith /node/add/article" \
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:body[0][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:body[0][value],\
ctl:ruleRemoveTargetById=942410;ARGS:uid[0][target_id]"
SecRule REQUEST_FILENAME "@endsWith /node/add/page" \
@@ -324,7 +324,7 @@ SecRule REQUEST_FILENAME "@endsWith /node/add/page" \
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:body[0][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:body[0][value],\
ctl:ruleRemoveTargetById=942410;ARGS:uid[0][target_id]"
SecRule REQUEST_FILENAME "@rx /node/[0-9]+/edit$" \
@@ -332,7 +332,7 @@ SecRule REQUEST_FILENAME "@rx /node/[0-9]+/edit$" \
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:body[0][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:body[0][value],\
ctl:ruleRemoveTargetById=942410;ARGS:uid[0][target_id],\
ctl:ruleRemoveTargetById=932110;ARGS:destination"
@@ -341,42 +341,42 @@ SecRule REQUEST_FILENAME "@endsWith /block/add" \
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:body[0][value]"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:body[0][value]"
SecRule REQUEST_FILENAME "@endsWith /admin/structure/block/block-content/manage/basic" \
"id:9001208,\
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:description"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:description"
SecRule REQUEST_FILENAME "@rx /editor/filter_xss/(?:full|basic)_html$" \
"id:9001210,\
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:value"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:value"
SecRule REQUEST_FILENAME "@rx /user/[0-9]+/contact$" \
"id:9001212,\
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:message[0][value]"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message[0][value]"
SecRule REQUEST_FILENAME "@endsWith /admin/config/development/maintenance" \
"id:9001214,\
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:maintenance_mode_message"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:maintenance_mode_message"
SecRule REQUEST_FILENAME "@endsWith /admin/config/services/rss-publishing" \
"id:9001216,\
phase:2,\
pass,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:feed_description"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:feed_description"
SecMarker "END-DRUPAL-RULE-EXCLUSIONS"
diff --git a/confs/owasp-crs/REQUEST-903.9002-WORDPRESS-EXCLUSION-RULES.conf b/confs/owasp-crs/REQUEST-903.9002-WORDPRESS-EXCLUSION-RULES.conf
index 7d8fff7..92c24c0 100644
--- a/confs/owasp-crs/REQUEST-903.9002-WORDPRESS-EXCLUSION-RULES.conf
+++ b/confs/owasp-crs/REQUEST-903.9002-WORDPRESS-EXCLUSION-RULES.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -49,7 +49,7 @@ SecRule REQUEST_FILENAME "@endsWith /wp-login.php" \
pass,\
t:none,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pwd"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pwd"
# Reset password
SecRule REQUEST_FILENAME "@endsWith /wp-login.php" \
@@ -64,9 +64,9 @@ SecRule REQUEST_FILENAME "@endsWith /wp-login.php" \
chain"
SecRule &ARGS:action "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1-text,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass2"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1-text,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass2"
#
@@ -83,6 +83,38 @@ SecRule REQUEST_FILENAME "@endsWith /wp-comments-post.php" \
ctl:ruleRemoveTargetById=931130;ARGS:url"
+#
+# [ Gutenberg Editor ]
+# Used when a user (auto)saves a post/page with Gutenberg.
+#
+
+# Gutenberg
+SecRule REQUEST_FILENAME "@rx ^/wp\-json/wp/v[0-9]+/(?:posts|pages)" \
+ "id:9002140,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:content,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:json.content"
+
+# Gutenberg via rest_route for sites without pretty permalinks
+SecRule REQUEST_FILENAME "@endsWith /index.php" \
+ "id:9002141,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ chain"
+ SecRule &ARGS:rest_route "@eq 1" \
+ "t:none,\
+ nolog,\
+ chain"
+ SecRule ARGS:rest_route "@rx ^/wp/v[0-9]+/(?:posts|pages)" \
+ "t:none,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:content,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:json.content"
+
#
# [ Live preview ]
# Used when an administrator customizes the site and previews the result
@@ -221,7 +253,7 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/setup-config.php" \
chain"
SecRule &ARGS:step "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pwd"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pwd"
# WordPress installation: exclude admin password
SecRule REQUEST_FILENAME "@endsWith /wp-admin/install.php" \
@@ -236,9 +268,9 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/install.php" \
chain"
SecRule &ARGS:step "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:admin_password,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:admin_password2,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1-text"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:admin_password,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:admin_password2,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1-text"
#
@@ -261,9 +293,11 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/profile.php" \
ctl:ruleRemoveTargetById=931130;ARGS:url,\
ctl:ruleRemoveTargetById=931130;ARGS:facebook,\
ctl:ruleRemoveTargetById=931130;ARGS:googleplus,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1-text,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass2"
+ ctl:ruleRemoveTargetById=931130;ARGS:instagram,\
+ ctl:ruleRemoveTargetById=931130;ARGS:linkedin,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1-text,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass2"
# Edit user
SecRule REQUEST_FILENAME "@endsWith /wp-admin/user-edit.php" \
@@ -279,9 +313,9 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/user-edit.php" \
SecRule &ARGS:action "@eq 1" \
"t:none,\
ctl:ruleRemoveTargetById=931130;ARGS:url,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1-text,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass2"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1-text,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass2"
# Create user
SecRule REQUEST_FILENAME "@endsWith /wp-admin/user-new.php" \
@@ -297,9 +331,9 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/user-new.php" \
SecRule &ARGS:action "@eq 1" \
"t:none,\
ctl:ruleRemoveTargetById=931130;ARGS:url,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1-text,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass2"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1-text,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass2"
#
@@ -321,6 +355,7 @@ SecAction \
ctl:ruleRemoveTargetById=942200;ARGS:_wp_http_referer,\
ctl:ruleRemoveTargetById=942260;ARGS:_wp_http_referer,\
ctl:ruleRemoveTargetById=942431;ARGS:_wp_http_referer,\
+ ctl:ruleRemoveTargetById=942440;ARGS:_wp_http_referer,\
ctl:ruleRemoveTargetById=920230;ARGS:wp_http_referer,\
ctl:ruleRemoveTargetById=931130;ARGS:wp_http_referer,\
ctl:ruleRemoveTargetById=932150;ARGS:wp_http_referer,\
@@ -352,7 +387,7 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/post.php" \
SecRule &ARGS:action "@eq 1" \
"t:none,\
ctl:ruleRemoveTargetByTag=attack-sqli;ARGS:post_title,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:content,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:content,\
ctl:ruleRemoveById=920272,\
ctl:ruleRemoveById=921180"
@@ -371,7 +406,7 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/admin-ajax.php" \
SecRule &ARGS:action "@eq 1" \
"t:none,\
ctl:ruleRemoveTargetByTag=attack-sqli;ARGS:data[wp_autosave][post_title],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:data[wp_autosave][content],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:data[wp_autosave][content],\
ctl:ruleRemoveTargetById=942431;ARGS_NAMES:data[wp-refresh-post-lock][post_id],\
ctl:ruleRemoveTargetById=942431;ARGS_NAMES:data[wp-refresh-post-lock][lock],\
ctl:ruleRemoveTargetById=942431;ARGS_NAMES:data[wp-check-locked-posts][],\
@@ -415,46 +450,46 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/admin-ajax.php" \
chain"
SecRule &ARGS:action "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[0][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[1][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[2][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[3][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[4][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[5][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[6][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[7][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[8][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[9][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[10][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[11][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[12][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[13][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[14][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[15][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[16][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[17][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[18][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[19][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[20][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[21][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[22][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[23][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[24][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[25][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[26][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[27][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[28][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[29][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[30][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[31][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[32][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[33][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[34][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[35][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[36][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[37][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[38][text],\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-text[39][text]"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[0][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[1][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[2][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[3][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[4][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[5][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[6][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[7][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[8][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[9][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[10][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[11][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[12][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[13][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[14][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[15][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[16][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[17][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[18][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[19][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[20][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[21][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[22][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[23][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[24][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[25][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[26][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[27][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[28][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[29][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[30][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[31][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[32][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[33][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[34][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[35][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[36][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[37][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[38][text],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:widget-text[39][text]"
# Reorder widgets
SecRule REQUEST_FILENAME "@endsWith /wp-admin/admin-ajax.php" \
@@ -527,7 +562,7 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/admin-ajax.php" \
chain"
SecRule &ARGS:action "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:html"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:html"
#
@@ -591,8 +626,17 @@ SecRule REQUEST_FILENAME "@endsWith /wp-admin/options.php" \
chain"
SecRule &ARGS:action "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:blacklist_keys,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:moderation_keys"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:blacklist_keys,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:moderation_keys"
+
+# Posts/pages overview search
+SecRule REQUEST_FILENAME "@endsWith /wp-admin/edit.php" \
+ "id:9002830,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:s"
#
diff --git a/confs/owasp-crs/REQUEST-903.9003-NEXTCLOUD-EXCLUSION-RULES.conf b/confs/owasp-crs/REQUEST-903.9003-NEXTCLOUD-EXCLUSION-RULES.conf
index f667c5f..e1dca51 100644
--- a/confs/owasp-crs/REQUEST-903.9003-NEXTCLOUD-EXCLUSION-RULES.conf
+++ b/confs/owasp-crs/REQUEST-903.9003-NEXTCLOUD-EXCLUSION-RULES.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -123,7 +123,7 @@ SecRule REQUEST_METHOD "@streq PUT" \
chain"
SecRule REQUEST_FILENAME "@rx (?:/public\.php/webdav/|/remote\.php/dav/uploads/)" \
"ctl:ruleRemoveById=920340,\
- ctl:ruleRemoveById=920420"
+ ctl:ruleRemoveById=920420"
# Allow characters like /../ in files.
@@ -243,7 +243,7 @@ SecRule REQUEST_FILENAME "@contains /index.php/apps/files_texteditor/" \
pass,\
t:none,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:filecontents,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:filecontents,\
ctl:ruleRemoveTargetById=921110-921160;ARGS:filecontents,\
ctl:ruleRemoveTargetById=932150;ARGS:filename,\
ctl:ruleRemoveTargetById=920370-920390;ARGS:filecontents,\
@@ -318,7 +318,7 @@ SecRule REQUEST_FILENAME "@contains /index.php/login" \
t:none,\
nolog,\
ctl:ruleRemoveTargetById=941100;ARGS:requesttoken,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:password"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:password"
# Reset password.
@@ -334,9 +334,9 @@ SecRule REQUEST_FILENAME "@endsWith /index.php/login" \
chain"
SecRule &ARGS:action "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1-text,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass2"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1-text,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass2"
# Change Password and Setting up a new user/password
@@ -346,8 +346,8 @@ SecRule REQUEST_FILENAME "@endsWith /index.php/settings/users" \
pass,\
t:none,\
nolog,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:newuserpassword,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:password"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:newuserpassword,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:password"
SecMarker "END-NEXTCLOUD-ADMIN"
diff --git a/confs/owasp-crs/REQUEST-903.9004-DOKUWIKI-EXCLUSION-RULES.conf b/confs/owasp-crs/REQUEST-903.9004-DOKUWIKI-EXCLUSION-RULES.conf
index dfb180f..a0b5dd2 100644
--- a/confs/owasp-crs/REQUEST-903.9004-DOKUWIKI-EXCLUSION-RULES.conf
+++ b/confs/owasp-crs/REQUEST-903.9004-DOKUWIKI-EXCLUSION-RULES.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -85,17 +85,17 @@ SecRule REQUEST_FILENAME "@rx (?:/doku.php|/lib/exe/ajax.php)$" \
SecRule REQUEST_COOKIES:/S?DW[a-f0-9]+/ "@rx ^[%a-zA-Z0-9_-]+" \
"t:none,\
ctl:ruleRemoveTargetByTag=attack-protocol;ARGS:wikitext,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:wikitext,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:wikitext,\
ctl:ruleRemoveTargetByTag=attack-protocol;ARGS:suffix,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:suffix,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:suffix,\
ctl:ruleRemoveTargetByTag=attack-protocol;ARGS:prefix,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:prefix,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:prefix,\
ctl:ruleRemoveTargetById=930100-930110;REQUEST_BODY"
# Allow it to upload files. But check for cookies just to make sure.
-SecRule REQUEST_FILENAME "@endsWith /lib/exe/ajax.php"\
+SecRule REQUEST_FILENAME "@endsWith /lib/exe/ajax.php" \
"id:9004110,\
phase:2,\
pass,\
@@ -113,7 +113,7 @@ SecRule REQUEST_FILENAME "@endsWith /lib/exe/ajax.php"\
# Show the index, even if things like "postgresql" or other things show up.
-SecRule REQUEST_FILENAME "@endsWith /doku.php"\
+SecRule REQUEST_FILENAME "@endsWith /doku.php" \
"id:9004130,\
phase:2,\
pass,\
@@ -137,7 +137,7 @@ SecRule REQUEST_FILENAME "@endsWith /doku.php"\
# Turn off checks for password.
SecRule REQUEST_FILENAME "@endsWith /doku.php" \
- "id:9004200,\
+ "id:9004200,\
phase:2,\
pass,\
t:none,\
@@ -149,7 +149,7 @@ SecRule REQUEST_FILENAME "@endsWith /doku.php" \
chain"
SecRule &ARGS:do "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:p"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:p"
#
@@ -188,12 +188,12 @@ SecRule REQUEST_FILENAME "@endsWith /doku.php" \
chain"
SecRule ARGS:do "@streq login" \
"t:none,\
- chain"
+ chain"
SecRule &ARGS:do "@eq 1" \
"t:none,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass1-text,\
- ctl:ruleRemoveTargetByTag=CRS;ARGS:pass2"
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass1-text,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:pass2"
# [ Save config ]
diff --git a/confs/owasp-crs/REQUEST-903.9005-CPANEL-EXCLUSION-RULES.conf b/confs/owasp-crs/REQUEST-903.9005-CPANEL-EXCLUSION-RULES.conf
index 1553364..46d6762 100644
--- a/confs/owasp-crs/REQUEST-903.9005-CPANEL-EXCLUSION-RULES.conf
+++ b/confs/owasp-crs/REQUEST-903.9005-CPANEL-EXCLUSION-RULES.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
diff --git a/confs/owasp-crs/REQUEST-903.9006-XENFORO-EXCLUSION-RULES.conf b/confs/owasp-crs/REQUEST-903.9006-XENFORO-EXCLUSION-RULES.conf
new file mode 100644
index 0000000..2ce34c7
--- /dev/null
+++ b/confs/owasp-crs/REQUEST-903.9006-XENFORO-EXCLUSION-RULES.conf
@@ -0,0 +1,509 @@
+# ------------------------------------------------------------------------
+# OWASP ModSecurity Core Rule Set ver.3.2.0
+# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
+#
+# The OWASP ModSecurity Core Rule Set is distributed under
+# Apache Software License (ASL) version 2
+# Please see the enclosed LICENSE file for full details.
+# ------------------------------------------------------------------------
+
+# These exclusions remedy false positives in a default XenForo install.
+# The exclusions are only active if crs_exclusions_xenforo=1 is set.
+# See rule 900130 in crs-setup.conf.example for instructions.
+
+SecRule &TX:crs_exclusions_xenforo|TX:crs_exclusions_xenforo "@eq 0" \
+ "id:9006000,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ skipAfter:END-XENFORO"
+
+SecRule &TX:crs_exclusions_xenforo|TX:crs_exclusions_xenforo "@eq 0" \
+ "id:9006001,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ skipAfter:END-XENFORO"
+
+
+#
+# -=[ XenForo Front-End ]=-
+#
+
+# Proxy for images and remote content embedded in forum posts
+# GET /xf/proxy.php?image=https://example.com/some.jpg&hash=foo
+# GET /xf/proxy.php?link=https://example.com&hash=foo
+# POST /xf/proxy.php, body: referrer=...
+SecRule REQUEST_FILENAME "@endsWith /proxy.php" \
+ "id:9006100,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:image,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:link,\
+ ctl:ruleRemoveTargetById=931130;ARGS:referrer,\
+ ctl:ruleRemoveTargetById=942230;ARGS:referrer"
+
+# Store drafts for private message, forum post, thread reply
+# POST /xf/conversations/draft
+# POST /xf/conversations/convo-title.12345/draft
+# POST /xf/forums/forum-title.12345/draft
+# POST /xf/threads/thread-title-%E2%98%85.12345/draft
+#
+# attachment_hash_combined example:
+# {"type":"post","context":{"post_id":12345},"hash":"0123456789abcdef..."}
+SecRule REQUEST_FILENAME "@rx /(?:conversations|(?:conversations|forums|threads)/.*\.\d+)/draft$" \
+ "id:9006110,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetById=931130;ARGS:href,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:title,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message_html,\
+ ctl:ruleRemoveTargetById=942200;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942260;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942340;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942370;ARGS:attachment_hash_combined"
+
+# Send PM, edit post, create thread, reply to thread
+# POST /xf/conversations/add
+# POST /xf/conversations/add-preview
+# POST /xf/conversations/messages/1463947/edit
+# POST /xf/posts/12345/edit
+# POST /xf/posts/12345/preview
+# POST /xf/conversations/convo-title.12345/add-reply
+# POST /xf/threads/thread-title.12345/add-reply
+# POST /xf/threads/thread-title.12345/reply-preview
+# POST /xf/forums/forum-title.12345/post-thread
+# POST /xf/forums/forum-title.12345/thread-preview
+SecRule REQUEST_FILENAME "@rx /(?:conversations/add(?:-preview)?|conversations/messages/\d+/edit|posts/\d+/(?:edit|preview)|(?:conversations|threads)/.*\.\d+/(?:add-reply|reply-preview)|forums/.*\.\d+/(?:post-thread|thread-preview))$" \
+ "id:9006120,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:title,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message_html,\
+ ctl:ruleRemoveTargetById=942200;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942260;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942340;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942370;ARGS:attachment_hash_combined"
+
+# Quote
+# POST /xf/posts/12345/quote
+SecRule REQUEST_FILENAME "@rx /posts/\d+/quote$" \
+ "id:9006130,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:quoteHtml"
+
+# Multi quote
+# POST /xf/conversations/convo-title.12345/multi-quote
+# POST /xf/threads/thread-title.12345/multi-quote
+# quotes={"12345":["quote-html"]}
+SecRule REQUEST_FILENAME "@rx /(?:conversations|threads)/.*\.\d+/multi-quote$" \
+ "id:9006140,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:quotes,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[0][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[1][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[2][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[3][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[4][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[5][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[6][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[7][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[8][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:insert[9][value]"
+
+# Delete thread
+SecRule REQUEST_FILENAME "@rx /threads/.*\.\d+/delete$" \
+ "id:9006150,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetById=942130;ARGS:starter_alert_reason"
+
+# Inline moderate thread
+# POST /xf/inline-mod/
+SecRule REQUEST_FILENAME "@streq /inline-mod/" \
+ "id:9006160,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message"
+
+# Warn member
+# POST /xf/members/name.12345/warn
+SecRule REQUEST_FILENAME "@rx /members/\*\.\d+/warn$" \
+ "id:9006170,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:conversation_message,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:notes"
+
+# Editor
+SecRule REQUEST_URI "@endsWith /index.php?editor/to-html" \
+ "id:9006200,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:bb_code,\
+ ctl:ruleRemoveTargetById=942200;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942260;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942340;ARGS:attachment_hash_combined,\
+ ctl:ruleRemoveTargetById=942370;ARGS:attachment_hash_combined"
+
+# Editor
+SecRule REQUEST_URI "@endsWith /index.php?editor/to-bb-code" \
+ "id:9006210,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:html"
+
+# Post attachment
+# POST /xf/account/avatar
+# POST /xf/attachments/upload?type=post&context[thread_id]=12345&hash=foo
+SecRule REQUEST_FILENAME "@rx /(?:account/avatar|attachments/upload)$" \
+ "id:9006220,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveById=200003,\
+ ctl:ruleRemoveTargetById=942220;ARGS:flowChunkSize,\
+ ctl:ruleRemoveTargetById=942440;ARGS:flowIdentifier,\
+ ctl:ruleRemoveTargetById=942440;ARGS:flowFilename,\
+ ctl:ruleRemoveTargetById=942440;ARGS:flowRelativePath"
+
+# Media
+# POST /xf/index.php?editor/media
+SecRule REQUEST_URI "@endsWith /index.php?editor/media" \
+ "id:9006230,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetById=931130;ARGS:url,\
+ ctl:ruleRemoveTargetById=942130;ARGS:url"
+
+# Emoji
+# GET /xf/index.php?misc/find-emoji&q=(%0A%0A
+SecRule REQUEST_URI "@rx /index\.php\?misc/find-emoji&q=" \
+ "id:9006240,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetById=921151;ARGS:q"
+
+# Login
+# POST /xf/login/login
+SecRule REQUEST_FILENAME "@endsWith /login/login" \
+ "id:9006300,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:password"
+
+# Register account
+# POST /xf/register/register
+# The password is passed in a variable-name form parameter. We don't
+# want to exclude all parameters completely as this would cause an
+# unacceptable bypass. So, we exclude only commonly hit rules.
+SecRule REQUEST_FILENAME "@endsWith /register/register" \
+ "id:9006310,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetById=942130;ARGS,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:reg_key"
+
+# Edit account
+# POST /xf/account/account-details
+SecRule REQUEST_FILENAME "@endsWith /account/account-details" \
+ "id:9006320,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetById=931130;ARGS:custom_fields[picture],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:about_html"
+
+# Lost password
+# POST /xf/lost-password/user-name.12345/confirm?c=foo
+SecRule REQUEST_FILENAME "@rx /lost-password/.*\.\d+/confirm$" \
+ "id:9006330,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:c"
+
+# Set forum signature
+# POST /xf/account/signature
+SecRule REQUEST_FILENAME "@endsWith /account/signature" \
+ "id:9006340,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:signature_html"
+
+# Search
+# POST /xf/search/search
+SecRule REQUEST_FILENAME "@endsWith /search/search" \
+ "id:9006400,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:keywords,\
+ ctl:ruleRemoveTargetById=942200;ARGS:constraints,\
+ ctl:ruleRemoveTargetById=942260;ARGS:constraints,\
+ ctl:ruleRemoveTargetById=942340;ARGS:constraints,\
+ ctl:ruleRemoveTargetById=942370;ARGS:constraints"
+
+# Search within thread
+# GET /xf/threads/foo.12345/page12?highlight=foo
+SecRule REQUEST_FILENAME "@rx /threads/.*\.\d+/(?:page\d+)?$" \
+ "id:9006410,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:highlight"
+
+# Search within search result
+# GET /xf/search/12345/?q=foo
+SecRule REQUEST_FILENAME "@rx /search/\d+/$" \
+ "id:9006420,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:q"
+
+# Contact form
+# POST /xf/misc/contact
+SecRule REQUEST_FILENAME "@endsWith /misc/contact" \
+ "id:9006500,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:subject"
+
+# Report post
+# POST /xf/posts/12345/report
+SecRule REQUEST_FILENAME "@rx /posts/\d+/report$" \
+ "id:9006510,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message"
+
+# Alternate thread view route
+# /xf/index.php?threads/title-having-some-sql.12345/
+#
+# Especially threads with the HAVING sql keyword are FP prone.
+# This rule has some chains to narrow down the exclusion,
+# making it harder for an attacker to abuse the ARGS_NAMES
+# exclusion on other endpoints.
+SecRule REQUEST_FILENAME "@endsWith /index.php" \
+ "id:9006600,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ chain"
+ SecRule REQUEST_METHOD "@streq GET" \
+ "t:none,\
+ chain"
+ SecRule &ARGS "@eq 1" \
+ "t:none,\
+ chain"
+ SecRule REQUEST_URI "@rx /index\.php\?threads/.*\.\d+/$" \
+ "t:none,\
+ ctl:ruleRemoveTargetById=942100;ARGS_NAMES,\
+ ctl:ruleRemoveTargetById=942230;ARGS_NAMES"
+
+# Browser fingerprint (DBTech security extension)
+# May Contain various javascript/XSS false positives
+SecRule REQUEST_URI "@endsWith /index.php?dbtech-security/fingerprint" \
+ "id:9006700,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:components[14][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:components[15][value],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:components[16][value]"
+
+# Get location info
+SecRule REQUEST_FILENAME "@endsWith /misc/location-info" \
+ "id:9006710,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:location"
+
+#
+# -=[ XenForo Global Exclusions ]=-
+#
+
+# _xfRedirect, _xfRequestUri can appear on various endpoints.
+# Cookies can appear on all endpoints.
+
+SecAction \
+ "id:9006800,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ ctl:ruleRemoveTargetById=931120;ARGS:_xfRedirect,\
+ ctl:ruleRemoveTargetById=941150;ARGS:_xfRedirect,\
+ ctl:ruleRemoveTargetById=931120;ARGS:_xfRequestUri,\
+ ctl:ruleRemoveTargetById=941150;ARGS:_xfRequestUri,\
+ ctl:ruleRemoveTargetById=942130;ARGS:_xfRequestUri,\
+ ctl:ruleRemoveTargetById=942230;ARGS:_xfRequestUri,\
+ ctl:ruleRemoveTargetById=942260;ARGS:_xfRequestUri,\
+ ctl:ruleRemoveTargetById=942100;REQUEST_COOKIES:xf_csrf,\
+ ctl:ruleRemoveTargetById=942210;REQUEST_COOKIES:xf_csrf,\
+ ctl:ruleRemoveTargetById=942440;REQUEST_COOKIES:xf_csrf,\
+ ctl:ruleRemoveTargetById=942150;REQUEST_COOKIES:xf_emoji_usage,\
+ ctl:ruleRemoveTargetById=942410;REQUEST_COOKIES:xf_emoji_usage,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;REQUEST_COOKIES:xf_ls,\
+ ctl:ruleRemoveTargetById=942100;REQUEST_COOKIES:xf_user"
+
+#
+# -=[ XenForo Administration Back-End ]=-
+#
+
+# Skip this section for performance unless requested file is admin.php
+
+SecRule REQUEST_FILENAME "!@endsWith /admin.php" \
+ "id:9006900,\
+ phase:1,\
+ pass,\
+ t:none,\
+ nolog,\
+ skipAfter:END-XENFORO-ADMIN"
+
+SecRule REQUEST_FILENAME "!@endsWith /admin.php" \
+ "id:9006901,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ skipAfter:END-XENFORO-ADMIN"
+
+# Admin edit user
+# POST /xf/admin.php?users/the-user-name.12345/edit
+SecRule REQUEST_FILENAME "@endsWith /admin.php" \
+ "id:9006910,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ chain"
+ SecRule REQUEST_URI "@rx /admin\.php\?users/.*\.\d+/edit$" \
+ "t:none,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:profile[about],\
+ ctl:ruleRemoveTargetById=931130;ARGS:profile[website]"
+
+# Admin save user
+# POST /xf/admin.php?users/the-user-name.12345/save
+SecRule REQUEST_FILENAME "@endsWith /admin.php" \
+ "id:9006920,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ chain"
+ SecRule REQUEST_URI "@rx /admin\.php\?users/.*\.\d+/save$" \
+ "t:none,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:custom_fields[occupation],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:custom_fields[personal_quote],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:profile[about],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:profile[signature],\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:custom_fields[sexuality],\
+ ctl:ruleRemoveTargetById=931130;ARGS:custom_fields[picture],\
+ ctl:ruleRemoveTargetById=931130;ARGS:profile[website]"
+
+
+# Admin edit forum notice
+# POST /xf/admin.php?notices/0/save
+# POST /xf/admin.php?notices/forum-name.12345/save
+SecRule REQUEST_FILENAME "@endsWith /admin.php" \
+ "id:9006930,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ chain"
+ SecRule REQUEST_URI "@rx /admin\.php\?notices/(?:.*\.)?\d+/save$" \
+ "t:none,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:message,\
+ ctl:ruleRemoveTargetByTag=OWASP_CRS;ARGS:title"
+
+# Admin batch thread update
+# POST /xf/admin.php?threads/batch-update/action
+SecRule REQUEST_FILENAME "@endsWith /admin.php" \
+ "id:9006940,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ chain"
+ SecRule REQUEST_URI "@rx /admin\.php\?threads/batch-update/action$" \
+ "t:none,\
+ ctl:ruleRemoveTargetById=942200;ARGS:criteria,\
+ ctl:ruleRemoveTargetById=942260;ARGS:criteria,\
+ ctl:ruleRemoveTargetById=942330;ARGS:criteria,\
+ ctl:ruleRemoveTargetById=942340;ARGS:criteria,\
+ ctl:ruleRemoveTargetById=942370;ARGS:criteria"
+
+# Edit forum theme
+# POST /xf/admin.php?styles/title.1234/style-properties/group&group=basic
+SecRule REQUEST_FILENAME "@endsWith /admin.php" \
+ "id:9006950,\
+ phase:2,\
+ pass,\
+ t:none,\
+ nolog,\
+ chain"
+ SecRule REQUEST_URI "@rx /admin\.php\?styles/" \
+ "t:none,\
+ ctl:ruleRemoveTargetById=942200;ARGS:json,\
+ ctl:ruleRemoveTargetById=942260;ARGS:json,\
+ ctl:ruleRemoveTargetById=942330;ARGS:json,\
+ ctl:ruleRemoveTargetById=942340;ARGS:json,\
+ ctl:ruleRemoveTargetById=942370;ARGS:json"
+
+SecMarker "END-XENFORO-ADMIN"
+
+SecMarker "END-XENFORO"
diff --git a/confs/owasp-crs/REQUEST-905-COMMON-EXCEPTIONS.conf b/confs/owasp-crs/REQUEST-905-COMMON-EXCEPTIONS.conf
index 3761725..812f144 100644
--- a/confs/owasp-crs/REQUEST-905-COMMON-EXCEPTIONS.conf
+++ b/confs/owasp-crs/REQUEST-905-COMMON-EXCEPTIONS.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
diff --git a/confs/owasp-crs/REQUEST-910-IP-REPUTATION.conf b/confs/owasp-crs/REQUEST-910-IP-REPUTATION.conf
index eadbb24..1a6e347 100644
--- a/confs/owasp-crs/REQUEST-910-IP-REPUTATION.conf
+++ b/confs/owasp-crs/REQUEST-910-IP-REPUTATION.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -39,13 +39,11 @@ SecRule TX:DO_REPUT_BLOCK "@eq 1" \
tag:'platform-multi',\
tag:'attack-reputation-ip',\
tag:'IP_REPUTATION/MALICIOUS_CLIENT',\
- setvar:'tx.msg=%{rule.msg}',\
severity:'CRITICAL',\
chain,\
skipAfter:BEGIN-REQUEST-BLOCKING-EVAL"
SecRule IP:REPUT_BLOCK_FLAG "@eq 1" \
- "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-AUTOMATION/MALICIOUS-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}'"
+ "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
@@ -73,9 +71,7 @@ SecRule TX:HIGH_RISK_COUNTRY_CODES "!@rx ^$" \
SecRule TX:REAL_IP "@geoLookup" \
"chain"
SecRule GEO:COUNTRY_CODE "@within %{tx.high_risk_country_codes}" \
- "setvar:'tx.msg=%{rule.msg}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-AUTOMATION/MALICIOUS-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
+ "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
expirevar:'ip.reput_block_flag=%{tx.reput_block_duration}'"
@@ -101,9 +97,7 @@ SecRule TX:HIGH_RISK_COUNTRY_CODES "!@rx ^$" \
# tag:'platform-multi',\
# tag:'attack-reputation-ip',\
# severity:'CRITICAL',\
-# setvar:'tx.msg=%{rule.msg}',\
# setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
-# setvar:'tx.%{rule.id}-AUTOMATION/MALICIOUS-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
# setvar:'ip.reput_block_flag=1',\
# setvar:'ip.reput_block_reason=%{rule.msg}',\
# expirevar:'ip.reput_block_flag=%{tx.reput_block_duration}'"
@@ -185,9 +179,7 @@ SecRule TX:block_search_ip "@eq 1" \
chain,\
skipAfter:END-RBL-CHECK"
SecRule TX:httpbl_msg "@rx Search Engine" \
- "setvar:'tx.msg=%{rule.msg}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-AUTOMATION/MALICIOUS-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
+ "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
setvar:'ip.previous_rbl_check=1',\
@@ -208,9 +200,7 @@ SecRule TX:block_spammer_ip "@eq 1" \
chain,\
skipAfter:END-RBL-CHECK"
SecRule TX:httpbl_msg "@rx (?i)^.*? spammer .*?$" \
- "setvar:'tx.msg=%{rule.msg}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-AUTOMATION/MALICIOUS-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
+ "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
setvar:'ip.previous_rbl_check=1',\
@@ -231,9 +221,7 @@ SecRule TX:block_suspicious_ip "@eq 1" \
chain,\
skipAfter:END-RBL-CHECK"
SecRule TX:httpbl_msg "@rx (?i)^.*? suspicious .*?$" \
- "setvar:'tx.msg=%{rule.msg}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-AUTOMATION/MALICIOUS-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
+ "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
setvar:'ip.previous_rbl_check=1',\
@@ -254,9 +242,7 @@ SecRule TX:block_harvester_ip "@eq 1" \
chain,\
skipAfter:END-RBL-CHECK"
SecRule TX:httpbl_msg "@rx (?i)^.*? harvester .*?$" \
- "setvar:'tx.msg=%{rule.msg}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-AUTOMATION/MALICIOUS-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
+ "setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
setvar:'ip.previous_rbl_check=1',\
diff --git a/confs/owasp-crs/REQUEST-911-METHOD-ENFORCEMENT.conf b/confs/owasp-crs/REQUEST-911-METHOD-ENFORCEMENT.conf
index 0196990..b420cbc 100644
--- a/confs/owasp-crs/REQUEST-911-METHOD-ENFORCEMENT.conf
+++ b/confs/owasp-crs/REQUEST-911-METHOD-ENFORCEMENT.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -34,16 +34,15 @@ SecRule REQUEST_METHOD "!@within %{tx.allowed_methods}" \
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-generic',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/POLICY/METHOD_NOT_ALLOWED',\
tag:'WASCTC/WASC-15',\
tag:'OWASP_TOP_10/A6',\
tag:'OWASP_AppSensor/RE1',\
tag:'PCI/12.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- ver:'OWASP_CRS/3.1.1',\
- setvar:'tx.msg=%{rule.msg}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/POLICY/METHOD_NOT_ALLOWED-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
diff --git a/confs/owasp-crs/REQUEST-912-DOS-PROTECTION.conf b/confs/owasp-crs/REQUEST-912-DOS-PROTECTION.conf
index 4de94de..cb8521c 100644
--- a/confs/owasp-crs/REQUEST-912-DOS-PROTECTION.conf
+++ b/confs/owasp-crs/REQUEST-912-DOS-PROTECTION.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -105,11 +105,11 @@ SecRule IP:DOS_BLOCK "@eq 1" \
"id:912120,\
phase:1,\
drop,\
+ msg:'Denial of Service (DoS) attack identified from %{tx.real_ip} (%{tx.dos_block_counter} hits since last alert)',\
tag:'application-multi',\
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-dos',\
- msg:'Denial of Service (DoS) attack identified from %{tx.real_ip} (%{tx.dos_block_counter} hits since last alert)',\
chain"
SecRule &IP:DOS_BLOCK_FLAG "@eq 0" \
"setvar:'ip.dos_block_counter=+1',\
diff --git a/confs/owasp-crs/REQUEST-913-SCANNER-DETECTION.conf b/confs/owasp-crs/REQUEST-913-SCANNER-DETECTION.conf
index d9868f0..f853417 100644
--- a/confs/owasp-crs/REQUEST-913-SCANNER-DETECTION.conf
+++ b/confs/owasp-crs/REQUEST-913-SCANNER-DETECTION.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -42,20 +42,19 @@ SecRule REQUEST_HEADERS:User-Agent "@pmFromFile scanners-user-agents.data" \
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-reputation-scanner',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/AUTOMATION/SECURITY_SCANNER',\
tag:'WASCTC/WASC-21',\
tag:'OWASP_TOP_10/A7',\
tag:'PCI/6.5.10',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/AUTOMATION/SECURITY_SCANNER-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
expirevar:'ip.reput_block_flag=%{tx.reput_block_duration}'"
-SecRule REQUEST_HEADERS_NAMES|REQUEST_HEADERS "@pmf scanners-headers.data" \
+SecRule REQUEST_HEADERS_NAMES|REQUEST_HEADERS "@pmFromFile scanners-headers.data" \
"id:913110,\
phase:2,\
block,\
@@ -67,22 +66,21 @@ SecRule REQUEST_HEADERS_NAMES|REQUEST_HEADERS "@pmf scanners-headers.data" \
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-reputation-scanner',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/AUTOMATION/SECURITY_SCANNER',\
tag:'WASCTC/WASC-21',\
tag:'OWASP_TOP_10/A7',\
tag:'PCI/6.5.10',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/AUTOMATION/SECURITY_SCANNER-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
expirevar:'ip.reput_block_flag=%{tx.reput_block_duration}'"
-SecRule REQUEST_FILENAME|ARGS "@pmf scanners-urls.data" \
+SecRule REQUEST_FILENAME|ARGS "@pmFromFile scanners-urls.data" \
"id:913120,\
phase:2,\
block,\
@@ -94,15 +92,14 @@ SecRule REQUEST_FILENAME|ARGS "@pmf scanners-urls.data" \
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-reputation-scanner',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/AUTOMATION/SECURITY_SCANNER',\
tag:'WASCTC/WASC-21',\
tag:'OWASP_TOP_10/A7',\
tag:'PCI/6.5.10',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/AUTOMATION/SECURITY_SCANNER-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
expirevar:'ip.reput_block_flag=%{tx.reput_block_duration}'"
@@ -136,16 +133,15 @@ SecRule REQUEST_HEADERS:User-Agent "@pmFromFile scripting-user-agents.data" \
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-reputation-scripting',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/AUTOMATION/SCRIPTING',\
tag:'WASCTC/WASC-21',\
tag:'OWASP_TOP_10/A7',\
tag:'PCI/6.5.10',\
tag:'paranoia-level/2',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.anomaly_score_pl2=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/AUTOMATION/SCRIPTING-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
expirevar:'ip.reput_block_flag=%{tx.reput_block_duration}'"
@@ -173,16 +169,15 @@ SecRule REQUEST_HEADERS:User-Agent "@pmFromFile crawlers-user-agents.data" \
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-reputation-crawler',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/AUTOMATION/CRAWLER',\
tag:'WASCTC/WASC-21',\
tag:'OWASP_TOP_10/A7',\
tag:'PCI/6.5.10',\
tag:'paranoia-level/2',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.anomaly_score_pl2=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/AUTOMATION/CRAWLER-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',\
setvar:'ip.reput_block_flag=1',\
setvar:'ip.reput_block_reason=%{rule.msg}',\
expirevar:'ip.reput_block_flag=%{tx.reput_block_duration}'"
diff --git a/confs/owasp-crs/REQUEST-920-PROTOCOL-ENFORCEMENT.conf b/confs/owasp-crs/REQUEST-920-PROTOCOL-ENFORCEMENT.conf
index 8cf817c..8f03164 100644
--- a/confs/owasp-crs/REQUEST-920-PROTOCOL-ENFORCEMENT.conf
+++ b/confs/owasp-crs/REQUEST-920-PROTOCOL-ENFORCEMENT.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -55,13 +55,12 @@ SecRule REQUEST_LINE "!@rx ^(?i:(?:[a-z]{3,10}\s+(?:\w{3,7}?://[\w\-\./]*(?::\d+
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-protocol',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/PROTOCOL_VIOLATION/INVALID_REQ',\
tag:'CAPEC-272',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'WARNING',\
- setvar:'tx.msg=%{rule.msg}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.notice_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/INVALID_REQ-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.notice_anomaly_score}'"
#
@@ -90,6 +89,8 @@ SecRule REQUEST_LINE "!@rx ^(?i:(?:[a-z]{3,10}\s+(?:\w{3,7}?://[\w\-\./]*(?::\d+
# 920121: PL2 : FILES_NAMES, FILES
# ['\";=] : ' " ; = meta-characters
#
+# Not supported by re2 (?(
# Anatomy of the regexp with examples of patterns caught:
@@ -108,17 +111,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# Apache 2.2 requires configuration file lines to be under 8kB.
# Therefore, some remaining commands have been split off to a separate rule.
@@ -146,17 +148,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# [ Windows command injection ]
@@ -245,22 +246,24 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-windows',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# Apache 2.2 requires configuration file lines to be under 8kB.
# Therefore, some remaining commands have been split off to a separate rule.
# For explanation of this rule, see rule 932110.
#
+# This rule is also triggered by an Oracle WebLogic Remote Command Execution exploit:
+# [ Oracle WebLogic vulnerability CVE-2017-10271 - Exploit tested: https://www.exploit-db.com/exploits/43458 ]
+#
# To rebuild the word list regexp:
# cd util/regexp-assemble
# cat regexp-932115.txt | ./regexp-cmdline.py windows | ./regexp-assemble.pl
@@ -283,17 +286,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-windows',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# [ Windows PowerShell, cmdlets and options ]
@@ -307,7 +309,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# https://technet.microsoft.com/en-us/magazine/ff714569.aspx
# https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/console/powershell.exe-command-line-help
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmf windows-powershell-commands.data" \
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile windows-powershell-commands.data" \
"id:932120,\
phase:2,\
block,\
@@ -320,17 +322,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-powershell',\
tag:'platform-windows',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# [ Unix shell expressions ]
@@ -345,7 +346,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# $((foo)) Arithmetic expansion
#
# Regexp generated from util/regexp-assemble/regexp-932130.data using Regexp::Assemble.
-# See http://blog.modsecurity.org/2007/06/optimizing-regu.html for usage.
+# See https://coreruleset.org/20190826/optimizing-regular-expressions/ for usage.
#
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:\$(?:\((?:\(.*\)|.*)\)|\{.*\})|[<>]\(.*\))" \
"id:932130,\
@@ -359,17 +360,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# [ Windows FOR, IF commands ]
@@ -393,9 +393,9 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# http://ss64.com/nt/for.html
#
# Regexp generated from util/regexp-assemble/regexp-932140.data using Regexp::Assemble.
-# See http://blog.modsecurity.org/2007/06/optimizing-regu.html for usage.
+# See https://coreruleset.org/20190826/optimizing-regular-expressions/ for usage.
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \b(?:if(?:/i)?(?: not)?(?: exist\b| defined\b| errorlevel\b| cmdextversion\b|(?: |\().*(?:\bgeq\b|\bequ\b|\bneq\b|\bleq\b|\bgtr\b|\blss\b|==))|for(/[dflr].*)* %+[^ ]+ in\(.*\)\s?do)" \
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx \b(?:if(?:/i)?(?: not)?(?: exist\b| defined\b| errorlevel\b| cmdextversion\b|(?: |\().*(?:\bgeq\b|\bequ\b|\bneq\b|\bleq\b|\bgtr\b|\blss\b|==))|for(?:/[dflr].*)? %+[^ ]+ in\(.*\)\s?do)" \
"id:932140,\
phase:2,\
block,\
@@ -407,17 +407,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-windows',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# [ Unix direct remote command execution ]
@@ -429,6 +428,9 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# command string is appended (injected) to a regular parameter, and then
# passed to a shell unescaped.
#
+# This rule is also triggered by an Oracle WebLogic Remote Command Execution exploit:
+# [ Oracle WebLogic vulnerability CVE-2017-10271 - Exploit tested: https://www.exploit-db.com/exploits/43458 ]
+#
# Due to a higher risk of false positives, the following changes have been
# made relative to rule 932100:
# 1) the set of commands is smaller
@@ -457,17 +459,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# [ Unix shell snippets ]
@@ -478,7 +479,13 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# have been added here with their full path, in order to catch some
# cases where the full path is sent.
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmf unix-shell.data" \
+# This rule is also triggered by an Apache Struts Remote Code Execution exploit:
+# [ Apache Struts vulnerability CVE-2017-9805 - Exploit tested: https://www.exploit-db.com/exploits/42627 ]
+#
+# This rule is also triggered by an Oracle WebLogic Remote Command Execution exploit:
+# [ Oracle WebLogic vulnerability CVE-2017-10271 - Exploit tested: https://www.exploit-db.com/exploits/43458 ]
+
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile unix-shell.data" \
"id:932160,\
phase:2,\
block,\
@@ -490,17 +497,16 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
# [ Shellshock vulnerability (CVE-2014-6271 and CVE-2014-7169) ]
@@ -524,17 +530,16 @@ SecRule REQUEST_HEADERS|REQUEST_LINE "@rx ^\(\s*\)\s+{" \
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
SecRule ARGS_NAMES|ARGS|FILES_NAMES "@rx ^\(\s*\)\s+{" \
"id:932171,\
@@ -548,17 +553,16 @@ SecRule ARGS_NAMES|ARGS|FILES_NAMES "@rx ^\(\s*\)\s+{" \
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
@@ -574,28 +578,27 @@ SecRule ARGS_NAMES|ARGS|FILES_NAMES "@rx ^\(\s*\)\s+{" \
# code execution.
#
SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name \
- "@pmf restricted-upload.data" \
+ "@pmFromFile restricted-upload.data" \
"id:932180,\
phase:2,\
block,\
capture,\
t:none,t:lowercase,\
- logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
msg:'Restricted File Upload Attempt',\
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
tag:'application-multi',\
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.lfi_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/FILE_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:932013,phase:1,pass,nolog,skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
@@ -642,18 +645,17 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
tag:'PCI/6.5.2',\
tag:'paranoia-level/3',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
#
# -=[ Bypass Rule 930120 (wildcard) ]=-
@@ -677,6 +679,7 @@ SecRule ARGS "@rx (?:/|\\\\)(?:[\?\*]+[a-z/\\\\]+|[a-z/\\\\]+[\?\*]+)" \
tag:'language-shell',\
tag:'platform-unix',\
tag:'attack-rce',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/COMMAND_INJECTION',\
tag:'WASCTC/WASC-31',\
tag:'OWASP_TOP_10/A1',\
@@ -684,10 +687,8 @@ SecRule ARGS "@rx (?:/|\\\\)(?:[\?\*]+[a-z/\\\\]+|[a-z/\\\\]+[\?\*]+)" \
tag:'paranoia-level/3',\
ctl:auditLogParts=+E,\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/RCE-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 4" "id:932017,phase:1,pass,nolog,skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 4" "id:932018,phase:2,pass,nolog,skipAfter:END-REQUEST-932-APPLICATION-ATTACK-RCE"
diff --git a/confs/owasp-crs/REQUEST-933-APPLICATION-ATTACK-PHP.conf b/confs/owasp-crs/REQUEST-933-APPLICATION-ATTACK-PHP.conf
index 63d3a32..9c124b9 100644
--- a/confs/owasp-crs/REQUEST-933-APPLICATION-ATTACK-PHP.conf
+++ b/confs/owasp-crs/REQUEST-933-APPLICATION-ATTACK-PHP.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -43,6 +43,8 @@ SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 1" "id:933012,phase:2,pass,nolog,skipAf
# Therefore, that pattern is now checked by rule 933190 in paranoia levels
# 3 or higher.
#
+# Not supported by re2 (?!re).
+#
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:<\?(?!xml\s)|<\?php|\[(?:/|\\\\)?php\])" \
"id:933100,\
phase:2,\
@@ -55,15 +57,14 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
# [ PHP Script Uploads ]
@@ -86,7 +87,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# X_Filename, or X-File-Name to transmit the file name to the server;
# scan these request headers as well as multipart/form-data file names.
#
-SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phtml)\.*$" \
+SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X.Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phtml)\.*$" \
"id:933110,\
phase:2,\
block,\
@@ -98,21 +99,20 @@ SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEAD
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
# [ PHP Configuration Directives ]
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmf php-config-directives.data" \
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-config-directives.data" \
"id:933120,\
phase:2,\
block,\
@@ -124,24 +124,23 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
chain"
SecRule MATCHED_VARS "@pm =" \
"capture,\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
# [ PHP Variables ]
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmf php-variables.data" \
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-variables.data" \
"id:933130,\
phase:2,\
block,\
@@ -153,15 +152,14 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
@@ -191,15 +189,43 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
+
+
+#
+# [ PHP Wrappers ]
+#
+# PHP comes with many built-in wrappers for various URL-style protocols for use with the filesystem
+# functions such as fopen(), copy(), file_exists() and filesize(). Abusing of PHP wrappers like phar://
+# could lead to RCE as describled by Sam Thomas at BlackHat USA 2018 (https://bit.ly/2yaKV5X), even
+# wrappers like zlib://, glob://, rar://, zip://, etc... could lead to LFI and expect:// to RCE.
+#
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:zlib|glob|phar|ssh2|rar|ogg|expect|zip)://" \
+ "id:933200,\
+ phase:2,\
+ block,\
+ t:none,t:utf8toUnicode,t:urlDecodeUni,t:removeNulls,t:cmdLine,\
+ msg:'PHP Injection Attack: Wrapper scheme detected',\
+ logdata:'Matched Data: %{MATCHED_VAR} found within %{MATCHED_VAR_NAME}',\
+ tag:'application-multi',\
+ tag:'language-php',\
+ tag:'platform-multi',\
+ tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
+ tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
+ tag:'OWASP_TOP_10/A1',\
+ ctl:auditLogParts=+E,\
+ ver:'OWASP_CRS/3.2.0',\
+ severity:'CRITICAL',\
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
@@ -215,7 +241,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# - Rule 933150: ~40 words highly common to PHP injection payloads and extremely rare in
# natural language or other contexts.
# Examples: 'base64_decode', 'file_get_contents'.
-# These words are detected as a match directly using @pmf.
+# These words are detected as a match directly using @pmFromFile.
# Function names are defined in php-function-names-933150.data
#
# - Rule 933160: ~220 words which are common in PHP code, but have a higher chance to cause
@@ -226,7 +252,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
#
# - Rule 933151: ~1300 words of lesser importance. This includes most PHP functions and keywords.
# Examples: 'addslashes', 'array_diff'.
-# For performance reasons, the @pmf operator is used, and many functions from lesser
+# For performance reasons, the @pmFromFile operator is used, and many functions from lesser
# used PHP extensions are removed.
# To mitigate false positives, we only match when the '(' character is also found.
# This rule only runs in paranoia level 2 or higher.
@@ -248,7 +274,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
# We block these function names outright, without using a complex regexp or chain.
# This could make the detection a bit more robust against possible bypasses.
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@pmf php-function-names-933150.data" \
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-function-names-933150.data" \
"id:933150,\
phase:2,\
block,\
@@ -260,15 +286,14 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
@@ -292,8 +317,14 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
# system //comment \n (...)
# system #comment \n (...)
#
+# This rule is also triggered by the following exploit(s):
+# [ Apache Struts vulnerability CVE-2017-9791 - Exploit tested: https://www.exploit-db.com/exploits/42324 ]
+# [ Apache Struts vulnerability CVE-2018-11776 - Exploit tested: https://www.exploit-db.com/exploits/45260 ]
+# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
+#
# Regexp generated from util/regexp-assemble/regexp-933160.data using Regexp::Assemble.
-# See http://blog.modsecurity.org/2007/06/optimizing-regu.html for usage.
+# See https://coreruleset.org/20190826/optimizing-regular-expressions/ for usage.
+#
# Note that after assemble, PHP function syntax pre/postfix is added to the Regexp::Assemble
# output. Example: "@rx (?i)\bASSEMBLE_OUTPUT_HERE(?:\s|/\*.*\*/|//.*|#.*)*\(.*\)"
#
@@ -309,15 +340,14 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
@@ -366,15 +396,14 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_H
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
@@ -423,16 +452,56 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
+# [ PHP Functions: Variable Function Prevent Bypass ]
+#
+# Referring to https://www.secjuice.com/php-rce-bypass-filters-sanitization-waf/
+# the rule 933180 could be bypassed by using the following payloads:
+#
+# - (system)('uname')
+# - (sy.(st).em)('uname')
+# - (string)"system"('uname')
+# - define('x', 'sys' . 'tem');(x)/* comment */('uname')
+# - $y = 'sys'.'tem';($y)('uname')
+# - define('z', [['sys' .'tem']]);(z)[0][0]('uname');
+# - (system)(ls)
+# - (/**/system)(ls/**/);
+# - (['system'])[0]('uname');
+# - (++[++system++][++0++])++{/*dsasd*/0}++(++ls++);
+#
+# This rule blocks all payloads above and avoids to block values like:
+#
+# - [ACME] this is a test (just a test)
+# - Test (with two) rounded (brackets)
+#
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx (?:(?:\(|\[)[a-zA-Z0-9_.$\"'\[\](){}/*\s]+(?:\)|\])[0-9_.$\"'\[\](){}/*\s]*\([a-zA-Z0-9_.$\"'\[\](){}/*\s].*\)|\([\s]*string[\s]*\)[\s]*(?:\"|'))" \
+ "id:933210,\
+ phase:2,\
+ block,\
+ capture,\
+ t:none,t:urlDecode,t:replaceComments,t:compressWhitespace,\
+ msg:'PHP Injection Attack: Variable Function Call Found',\
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
+ tag:'application-multi',\
+ tag:'language-php',\
+ tag:'platform-multi',\
+ tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
+ tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
+ tag:'OWASP_TOP_10/A1',\
+ ctl:auditLogParts=+E,\
+ ver:'OWASP_CRS/3.2.0',\
+ severity:'CRITICAL',\
+ setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:933013,phase:1,pass,nolog,skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:933014,phase:2,pass,nolog,skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
@@ -448,7 +517,7 @@ SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:933014,phase:2,pass,nolog,skipAf
# The size of the PHP function list is considerable.
# Even after excluding the more obscure PHP extensions, 1300+ functions remain.
# For performance and maintenance reasons, this rule does not use a regexp,
-# but uses a phrase file (@pmf), and additionally looks for an '(' character
+# but uses a phrase file (@pmFromFile), and additionally looks for an '(' character
# in the matched variable.
#
# This approach carries some risk for false positives. Therefore, the function list
@@ -457,7 +526,7 @@ SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:933014,phase:2,pass,nolog,skipAf
#
# This rule is a stricter sibling of rule 933150.
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@pmf php-function-names-933151.data" \
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@pmFromFile php-function-names-933151.data" \
"id:933151,\
phase:2,\
block,\
@@ -469,19 +538,18 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
tag:'paranoia-level/2',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
chain"
SecRule MATCHED_VARS "@pm (" \
"capture,\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl2=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
@@ -506,7 +574,7 @@ SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 3" "id:933016,phase:2,pass,nolog,skipAf
# parameter names or values and this will lead to false positives.
# Because this list is not expected to change and it is limited in size we use a
# regex in this case to look for these values whereas in its sibling rule we use
-# @pmf for flexibility and performance.
+# @pmFromFile for flexibility and performance.
#
# To rebuild the regexp:
# cd util/regexp-assemble
@@ -525,16 +593,15 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
tag:'paranoia-level/3',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
#
@@ -551,8 +618,13 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
#
# This rule is a stricter sibling of rule 933160.
#
+# This rule is also triggered by the following exploit(s):
+# [ Apache Struts vulnerability CVE-2018-11776 - Exploit tested: https://www.exploit-db.com/exploits/45262 ]
+# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
+#
# Regexp generated from util/regexp-assemble/regexp-933161.data using Regexp::Assemble.
-# See http://blog.modsecurity.org/2007/06/optimizing-regu.html for usage.
+# See https://coreruleset.org/20190826/optimizing-regular-expressions/ for usage.
+#
# Note that after assemble, PHP function syntax pre/postfix is added to the Regexp::Assemble
# output. Example: "@rx (?i)\bASSEMBLE_OUTPUT_HERE(?:\s|/\*.*\*/|//.*|#.*)*\(.*\)"
#
@@ -568,16 +640,15 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
tag:'paranoia-level/3',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
#
@@ -601,7 +672,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
#
# This rule is a stricter sibling of rule 933110.
#
-SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phtml)\..*$" \
+SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X.Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phtml)\..*$" \
"id:933111,\
phase:2,\
block,\
@@ -613,16 +684,15 @@ SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEAD
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
tag:'paranoia-level/3',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
# [ PHP Closing Tag Found ]
@@ -634,27 +704,26 @@ SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEAD
# See issue #654 for discussion.
#
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pm ?>" \
- "msg:'PHP Injection Attack: PHP Closing Tag Found',\
+ "id:933190,\
phase:2,\
- ver:'OWASP_CRS/3.1.1',\
- t:none,t:urlDecodeUni,\
- ctl:auditLogParts=+E,\
block,\
capture,\
+ t:none,t:urlDecodeUni,\
+ msg:'PHP Injection Attack: PHP Closing Tag Found',\
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
- id:933190,\
- severity:'CRITICAL',\
tag:'application-multi',\
tag:'language-php',\
tag:'platform-multi',\
tag:'attack-injection-php',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/PHP_INJECTION',\
tag:'OWASP_TOP_10/A1',\
tag:'paranoia-level/3',\
- setvar:'tx.msg=%{rule.msg}',\
+ ctl:auditLogParts=+E,\
+ ver:'OWASP_CRS/3.2.0',\
+ severity:'CRITICAL',\
setvar:'tx.php_injection_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/PHP_INJECTION-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 4" "id:933017,phase:1,pass,nolog,skipAfter:END-REQUEST-933-APPLICATION-ATTACK-PHP"
diff --git a/confs/owasp-crs/REQUEST-934-APPLICATION-ATTACK-NODEJS.conf b/confs/owasp-crs/REQUEST-934-APPLICATION-ATTACK-NODEJS.conf
new file mode 100644
index 0000000..b136626
--- /dev/null
+++ b/confs/owasp-crs/REQUEST-934-APPLICATION-ATTACK-NODEJS.conf
@@ -0,0 +1,94 @@
+# ------------------------------------------------------------------------
+# OWASP ModSecurity Core Rule Set ver.3.2.0
+# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
+#
+# The OWASP ModSecurity Core Rule Set is distributed under
+# Apache Software License (ASL) version 2
+# Please see the enclosed LICENSE file for full details.
+# ------------------------------------------------------------------------
+
+#
+# -= Paranoia Level 0 (empty) =- (apply unconditionally)
+#
+
+
+
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 1" "id:934011,phase:1,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 1" "id:934012,phase:2,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+#
+# -= Paranoia Level 1 (default) =- (apply only when tx.executing_paranoia_level is sufficiently high: 1 or higher)
+#
+
+
+# [ Insecure unserialization / generic RCE signatures ]
+#
+# Libraries performing insecure unserialization:
+# - node-serialize: _$$ND_FUNC$$_ (CVE-2017-5941)
+# - funcster: __js_function
+#
+# See:
+# https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/
+# https://www.acunetix.com/blog/web-security-zone/deserialization-vulnerabilities-attacking-deserialization-in-js/
+#
+# Some generic snippets used:
+# - function() {
+# - new Function(
+# - eval(
+# - String.fromCharCode(
+#
+# Last two are used by nodejsshell.py,
+# https://github.com/ajinabraham/Node.Js-Security-Course/blob/master/nodejsshell.py
+#
+# As base64 is sometimes (but not always) used to encode serialized values,
+# use multiMatch and t:base64decode.
+#
+# Regexp generated from util/regexp-assemble/regexp-934100.data using Regexp::Assemble.
+# See https://coreruleset.org/20190826/optimizing-regular-expressions/ for usage.
+
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:(?:_(?:\$\$ND_FUNC\$\$_|_js_function)|(?:new\s+Function|\beval)\s*\(|String\s*\.\s*fromCharCode|function\s*\(\s*\)\s*{|this\.constructor)|module\.exports\s*=)" \
+ "id:934100,\
+ phase:2,\
+ block,\
+ capture,\
+ t:none,t:urlDecodeUni,t:base64Decode,\
+ msg:'Node.js Injection Attack',\
+ logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
+ tag:'application-multi',\
+ tag:'language-javascript',\
+ tag:'platform-multi',\
+ tag:'attack-rce',\
+ tag:'attack-injection-nodejs',\
+ tag:'OWASP_CRS/WEB_ATTACK/NODEJS_INJECTION',\
+ tag:'OWASP_TOP_10/A1',\
+ ctl:auditLogParts=+E,\
+ ver:'OWASP_CRS/3.2.0',\
+ severity:'CRITICAL',\
+ multiMatch,\
+ setvar:'tx.rce_score=+%{tx.critical_anomaly_score}',\
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
+
+
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:934013,phase:1,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:934014,phase:2,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+#
+# -= Paranoia Level 2 =- (apply only when tx.executing_paranoia_level is sufficiently high: 2 or higher)
+#
+
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 3" "id:934015,phase:1,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 3" "id:934016,phase:2,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+#
+# -= Paranoia Level 3 =- (apply only when tx.executing_paranoia_level is sufficiently high: 3 or higher)
+#
+
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 4" "id:934017,phase:1,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 4" "id:934018,phase:2,pass,nolog,skipAfter:END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
+#
+# -= Paranoia Level 4 =- (apply only when tx.executing_paranoia_level is sufficiently high: 4 or higher)
+#
+
+
+
+#
+# -= Paranoia Levels Finished =-
+#
+SecMarker "END-REQUEST-934-APPLICATION-ATTACK-NODEJS"
diff --git a/confs/owasp-crs/REQUEST-941-APPLICATION-ATTACK-XSS.conf b/confs/owasp-crs/REQUEST-941-APPLICATION-ATTACK-XSS.conf
index c09a258..a106036 100644
--- a/confs/owasp-crs/REQUEST-941-APPLICATION-ATTACK-XSS.conf
+++ b/confs/owasp-crs/REQUEST-941-APPLICATION-ATTACK-XSS.conf
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------
-# OWASP ModSecurity Core Rule Set ver.3.1.1
+# OWASP ModSecurity Core Rule Set ver.3.2.0
# Copyright (c) 2006-2019 Trustwave and contributors. All rights reserved.
#
# The OWASP ModSecurity Core Rule Set is distributed under
@@ -45,6 +45,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_H
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-xss',\
+ tag:'OWASP_CRS',\
tag:'OWASP_CRS/WEB_ATTACK/XSS',\
tag:'WASCTC/WASC-8',\
tag:'WASCTC/WASC-22',\
@@ -52,12 +53,10 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_H
tag:'OWASP_AppSensor/IE1',\
tag:'CAPEC-242',\
ctl:auditLogParts=+E,\
- ver:'OWASP_CRS/3.1.1',\
+ ver:'OWASP_CRS/3.2.0',\
severity:'CRITICAL',\
- setvar:'tx.msg=%{rule.msg}',\
setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\
- setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
- setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/XSS-%{MATCHED_VAR_NAME}=%{tx.0}'"
+ setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
#
@@ -65,7 +64,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_H
# http://xssplayground.net23.net/xssfilter.html
# script tag based XSS vectors, e.g.,
#
-SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[<<]script[^>>]*[>>][\s\S]*?" \
+SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@rx (?i)