From d42187ac472003582af4d4dcbd3d49520f822443 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 9 Jan 2024 09:36:49 +0100 Subject: [PATCH] Revert "Improved Multipart Form handling (#5598)" (#5599) This reverts commit 93a8828dab153a52684d424e88e3c738a3ac2b74. --- lib/core/target.py | 2 +- thirdparty/multipart/multipartpost.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/core/target.py b/lib/core/target.py index 67fbf2f26..f46fe2022 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -226,7 +226,7 @@ def _setRequestParams(): if not (kb.processUserMarks and kb.customInjectionMark in conf.data): conf.data = getattr(conf.data, UNENCODED_ORIGINAL_VALUE, conf.data) conf.data = conf.data.replace(kb.customInjectionMark, ASTERISK_MARKER) - conf.data = re.sub(r"(?si)((Content-Disposition[^\n]+?name\s*=\s*[\"']?(?P[^\"'\r\n]+)[\"']?).+?)((%s)--)" % ("\r\n" if "\r\n" in conf.data else '\n'), lambda match: match.group(1) + (kb.customInjectionMark if 'filename' not in match.group(0) else '') + match.group(4), conf.data) + conf.data = re.sub(r"(?si)((Content-Disposition[^\n]+?name\s*=\s*[\"']?(?P[^\"'\r\n]+)[\"']?).+?)((%s)+--)" % ("\r\n" if "\r\n" in conf.data else '\n'), functools.partial(process, repl=r"\g<1>%s\g<4>" % kb.customInjectionMark), conf.data) if not kb.postHint: if kb.customInjectionMark in conf.data: # later processed diff --git a/thirdparty/multipart/multipartpost.py b/thirdparty/multipart/multipartpost.py index b139c172e..5ea37ccf7 100644 --- a/thirdparty/multipart/multipartpost.py +++ b/thirdparty/multipart/multipartpost.py @@ -74,10 +74,6 @@ class MultipartPostHandler(_urllib.request.BaseHandler): part = match.group(0) if b'\r' not in part: request.data = request.data.replace(part, part.replace(b'\n', b"\r\n")) - for match in re.finditer(b"(Content-Type[^\\n]+[\\n|\\r|\\r\\n]+)",request.data): - part = match.group(0) - if b'\r' not in part: - request.data = request.data.replace(part, part.replace(b'\n', b"\r\n")) return request