Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.

Commit a6d5dc9

Browse files
authored
Merge pull request #1255 from fgsch/comment-unsupported-re2
Mark patterns not supported by re2
2 parents 6630485 + 7285d1a commit a6d5dc9

5 files changed

+22
-0
lines changed

rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ SecRule REQUEST_LINE "!@rx ^(?i:(?:[a-z]{3,10}\s+(?:\w{3,7}?://[\w\-\./]*(?::\d+
9090
# 920121: PL2 : FILES_NAMES, FILES
9191
# ['\";=] : ' " ; = meta-characters
9292
#
93+
# Not supported by re2 (?<!re).
94+
#
9395
# -=[ References ]=-
9496
# https://www.owasp.org/index.php/ModSecurity_CRS_RuleID-960000
9597
# http://www.ietf.org/rfc/rfc2183.txt
@@ -400,6 +402,8 @@ SecRule REQUEST_HEADERS:Connection "@rx \b(?:keep-alive|close),\s?(?:keep-alive|
400402
# different variables - REQUEST_URI and REQUEST_BODY. For REQUEST_BODY, we only want to
401403
# run the @validateUrlEncoding operator if the content-type is application/x-www-form-urlencoding.
402404
#
405+
# Not supported by re2 (?!re).
406+
#
403407
# -=[ References ]=-
404408
# http://www.ietf.org/rfc/rfc1738.txt
405409
#
@@ -427,6 +431,8 @@ SecRule REQUEST_URI "@rx \%(?:(?!$|\W)|[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})" \
427431
setvar:'tx.anomaly_score_pl1=+%{tx.warning_anomaly_score}',\
428432
setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/EVASION-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}'"
429433

434+
# Not supported by re2 (?!re).
435+
#
430436
SecRule REQUEST_HEADERS:Content-Type "@rx ^(?:application\/x-www-form-urlencoded|text\/xml)(?:;(?:\s?charset\s?=\s?[\w\d\-]{1,18})?)??$" \
431437
"id:920240,\
432438
phase:2,\
@@ -1230,6 +1236,8 @@ SecRule REQUEST_BASENAME "@endsWith .pdf" \
12301236
setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}'"
12311237

12321238

1239+
# Not supported by re2 (?!re).
1240+
#
12331241
SecRule ARGS "@rx \%((?!$|\W)|[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})" \
12341242
"id:920230,\
12351243
phase:2,\
@@ -1520,6 +1528,8 @@ SecRule REQUEST_HEADERS|!REQUEST_HEADERS:User-Agent|!REQUEST_HEADERS:Referer|!RE
15201528
# negative look-behind construct. If that is the case, the backslash character
15211529
# is allowed.
15221530
#
1531+
# Not supported by re2 (?<!re).
1532+
#
15231533
SecRule REQUEST_URI|REQUEST_HEADERS|ARGS|ARGS_NAMES "@rx (?<!\Q\\\E)\Q\\\E[cdeghijklmpqwxyz123456789]" \
15241534
"id:920460,\
15251535
phase:2,\

rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 1" "id:933012,phase:2,pass,nolog,skipAf
4343
# Therefore, that pattern is now checked by rule 933190 in paranoia levels
4444
# 3 or higher.
4545
#
46+
# Not supported by re2 (?!re).
47+
#
4648
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:<\?(?!xml\s)|<\?php|\[(?:/|\\\\)?php\])" \
4749
"id:933100,\
4850
phase:2,\

rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_H
126126
#
127127
# -=[ XSS Filters - Category 3 ]=-
128128
#
129+
# Not supported by re2 (?=re).
130+
#
129131
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\s\S](?:x(?:link:href|html|mlns)|!ENTITY.*?SYSTEM|data:text\/html|pattern(?=.*?=)|formaction|\@import|base64)\b" \
130132
"id:941130,\
131133
phase:2,\

rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ SecRule ARGS_NAMES|ARGS|XML:/* "@rx (?i:(?:(?:^|\W)in[+\s]*\([\s\d\"]+[^()]*\)|\
572572
# to the Regexp::Assemble output:
573573
# (?i:ASSEMBLE_OUTPUT)
574574
#
575+
# Not supported by re2 (++, ?!re).
576+
#
575577
SecRule ARGS_NAMES|ARGS|XML:/* "@rx (?i:([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)(?:<(?:=(?:([\s'\"`\(\)]*?)(?!\2)([\d\w]+)|>([\s'\"`\(\)]*?)(?:\2))|>?([\s'\"`\(\)]*?)(?!\2)([\d\w]+))|(?:not\s+(?:regexp|like)|is\s+not|>=?|!=|\^)([\s'\"`\(\)]*?)(?!\2)([\d\w]+)|(?:(?:sounds\s+)?like|r(?:egexp|like)|=)([\s'\"`\(\)]*?)(?:\2)))" \
576578
"id:942130,\
577579
phase:2,\
@@ -680,6 +682,8 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
680682
# to the Regexp::Assemble output:
681683
# (?i:ASSEMBLE_OUTPUT)
682684
#
685+
# Not supported by re2 (\Z).
686+
#
683687
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:(?:(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\s*?\(\s*?space\s*?\(|,.*?[)\da-f\"'`][\"'`](?:[\"'`].*?[\"'`]|[^\"'`]+|\Z)|\Wselect.+\W*?from))" \
684688
"id:942200,\
685689
phase:2,\
@@ -959,6 +963,8 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
959963
# to the Regexp::Assemble output:
960964
# (?i:ASSEMBLE_OUTPUT)
961965
#
966+
# Not supported by re2 (?<=re).
967+
#
962968
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:(?:[\"'`](?:\s*?(?:(?:\*.+(?:(?:an|i)d|between|like|x?or|div)\W*?[\"'`]|(?:between|like|x?or|and|div)\s[^\d]+[\w-]+.*?)\d|[^\w\s?]+\s*?[^\w\s]+\s*?[\"'`]|[^\w\s]+\s*?[\W\d].*?(?:--|#))|.*?\*\s*?\d)|^[\w\s\"'`-]+(?<=and\s)(?:(?<=between)|(?<=and\s)|(?<=like)|(?<=div)|(?<=xor)|(?<=or))(?<=xor\s)(?<=nand\s)(?<=not\s)(?<=\|\|)(?<=\&\&)\w+\(|[()\*<>%+-][\w-]+[^\w\s]+[\"'`][^,]|\^[\"'`]))" \
963969
"id:942370,\
964970
phase:2,\

rules/RESPONSE-953-DATA-LEAKAGES-PHP.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ SecRule RESPONSE_BODY "@rx (?:\b(?:f(?:tp_(?:nb_)?f?(?:ge|pu)t|get(?:s?s|c)|scan
8282
# some common binary file format headers, such as gzip (\x1f\x8b\x08),
8383
# png (IHDR), mp3 (ID3), movie formats et cetera.
8484
#
85+
# Not supported by re2 (?!re).
86+
#
8587
SecRule RESPONSE_BODY "@rx <\?(?!xml)" \
8688
"id:953120,\
8789
phase:4,\

0 commit comments

Comments
 (0)