Adding support for domain cookies

This commit is contained in:
Miroslav Štampar 2026-07-19 17:55:45 +02:00
parent 47e98a02d0
commit 69c8a94be4
3 changed files with 59 additions and 2 deletions

View file

@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.7.138"
VERSION = "1.10.7.139"
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)

View file

@ -108,7 +108,10 @@ def forgeHeaders(items=None, base=None):
if conf.cj:
if HTTP_HEADER.COOKIE in headers:
for cookie in conf.cj:
if cookie is None or cookie.domain_specified and not (conf.hostname or "").endswith(cookie.domain):
# Note: a domain-scoped cookie (Domain=example.com) is stored by the cookie jar as
# '.example.com', so a plain endswith() wrongly excludes the apex host itself
# ('example.com' does not end with '.example.com'); accept the exact domain too
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]):