From fe2042ea58da2cef804a022d670bb2bd9ab36577 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 4 Aug 2022 08:57:35 +0200 Subject: [PATCH 1/2] Fixes #5152 --- lib/core/settings.py | 2 +- lib/request/connect.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index d444efd6a23..518cb47771e 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.6.7.2" +VERSION = "1.6.8.0" 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/connect.py b/lib/request/connect.py index f862b18fc9c..0e6eae9b55e 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -1544,7 +1544,10 @@ def _(value): if payload is None: value = value.replace(kb.customInjectionMark, "") else: - value = re.sub(r"\w*%s" % re.escape(kb.customInjectionMark), payload, value) + try: + value = re.sub(r"\w*%s" % re.escape(kb.customInjectionMark), payload, value) + except re.error: + value = re.sub(r"\w*%s" % re.escape(kb.customInjectionMark), re.escape(payload), value) return value page, headers, code = Connect.getPage(url=_(kb.secondReq[0]), post=_(kb.secondReq[2]), method=kb.secondReq[1], cookie=kb.secondReq[3], silent=silent, auxHeaders=dict(auxHeaders, **dict(kb.secondReq[4])), response=response, raise404=False, ignoreTimeout=timeBasedCompare, refreshing=True) From 7e425d4c9bd049a296bb491e3cdc90f57267bf18 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 4 Aug 2022 09:20:52 +0200 Subject: [PATCH 2/2] Fixes #5154 --- lib/controller/checks.py | 9 ++++++--- lib/core/settings.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 809a0e70153..f80cdfd27b1 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -271,15 +271,18 @@ def checkSqlInjection(place, parameter, value): logger.debug(debugMsg) continue - if kb.dbmsFilter and not intersect(payloadDbms, kb.dbmsFilter, True): + elif kb.dbmsFilter and not intersect(payloadDbms, kb.dbmsFilter, True): debugMsg = "skipping test '%s' because " % title debugMsg += "its declared DBMS is different than provided" logger.debug(debugMsg) continue + elif kb.reduceTests == False: + pass + # Skip DBMS-specific test if it does not match the # previously identified DBMS (via DBMS-specific payload) - if injection.dbms and not intersect(payloadDbms, injection.dbms, True): + elif injection.dbms and not intersect(payloadDbms, injection.dbms, True): debugMsg = "skipping test '%s' because " % title debugMsg += "its declared DBMS is different than identified" logger.debug(debugMsg) @@ -287,7 +290,7 @@ def checkSqlInjection(place, parameter, value): # Skip DBMS-specific test if it does not match the # previously identified DBMS (via DBMS-specific error message) - if kb.reduceTests and not intersect(payloadDbms, kb.reduceTests, True): + elif kb.reduceTests and not intersect(payloadDbms, kb.reduceTests, True): debugMsg = "skipping test '%s' because the heuristic " % title debugMsg += "tests showed that the back-end DBMS " debugMsg += "could be '%s'" % unArrayizeValue(kb.reduceTests) diff --git a/lib/core/settings.py b/lib/core/settings.py index 518cb47771e..1f1f80a5358 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.6.8.0" +VERSION = "1.6.8.1" 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)