From a4ebd5418fb9c2936680e6c488e7fcf3b85331b5 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 5 Jul 2017 12:15:14 +0200 Subject: [PATCH] Patch for an Issue reported privately via email --- lib/core/settings.py | 2 +- lib/request/inject.py | 6 +++++- txt/checksum.md5 | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 9f2badec3..51bf04014 100755 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.1.7.5" +VERSION = "1.1.7.6" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/lib/request/inject.py b/lib/request/inject.py index c51cdb735..baa946949 100644 --- a/lib/request/inject.py +++ b/lib/request/inject.py @@ -345,6 +345,10 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser kb.safeCharEncode = safeCharEncode kb.resumeValues = resumeValue + # Note: following keywords are expected to be in uppercase + for keyword in ("SELECT", "FROM", "WHERE"): + expression = re.sub("(?i)(\A|\(|\)|\s)%s(\Z|\(|\)|\s)" % keyword, r"\g<1>%s\g<2>" % keyword, expression) + if suppressOutput is not None: pushValue(getCurrentThreadData().disableStdOut) getCurrentThreadData().disableStdOut = suppressOutput @@ -356,7 +360,7 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser if expected == EXPECTED.BOOL: forgeCaseExpression = booleanExpression = expression - if expression.upper().startswith("SELECT "): + if expression.startswith("SELECT "): booleanExpression = "(%s)=%s" % (booleanExpression, "'1'" if "'1'" in booleanExpression else "1") else: forgeCaseExpression = agent.forgeCaseStatement(expression) diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 709bca709..5eef9f66b 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -46,7 +46,7 @@ b9ff4e622c416116bee6024c0f050349 lib/core/enums.py d8e9250f3775119df07e9070eddccd16 lib/core/replication.py 785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py 40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py -ab9636352fc61fcb89683d45b2f895e8 lib/core/settings.py +7d6af4ab9aa4b6c10cefe0062409a228 lib/core/settings.py d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py 2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py baa3f47efa6701076d026e43a6874a51 lib/core/target.py @@ -73,7 +73,7 @@ fb6b788d0016ab4ec5e5f661f0f702ad lib/request/direct.py cc1163d38e9b7ee5db2adac6784c02bb lib/request/dns.py 5dcdb37823a0b5eff65cd1018bcf09e4 lib/request/httpshandler.py 310efc965c862cfbd7b0da5150a5ad36 lib/request/__init__.py -70ec3f5bce37cdd7bf085ba2ddda30ac lib/request/inject.py +62b01fc81e0ee708d1b92add612f659e lib/request/inject.py dc1e0af84ee8eb421797d61c8cb8f172 lib/request/methodrequest.py bb9c165b050f7696b089b96b5947fac3 lib/request/pkihandler.py 602d4338a9fceaaee40c601410d8ac0b lib/request/rangehandler.py