From 2bfb53876ce8496237643a04404930564cf7f51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0tampar?= Date: Thu, 12 Nov 2026 17:34:32 +0100 Subject: [PATCH] Fix for --live-cookies overwriting injected Cookie parameter --- lib/core/settings.py | 2 +- lib/request/connect.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index f3b960576..bc6276c15 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.70" +VERSION = "1.10.11.71" 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 2cbdb7982..69164c37a 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -425,8 +425,18 @@ class Connect(object): raise SqlmapValueException(errMsg) with openFile(conf.liveCookies) as f: - cookie = f.read().strip() - cookie = re.sub(r"(?i)\ACookie:\s*", "", cookie) + live = re.sub(r"(?i)\ACookie:\s*", "", f.read().strip()) + + # Note: (live) values are taken, except for the cookie(s) currently carrying the payload (i.e. differing from the original value) + delimiter = conf.cookieDel or DEFAULT_COOKIE_DELIMITER + original = conf.paramDict.get(PLACE.COOKIE) or {} + for part in (cookie or "").split(delimiter): + name, _, value = part.strip().partition('=') + if name in original and value != original[name]: + regex = r"(\A|(?<=[%s\s]))%s=[^%s]*" % (re.escape(delimiter), re.escape(name), re.escape(delimiter)) + live = re.sub(regex, lambda match: "%s=%s" % (name, value), live) if re.search(regex, live) else "%s%s %s=%s" % (live, delimiter, name, value) + + cookie = live if multipart: post = multipart