From 596fff48ad89017272f36941f5cb24b7b2fd1fc3 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 17 Jun 2020 20:56:50 +0200 Subject: [PATCH] Fixes #4235 --- lib/core/settings.py | 2 +- thirdparty/multipart/multipartpost.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 41af7bbad..4d6c6d53d 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.4.6.10" +VERSION = "1.4.6.11" 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/thirdparty/multipart/multipartpost.py b/thirdparty/multipart/multipartpost.py index d458cfa60..9c52154f8 100644 --- a/thirdparty/multipart/multipartpost.py +++ b/thirdparty/multipart/multipartpost.py @@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import io import mimetypes import os +import re import stat import sys @@ -67,6 +68,14 @@ class MultipartPostHandler(_urllib.request.BaseHandler): request.add_unredirected_header("Content-Type", contenttype) request.data = data + + # NOTE: https://github.com/sqlmapproject/sqlmap/issues/4235 + if request.data: + for match in re.finditer(r"(?i)\s*-{20,}\w+(\s+Content-Disposition[^\n]+\s+|\-\-\s*)", request.data): + part = match.group(0) + if '\r' not in part: + request.data = request.data.replace(part, part.replace("\n", "\r\n")) + return request def multipart_encode(self, vars, files, boundary=None, buf=None):