PT-2023-2198 · Golang+11 · Mime/Multipart+12

Arpad Ryszka

+2

·

Published

2023-02-15

·

Updated

2024-11-14

·

CVE-2022-41725

CVSS v3.1

7.5

High

VectorAV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Name of the Vulnerable Software and Affected Versions GoLang net/http and mime/multipart (affected versions not specified)
Description A denial of service is possible from excessive resource consumption in net/http and mime/multipart. Multipart form parsing with mime/multipart.Reader.ReadForm can consume largely unlimited amounts of memory and disk files. This also affects form parsing in the net/http package with the Request methods FormFile, FormValue, ParseMultipartForm, and PostFormValue. The unconfigurable 10MB reserved for non-file parts is excessively large and can potentially open a denial of service vector on its own. However, ReadForm did not properly account for all memory consumed by a parsed form, such as map entry overhead, part names, and MIME headers, permitting a maliciously crafted form to consume well over 10MB. In addition, ReadForm contained no limit on the number of disk files created, permitting a relatively small request body to create a large number of disk temporary files. With the fix, ReadForm now properly accounts for various forms of memory overhead and creates at most one on-disk temporary file, combining multiple form parts into a single temporary file.
Recommendations To resolve the issue, users should update their GoLang net/http and mime/multipart packages to the latest version. As a temporary workaround, consider using the environment variable GODEBUG=multipartfiles=distinct to reenable the previous behavior of using distinct files for each form part. Restrict access to the mime/multipart.Reader.ReadForm function to minimize the risk of exploitation. Callers can limit the size of form data with http.MaxBytesReader. At the moment, there is no information about a newer version that contains a fix for this vulnerability.

DoS

Allocation of Resources Without Limits

Resource Exhaustion

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

ALSA-2023:3083
ALSA-2023:6346
ALSA-2023:6363
ALSA-2023:6402
ALSA-2023:6473
ALSA-2023:6474
ALSA-2023:6938
ALSA-2023:6939
ALT-PU-2023-1269
ALT-PU-2023-1323
ALT-PU-2023-4785
AZL-13732
AZL-13739
AZL-34761
AZL-37334
AZL-37487
AZL-78992
BDU:2023-01943
BIT-GOLANG-2022-41725
CESA-2023_3083
CESA-2023_6938
CESA-2023_6939
CVE-2022-41725
GO-2023-1569
MGASA-2023-0109
OESA-2023-1192
OPENSUSE-SU-2024:12707-1
OPENSUSE-SU-2024:12708-1
OPENSUSE-SU-2024:12798-1
RHSA-2023:1325
RHSA-2023:3083
RHSA-2023:3445
RHSA-2023:3450
RHSA-2023:3612
RHSA-2023:4003
RHSA-2023:4470
RHSA-2023:5964
RHSA-2023:6346
RHSA-2023:6363
RHSA-2023:6402
RHSA-2023:6473
RHSA-2023:6474
RHSA-2023:6938
RHSA-2023:6939
RHSA-2023:7672
RHSA-2023_3083
RHSA-2023_6346
RHSA-2023_6363
RHSA-2023_6402
RHSA-2023_6473
RHSA-2023_6474
RHSA-2023_6938
RHSA-2023_6939
RLSA-2023:3083
SUSE-SU-2023:0733-1
SUSE-SU-2023:0735-1
SUSE-SU-2023:0869-1
SUSE-SU-2023:0871-1
SUSE-SU-2023:2312-1
USN-6140-1
USN-7109-1
USN-7111-1

Affected Products

Alt Linux
Almalinux
Astra Linux
Centos
Debian
Linuxmint
Red Hat
Red Os
Rocky Linux
Suse
Ubuntu
Mime/Multipart
Net/Http