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

Commit 6f8d10d

Browse files
authored
Merge pull request #907 from franbuehler/sqli-rulerevision2
sqli rulerevision: disassembling sqli rules
2 parents d78180a + 80a017b commit 6f8d10d

26 files changed

+1021
-23
lines changed

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

Lines changed: 292 additions & 23 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
\!\=
2+
\&\&
3+
\|\|
4+
>>
5+
<<
6+
>=
7+
<=
8+
<>
9+
<=>
10+
\bxor\b
11+
\bregexp\b
12+
regexp\s+binary
13+
\bisnull\b
14+
\brlike\b
15+
rlike
16+
rlike\s+binary
17+
not\s+between\s+0\s+and
18+
is\s+null
19+
like\s+null
20+
^in[+\s]*\([\s\d\"]+[^()]*\)
21+
\Win[+\s]*\([\s\d\"]+[^()]*\)
22+
<>\s+binary
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)=([\s'\"`\(\)]*?)(?:\2)
2+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)<=>([\s'\"`\(\)]*?)(?:\2)
3+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)like([\s'\"`\(\)]*?)(?:\2)
4+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)rlike([\s'\"`\(\)]*?)(?:\2)
5+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)sounds\s+like([\s'\"`\(\)]*?)(?:\2)
6+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)regexp([\s'\"`\(\)]*?)(?:\2)
7+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)!=([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
8+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)<=([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
9+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)>=([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
10+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)<>([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
11+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)<([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
12+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)>([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
13+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)\^([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
14+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)is\s+not([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
15+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)not\s+like([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
16+
([\s'\"`\(\)]*?)([\d\w]++)([\s'\"`\(\)]*?)not\s+regexp([\s'\"`\(\)]*?)(?!\2)([\d\w]+)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
database\W*\(
2+
db_name\W*\(
3+
information_schema\b
4+
master\.\.sysdatabases\b
5+
msdb\b
6+
msysaccessobjects\b
7+
msysaccessstorage\b
8+
msysaccessxml\b
9+
msysaces\b
10+
msysmodules2\b
11+
msysmodules\b
12+
msysobjects\b
13+
msysqueries\b
14+
msysrelationships\b
15+
mysql\.db\b
16+
northwind\b
17+
pg_catalog\b
18+
pg_toast\b
19+
schema_name\b
20+
schema\W*\(
21+
sqlite_master\b
22+
sqlite_temp_master\b
23+
sysaux\b
24+
sys\.database_name\b
25+
tempdb\b
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
select\s+benchmark\s*?\(\s*?[(]?\s*?\w+
2+
;\s+benchmark\s*?\(\s*?[(]?\s*?\w+
3+
select\s+if\s*?\(\s*?[(]?\s*?\w+
4+
;\s+if\s*?\(\s*?[(]?\s*?\w+
5+
select\s+sleep\s*?\(\s*?[(]?\s*?\w+
6+
;\s+sleep\s*?\(\s*?[(]?\s*?\w+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
\d[\"'`]\s+[\"'`]\s+\d
2+
^admin\s*?[\"'`]
3+
(\/\*)+[\"'`]+\s?
4+
(\/\*)+[\"'`]+\s?--
5+
(\/\*)+[\"'`]+\s?#
6+
(\/\*)+[\"'`]+\s?\/\*
7+
(\/\*)+[\"'`]+\s?{
8+
[\"'`]\s*?or[\w\s-]+\s*?[+<>=(),-]\s*?[\d\"'`]
9+
[\"'`]\s*?xor[\w\s-]+\s*?[+<>=(),-]\s*?[\d\"'`]
10+
[\"'`]\s*?div[\w\s-]+\s*?[+<>=(),-]\s*?[\d\"'`]
11+
[\"'`]\s*?like[\w\s-]+\s*?[+<>=(),-]\s*?[\d\"'`]
12+
[\"'`]\s*?between[\w\s-]+\s*?[+<>=(),-]\s*?[\d\"'`]
13+
[\"'`]\s*?and[\w\s-]+\s*?[+<>=(),-]\s*?[\d\"'`]
14+
[\"'`]\s*?[^\w\s]?=\s*?[\"'`]
15+
[\"'`]\W*?[+=]+\W*?[\"'`]
16+
[\"'`]\s*?[!=|][\d\s!=+-]+.*?[\"'`(].*?$
17+
[\"'`]\s*?[!=|][\d\s!=]+.*?\d+$
18+
[\"'`]\s*?like\W+[\w\"'`(]
19+
\sis\s*?0\W
20+
where\s[\s\w\.,-]+\s=
21+
[\"'`][<>~]+[\"'`]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[\"'`]\s*?!\s*?[\"'`\w]
2+
[\"'`];?\s*?having\b\s*?[^\s]
3+
[\"'`];?\s*?select\b\s*?[^\s]
4+
[\"'`];?\s*?union\b\s*?[^\s]
5+
\s*?exec.*?\Wxp_cmdshell
6+
\s*?execute.*?\Wxp_cmdshell
7+
\wiif\s*?\(
8+
connection_id\s*?\([^\)]*?
9+
current_user\s*?\([^\)]*?
10+
database\s*?\([^\)]*?
11+
exec\s+master\.
12+
execute\s+master\.
13+
from\W+information_schema\W
14+
into[\s+]+dumpfile\s*?[\"'`]
15+
into[\s+]+outfile\s*?[\"'`]
16+
schema\s*?\([^\)]*?
17+
select.*?\w?user\(
18+
union select @
19+
union[\w(\s]*?select
20+
user\s*?\([^\)]*?
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
,.*?[)\da-f\"'`][\"'`][\"'`].*?[\"'`]
2+
,.*?[)\da-f\"'`][\"'`]\Z
3+
,.*?[)\da-f\"'`][\"'`][^\"'`]+
4+
\Wselect.+\W*?from
5+
select\s*?\(\s*?space\s*?\(
6+
create\s*?\(\s*?space\s*?\(
7+
rename\s*?\(\s*?space\s*?\(
8+
truncate\s*?\(\s*?space\s*?\(
9+
load\s*?\(\s*?space\s*?\(
10+
alter\s*?\(\s*?space\s*?\(
11+
delete\s*?\(\s*?space\s*?\(
12+
update\s*?\(\s*?space\s*?\(
13+
insert\s*?\(\s*?space\s*?\(
14+
desc\s*?\(\s*?space\s*?\(
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@.+=\s*?\(\s*?select
2+
\d+\s*?or\s*?\d+\s*?[\-+]
3+
\d+\s*?xor\s*?\d+\s*?[\-+]
4+
\d+\s*?div\s*?\d+\s*?[\-+]
5+
\d+\s*?like\s*?\d+\s*?[\-+]
6+
\d+\s*?between\s*?\d+\s*?[\-+]
7+
\d+\s*?and\s*?\d+\s*?[\-+]
8+
\/\w+;?\s+having\W
9+
\/\w+;?\s+and\W
10+
\/\w+;?\s+or\W
11+
\/\w+;?\s+xor\W
12+
\/\w+;?\s+div\W
13+
\/\w+;?\s+like\W
14+
\/\w+;?\s+between\W
15+
\/\w+;?\s+select\W
16+
\d\s+group\s+by.+\(
17+
;\s*?drop
18+
#\s*?drop
19+
--\s*?drop
20+
;\s*?alter
21+
#\s*?alter
22+
--\s*?alter
23+
;\s*?update\s*?\w{2,}
24+
#\s*?update\s*?\w{2,}
25+
--\s*?update\s*?\w{2,}
26+
;\s*?insert\s*?\w{2,}
27+
#\s*?insert\s*?\w{2,}
28+
--\s*?insert\s*?\w{2,}
29+
[^\w]SET\s*?@\w+
30+
and[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
31+
nand[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
32+
or[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
33+
xor[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
34+
xxor[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
35+
div[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
36+
like[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
37+
between[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
38+
not[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
39+
\|\|[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
40+
\&\&[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\"'`=()]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter\s*?\w+.*?character\s+set\s+\w+
2+
alter\s*?\w+.*?char\s+set\s+\w+
3+
[\"'`];*?\s*?waitfor\s+time\s+[\"'`]
4+
[\"'`];*?\s*?waitfor\s+delay\s+[\"'`]
5+
[\"'`];.*?:\s*?goto

0 commit comments

Comments
 (0)