Fix for --auth-file (PKI) failing on self-signed/internal CA certificates

This commit is contained in:
Miroslav Štampar 2026-11-12 17:01:24 +01:00
parent 175dc5dfa4
commit 9d5259ff98
2 changed files with 4 additions and 1 deletions

View file

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

@ -37,6 +37,9 @@ class HTTPSPKIAuthHandler(_urllib.request.HTTPSHandler):
try:
if ssl and hasattr(ssl, "SSLContext") and hasattr(ssl, "create_default_context"):
ctx = ssl.create_default_context()
# Note: no server certificate validation (e.g. self-signed/internal CA), as everywhere else (e.g. httpshandler.py)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
ctx.load_cert_chain(certfile=self.auth_file, keyfile=self.auth_file)
try:
return _http_client.HTTPSConnection(host, timeout=timeout, context=ctx)