mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-08 23:59:06 +00:00
One more commit related to the last one (reduce false hopes in heavily dynamic cases)
This commit is contained in:
@@ -508,14 +508,14 @@ def checkSqlInjection(place, parameter, value):
|
||||
errorResult = Request.queryPage(errorPayload, place, raise404=False)
|
||||
if errorResult:
|
||||
continue
|
||||
elif not any((conf.string, conf.notString, conf.regexp, conf.code, kb.nullConnection)):
|
||||
elif kb.heuristicPage and not any((conf.string, conf.notString, conf.regexp, conf.code, kb.nullConnection)):
|
||||
_ = comparison(kb.heuristicPage, None, getRatioValue=True)
|
||||
if _ > kb.matchRatio:
|
||||
kb.matchRatio = _
|
||||
logger.debug("adjusting match ratio for current parameter to %.3f" % kb.matchRatio)
|
||||
|
||||
# Reducing false-positive "appears" messages in heavily dynamic environment
|
||||
if kb.heavyDynamic and not Request.queryPage(reqPayload, place, raise404=False):
|
||||
if kb.heavilyDynamic and not Request.queryPage(reqPayload, place, raise404=False):
|
||||
continue
|
||||
|
||||
injectable = True
|
||||
@@ -986,6 +986,11 @@ def heuristicCheckSqlInjection(place, parameter):
|
||||
logger.debug(debugMsg)
|
||||
return None
|
||||
|
||||
if kb.heavilyDynamic:
|
||||
debugMsg = "heuristic check skipped because of heavy dynamicity"
|
||||
logger.debug(debugMsg)
|
||||
return None
|
||||
|
||||
origValue = conf.paramDict[place][parameter]
|
||||
paramType = conf.method if conf.method not in (None, HTTPMETHOD.GET, HTTPMETHOD.POST) else place
|
||||
|
||||
@@ -1048,6 +1053,8 @@ def heuristicCheckSqlInjection(place, parameter):
|
||||
kb.ignoreCasted = readInput(message, default='Y' if conf.multipleTargets else 'N', boolean=True)
|
||||
|
||||
elif result:
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
infoMsg += "be injectable"
|
||||
if Backend.getErrorParsedDBMSes():
|
||||
infoMsg += " (possible DBMS: '%s')" % Format.getErrorParsedDBMSes()
|
||||
@@ -1172,7 +1179,7 @@ def checkDynamicContent(firstPage, secondPage):
|
||||
warnMsg += "sqlmap is going to retry the request(s)"
|
||||
singleTimeLogMessage(warnMsg, logging.CRITICAL)
|
||||
|
||||
kb.heavyDynamic = True
|
||||
kb.heavilyDynamic = True
|
||||
|
||||
secondPage, _, _ = Request.queryPage(content=True)
|
||||
findDynamicContent(firstPage, secondPage)
|
||||
|
||||
@@ -1945,7 +1945,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.forcePartialUnion = False
|
||||
kb.forceWhere = None
|
||||
kb.futileUnion = None
|
||||
kb.heavyDynamic = False
|
||||
kb.heavilyDynamic = False
|
||||
kb.headersFp = {}
|
||||
kb.heuristicDbms = None
|
||||
kb.heuristicExtendedDbms = None
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||
from lib.core.enums import OS
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.2.3.50"
|
||||
VERSION = "1.2.3.51"
|
||||
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)
|
||||
|
||||
@@ -54,7 +54,7 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
|
||||
query = agent.suffixQuery(query, suffix=suffix, comment=comment)
|
||||
payload = agent.payload(newValue=query, place=place, parameter=parameter, where=where)
|
||||
page, headers, code = Request.queryPage(payload, place=place, content=True, raise404=False)
|
||||
return not any(re.search(_, page or "", re.I) and not re.search(_, kb.pageTemplate or "", re.I) for _ in ("(warning|error):", "order by", "unknown column", "failed")) and not kb.heavyDynamic and comparison(page, headers, code) or re.search(r"data types cannot be compared or sorted", page or "", re.I) is not None
|
||||
return not any(re.search(_, page or "", re.I) and not re.search(_, kb.pageTemplate or "", re.I) for _ in ("(warning|error):", "order by", "unknown column", "failed")) and not kb.heavilyDynamic and comparison(page, headers, code) or re.search(r"data types cannot be compared or sorted", page or "", re.I) is not None
|
||||
|
||||
if _orderByTest(1 if lowerCount is None else lowerCount) and not _orderByTest(randomInt() if upperCount is None else upperCount + 1):
|
||||
infoMsg = "'ORDER BY' technique appears to be usable. "
|
||||
|
||||
Reference in New Issue
Block a user