From b3608f33caadff2e355b8d0cda66f66b2a38ae3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0tampar?= Date: Thu, 12 Nov 2026 19:25:55 +0100 Subject: [PATCH] Fix for --oob-server with scheme (e.g. 'https://https://host/register') and self-signed certificates --- lib/core/settings.py | 2 +- lib/request/interactsh.py | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 9f2a30edc..e405a32ba 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.78" +VERSION = "1.10.11.79" 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/interactsh.py b/lib/request/interactsh.py index f7faa5bc4..4c58097d8 100644 --- a/lib/request/interactsh.py +++ b/lib/request/interactsh.py @@ -49,6 +49,16 @@ class Interactsh(object): def __init__(self, server=None, token=None): self.server = None self.token = token or conf.get("oobToken") + self._scheme = "https" + self._ownServer = bool(server) + + # Note: explicitly provided server can come with a scheme (e.g. 'http://oob.example.com/') - the rest is used as the (callback) host + if server: + server = server.strip() + for scheme in ("https", "http"): + if server.lower().startswith("%s://" % scheme): + self._scheme, server = scheme, server[len(scheme) + len("://"):] + server = server.rstrip('/') # Note: (private) token belongs only to an explicitly provided server (i.e. never to be sent to a public one) if self.token and not server: @@ -78,12 +88,15 @@ class Interactsh(object): if not candidate: continue body = json.dumps({"public-key": pubKey, "secret-key": self.secret, "correlation-id": self.correlationId}) - if self._request("https://%s/register" % candidate, post=body): + if self._request("%s://%s/register" % (self._scheme, candidate), post=body): self.server = candidate self.registered = True logger.debug("registered with OOB interaction server '%s'" % candidate) break + if self._ownServer and not self.registered: + logger.warning("unable to register with the provided OOB server '%s://%s'" % (self._scheme, server)) + def _request(self, url, post=None): """Direct request to the interactsh server (a fixed service, never the target). Self-contained on urllib so it works regardless of sqlmap's request-stack init @@ -103,11 +116,10 @@ class Interactsh(object): handlers = [] try: - # Verify TLS for the (public, valid-cert) interaction server by default; - # only skip verification when the user has globally opted out (--force-ssl-verify - # off / verifyCert False), matching sqlmap's own TLS posture. + # Note: TLS is verified for the (built-in) public interaction servers, while the explicitly + # provided (own) server is treated as any other target (i.e. self-signed certificates are fine) context = ssl.create_default_context() - if conf.get("verifyCert") is False: + if getattr(self, "_ownServer", False): context.check_hostname = False context.verify_mode = ssl.CERT_NONE handlers.append(HTTPSHandler(context=context)) @@ -265,7 +277,7 @@ class Interactsh(object): if not self.registered: return [] - page = self._request("https://%s/poll?id=%s&secret=%s" % (self.server, self.correlationId, self.secret)) + page = self._request("%s://%s/poll?id=%s&secret=%s" % (getattr(self, "_scheme", "https"), self.server, self.correlationId, self.secret)) if not page: return [] @@ -346,7 +358,7 @@ class Interactsh(object): def _deregister(self): if self.registered: body = json.dumps({"correlation-id": self.correlationId, "secret-key": self.secret}) - self._request("https://%s/deregister" % self.server, post=body) + self._request("%s://%s/deregister" % (getattr(self, "_scheme", "https"), self.server), post=body) self.registered = False