CVE-2022-41725: Excessive resource consumption in mime/multipart
Summary
CVE-2022-41725: Excessive resource consumption in mime/multipart. Affects stdlib across 2 version ranges.
< 1.19.6
>= 1.20.0-0, < 1.20.1
Fixed in 1.19.6 or 1.20.1, depending on the release line you run. How to fix ↓
Also tracked for
- golang · Bitnami
- golang-1.15 · Debian:11
The same CVE-2022-41725 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The stdlib package in Go is a collection of standard libraries that provide fundamental functionality for Go programs. One of the packages in the stdlib is mime/multipart, which handles multipart form parsing. This package is used by the net/http package for form parsing in HTTP requests. The vulnerability in mime/multipart allows for excessive resource consumption, leading to a denial of service (DoS) attack.
Vulnerability Detail
The vulnerability arises from the ReadForm function in mime/multipart, which is responsible for parsing multipart form data. The function has a maxMemory parameter that limits the amount of memory used for storing form data. However, the function did not properly account for all memory consumed by a parsed form, allowing a maliciously crafted form to consume more memory than intended. Additionally, ReadForm did not limit the number of disk files created, allowing a small request body to create a large number of temporary files. These issues can lead to excessive resource consumption and potential DoS attacks.
How To Fix
Latest published version: go1.25.5 as of 22 Oct 2026
go get stdlib@vgo1.25.5
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 1.19.61.19.6go get stdlib@v1.19.6 -
>= 1.20.0-0, < 1.20.11.20.1go get stdlib@v1.20.1
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
There is no specific workaround mentioned for this vulnerability. However, developers can mitigate the risk by implementing rate limiting or request size limits in their applications to prevent excessive resource consumption. Additionally, monitoring and alerting systems can be put in place to detect and mitigate DoS attacks.
Conclusion
The vulnerability in mime/multipart that allowed for excessive resource consumption has been fixed in versions 1.19.6 and 1.20.1 of the stdlib package. Developers are advised to update their Go installation to the latest stable version to ensure the fix is applied. It is also recommended to implement additional security measures such as rate limiting and request size limits to mitigate the risk of DoS attacks. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for stdlib →
FAQ
The vulnerability allows for excessive resource consumption, which can lead to a denial of service (DoS) attack. An attacker can send a maliciously crafted form that consumes large amounts of memory and disk space, causing the system to become unresponsive.
You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. The playground analyzes your Gopkg.lock file and provides real-time alerts for open-source vulnerabilities in your software.
There are currently no known exploits for this vulnerability. However, it is important to patch your Go installation to the latest version to prevent potential attacks.
While updating Go to the latest version is the recommended solution, you can also mitigate the risk by implementing rate limiting or request size limits in your application. This can help prevent excessive resource consumption and mitigate the impact of a potential DoS attack.
Yes, you can enable the previous behavior of using distinct files for each form part by setting the environment variable GODEBUG=multipartfiles=distinct. However, it is important to note that this may increase the risk of resource consumption and should be used with caution.
References
Related vulnerabilities
Recent vulnerabilities recorded for stdlib.