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

Commit 920e963

Browse files
committed
optimize regexp-942340.data and rule 942340
1 parent 12b32f2 commit 920e963

File tree

2 files changed

+14
-34
lines changed

2 files changed

+14
-34
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,17 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
881881
setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},\
882882
setvar:'tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/SQLI-%{matched_var_name}=%{tx.0}'"
883883

884-
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:(?:in\s*?\(+\s*?select)|(?:(?:n?and|x?x?or|div|like|between|and|not|\|\||\&\&)\s+[\s\w+]+(?:regexp\s*?\(|sounds\s+like\s*?[\"'`]|[=\d]+x))|([\"'`]\s*?\d\s*?(?:--|#))|(?:[\"'`][\%&<>^=]+\d\s*?(=|x?or|div|like|between|and))|(?:[\"'`]\W+[\w+-]+\s*?=\s*?\d\W+[\"'`])|(?:[\"'`]\s*?is\s*?\d.+[\"'`]?\w)|(?:[\"'`]\|?[\w-]{3,}[^\w\s.,]+[\"'`])|(?:[\"'`]\s*?is\s*?[\d.]+\s*?\W.*?[\"'`]))" \
884+
# Regexp generated from util/regexp-assemble/regexp-942340.data using Regexp::Assemble.
885+
# To rebuild the regexp:
886+
# cd util/regexp-assemble
887+
# ./regexp-assemble.pl regexp-942340.data
888+
# Note that part of regexp-942340.data is already optimized, to avoid a
889+
# Regexp::Assemble behaviour, where the regex is not optimized very nicely.
890+
# Note that after assemble an outer bracket with an ignore case flag is added
891+
# to the Regexp::Assemble output:
892+
# (?i:ASSEMBLE_OUTPUT)
893+
#
894+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:(?:[\"'`](?:\s*?(?:is\s*?(?:[\d.]+\s*?\W.*?[\"'`]|\d.+[\"'`]?\w)|\d\s*?(?:--|#))|(?:\W+[\w+-]+\s*?=\s*?\d\W+|\|?[\w-]{3,}[^\w\s.,]+)[\"'`]|[\%&<>^=]+\d\s*?(?:between|like|x?or|and|div|=))|(?i:n?and|x?x?or|div|like|between|not|\|\||\&\&)\s+[\s\w+]+(?:sounds\s+like\s*?[\"'`]|regexp\s*?\(|[=\d]+x)|in\s*?\(+\s*?select))" \
885895
"phase:2,\
886896
rev:'2',\
887897
ver:'OWASP_CRS/3.0.0',\

util/regexp-assemble/regexp-942340.data

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,7 @@
11
in\s*?[(]+\s*?select
2-
and\s+[\s\w+]+regexp\s*?\(
3-
nand\s+[\s\w+]+regexp\s*?\(
4-
or\s+[\s\w+]+regexp\s*?\(
5-
xor\s+[\s\w+]+regexp\s*?\(
6-
xxor\s+[\s\w+]+regexp\s*?\(
7-
div\s+[\s\w+]+regexp\s*?\(
8-
like\s+[\s\w+]+regexp\s*?\(
9-
between\s+[\s\w+]+regexp\s*?\(
10-
not\s+[\s\w+]+regexp\s*?\(
11-
\|\|\s+[\s\w+]+regexp\s*?\(
12-
\&\&\s+[\s\w+]+regexp\s*?\(
13-
and\s+[\s\w+]+sounds\s+like\s*?[\"'`]
14-
nand\s+[\s\w+]+sounds\s+like\s*?[\"'`]
15-
or\s+[\s\w+]+sounds\s+like\s*?[\"'`]
16-
xor\s+[\s\w+]+sounds\s+like\s*?[\"'`]
17-
xxor\s+[\s\w+]+sounds\s+like\s*?[\"'`]
18-
div\s+[\s\w+]+sounds\s+like\s*?[\"'`]
19-
like\s+[\s\w+]+sounds\s+like\s*?[\"'`]
20-
between\s+[\s\w+]+sounds\s+like\s*?[\"'`]
21-
not\s+[\s\w+]+sounds\s+like\s*?[\"'`]
22-
\|\|\s+[\s\w+]+sounds\s+like\s*?[\"'`]
23-
\&\&\s+[\s\w+]+sounds\s+like\s*?[\"'`]
24-
and\s+[\s\w+]+[=\d]+x
25-
nand\s+[\s\w+]+[=\d]+x
26-
or\s+[\s\w+]+[=\d]+x
27-
xor\s+[\s\w+]+[=\d]+x
28-
xxor\s+[\s\w+]+[=\d]+x
29-
div\s+[\s\w+]+[=\d]+x
30-
like\s+[\s\w+]+[=\d]+x
31-
between\s+[\s\w+]+[=\d]+x
32-
not\s+[\s\w+]+[=\d]+x
33-
\|\|\s+[\s\w+]+[=\d]+x
34-
\&\&\s+[\s\w+]+[=\d]+x
2+
(?i:n?and|x?x?or|div|like|between|not|\|\||\&\&)\s+[\s\w+]+regexp\s*?\(
3+
(?i:n?and|x?x?or|div|like|between|not|\|\||\&\&)\s+[\s\w+]+sounds\s+like\s*?[\"'`]
4+
(?i:n?and|x?x?or|div|like|between|not|\|\||\&\&)\s+[\s\w+]+[=\d]+x
355
[\"'`]\s*?\d\s*?--
366
[\"'`]\s*?\d\s*?#
377
[\"'`][\%&<>^=]+\d\s*?=

0 commit comments

Comments
 (0)