introducing [DELAYED] for heavy query time based payloads when response time is non-deterministic

This commit is contained in:
Miroslav Stampar 2010-12-07 00:27:26 +00:00
parent 32f1909131
commit 61f82fd274
4 changed files with 40 additions and 39 deletions

View file

@ -45,6 +45,8 @@ from lib.core.exception import sqlmapSiteTooDynamic
from lib.core.exception import sqlmapUserQuitException
from lib.core.session import setString
from lib.core.session import setRegexp
from lib.core.settings import TIME_MIN_DELTA
from lib.core.settings import TIME_N_RESPONSE
from lib.request.connect import Connect as Request
from plugins.dbms.firebird.syntax import Syntax as Firebird
from plugins.dbms.postgresql.syntax import Syntax as PostgreSQL
@ -351,11 +353,23 @@ def checkSqlInjection(place, parameter, value):
_ = Request.queryPage(reqPayload, place)
duration = calculateDeltaSeconds(start)
if duration >= conf.timeSec:
infoMsg = "%s parameter '%s' is '%s' injectable " % (place, parameter, title)
logger.info(infoMsg)
if check.isdigit():
if duration >= int(check):
infoMsg = "%s parameter '%s' is '%s' injectable " % (place, parameter, title)
logger.info(infoMsg)
injectable = True
injectable = True
elif check == "[DELAYED]":
if duration >= max(TIME_MIN_DELTA, TIME_N_RESPONSE * kb.responseTime):
import pdb
pdb.set_trace()
infoMsg = "%s parameter '%s' is '%s' injectable " % (place, parameter, title)
logger.info(infoMsg)
injectable = True
else:
import pdb
pdb.set_trace()
# Restore old value of socket timeout
socket.setdefaulttimeout(popValue())

View file

@ -1281,7 +1281,7 @@ def calculateDeltaSeconds(start, epsilon=0.1):
Returns elapsed time from start till now (including expected
error set by epsilon parameter)
"""
return int(time.time() - start - kb.responseTime + epsilon)
return time.time() - start - kb.responseTime + epsilon
def initCommonOutputs():
kb.commonOutputs = {}

View file

@ -48,6 +48,11 @@ DUMP_STOP_MARKER = "__STOP__"
PAYLOAD_DELIMITER = "\x00"
# settings used for delayed time payloads
TIME_MIN_DELTA = 1 # minimum difference of loading time in seconds
TIME_N_RESPONSE = 3 # minimum multiplicant of response time
# System variables
IS_WIN = subprocess.mswindows
# The name of the operating system dependent module imported. The following