Fix for --http2 silently ignoring HTTP authentication (Basic sent preemptively, others rejected)

This commit is contained in:
Miroslav Štampar 2026-11-12 17:20:51 +01:00
parent cdb787faea
commit 04f0987e81
3 changed files with 10 additions and 1 deletions

View file

@ -2894,6 +2894,11 @@ def _basicOptionValidation():
errMsg = "HTTP/2 support is currently incompatible with SOCKS/Tor proxies"
raise SqlmapSyntaxException(errMsg)
# Note: native HTTP/2 client bypasses urllib's (challenge-response) authentication handlers (only Basic is sent preemptively)
if conf.http2 and ((conf.authType or "").lower() not in ("", AUTH_TYPE.BASIC, AUTH_TYPE.BEARER) or conf.authFile):
errMsg = "HTTP/2 support is currently incompatible with HTTP authentication type '%s'" % (conf.authType or AUTH_TYPE.PKI)
raise SqlmapSyntaxException(errMsg)
if conf.uValues and conf.uChar:
errMsg = "option '--union-values' is incompatible with option '--union-char'"
raise SqlmapSyntaxException(errMsg)

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.66"
VERSION = "1.10.11.67"
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

@ -736,6 +736,10 @@ class Connect(object):
from lib.request.http2 import open_url as http2OpenUrl
from lib.request.http2 import proxy_tuple
# Note: (preemptive) Basic authentication, as urllib's handlers are bypassed
if (conf.authType or "").lower() == AUTH_TYPE.BASIC and conf.authUsername is not None and HTTP_HEADER.AUTHORIZATION not in headers:
headers[HTTP_HEADER.AUTHORIZATION] = "Basic %s" % encodeBase64("%s:%s" % (conf.authUsername, conf.authPassword or ""), binary=False)
try:
h2proxy = proxy_tuple(conf.proxy, conf.proxyCred)
except ValueError: