diff --git a/lib/core/settings.py b/lib/core/settings.py index ce7abd4e0..e1dea6b20 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from thirdparty import six # sqlmap version (...) -VERSION = "1.10.11.28" +VERSION = "1.10.11.29" 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/basic.py b/lib/request/basic.py index f7a5c164b..7e1265070 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -121,7 +121,10 @@ def forgeHeaders(items=None, base=None): if cookie is None or cookie.domain_specified and not ((conf.hostname or "").endswith(cookie.domain) or (conf.hostname or "") == cookie.domain.lstrip('.')): continue - if ("%s=" % getUnicode(cookie.name)) in getUnicode(headers[HTTP_HEADER.COOKIE]): + # Note: cookie name has to start right after a delimiter (e.g. server's 'id' must not match inside user's 'x-id=2') + boundary = r"(?:\A|(?<=[%s\s]))" % re.escape(conf.cookieDel or DEFAULT_COOKIE_DELIMITER) + + if re.search(r"%s%s=" % (boundary, re.escape(getUnicode(cookie.name))), getUnicode(headers[HTTP_HEADER.COOKIE])): if conf.loadCookies: conf.httpHeaders = filterNone((item if item[0] != HTTP_HEADER.COOKIE else None) for item in conf.httpHeaders) elif kb.mergeCookies is None: @@ -134,7 +137,7 @@ def forgeHeaders(items=None, base=None): if kb.mergeCookies and kb.injection.place != PLACE.COOKIE: def _(value): - return re.sub(r"(?i)\b%s=[^%s]+" % (re.escape(getUnicode(cookie.name)), conf.cookieDel or DEFAULT_COOKIE_DELIMITER), ("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value))).replace('\\', r'\\'), value) + return re.sub(r"(?i)%s%s=[^%s]+" % (boundary, re.escape(getUnicode(cookie.name)), conf.cookieDel or DEFAULT_COOKIE_DELIMITER), ("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value))).replace('\\', r'\\'), value) headers[HTTP_HEADER.COOKIE] = _(headers[HTTP_HEADER.COOKIE])