Fix for vulnserver double decoding POST parameters (e.g. encoded '&' splitting values)

This commit is contained in:
Miroslav Štampar 2026-11-12 20:06:17 +01:00
parent bd8df65b53
commit f4a4ae5027
2 changed files with 5 additions and 3 deletions

View file

@ -1227,7 +1227,8 @@ class ReqHandler(BaseHTTPRequestHandler):
params.update(dict((_[0], _[1].replace("&apos;", "'").replace("&quot;", '"').replace("&lt;", '<').replace("&gt;", '>').replace("&amp;", '&')) for _ in re.findall(r'name="([^"]+)" value="([^"]*)"', self.data)))
else:
self.data = self.data.replace(';', '&') # Note: seems that Python3 started ignoring parameter splitting with ';'
params.update(parse_qs(self.data))
# Note: parsing the raw (i.e. not yet URL decoded) body, otherwise encoded '&'/'=' inside values would split them
params.update(parse_qs((getattr(self, "rawData", None) or self.data).replace(';', '&')))
for name in self.headers:
params[name.lower()] = self.headers[name]
@ -1748,7 +1749,8 @@ class ReqHandler(BaseHTTPRequestHandler):
length = int(self.headers.get("Content-length", 0))
if length:
data = self.rfile.read(length)
data = unquote_plus(data.decode(UNICODE_ENCODING, "ignore"))
self.rawData = data.decode(UNICODE_ENCODING, "ignore")
data = unquote_plus(self.rawData)
self.data = data
elif self.headers.get("Transfer-encoding") == "chunked":
data, line = b"", b""

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.85"
VERSION = "1.10.11.86"
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)