CVE-2022-32189: Panic when decoding Float and Rat types in math/big
Summary
CVE-2022-32189: Panic when decoding Float and Rat types in math/big. Affects stdlib across 2 version ranges.
< 1.17.13
>= 1.18.0-0, < 1.18.5
Fixed in 1.17.13 or 1.18.5, depending on the release line you run. How to fix ↓
Also tracked for
- golang · Bitnami
- golang-1.15 · Debian:11
The same CVE-2022-32189 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 the Go ecosystem provides a set of standard libraries for the Go programming language. One of the packages included is math/big, which offers arbitrary-precision arithmetic for big floating-point and rational numbers. These types are commonly used for precise calculations in various applications.
Vulnerability Detail
The vulnerability, identified as CVE-2022-32189, occurs when decoding big.Float and big.Rat types. If the encoded message is too short, it can trigger a panic, potentially leading to a denial of service. This vulnerability can be exploited by an attacker to disrupt the functioning of an application that relies on these types for calculations.
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.17.131.17.13go get stdlib@v1.17.13 -
>= 1.18.0-0, < 1.18.51.18.5go get stdlib@v1.18.5
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a workaround, developers can implement input validation to check the length of the encoded message before decoding it. By verifying that the message has sufficient length, the panic can be avoided. Here is an example of how to perform input validation in Go:
import (
"math/big"
"errors"
)
func decodeFloat(encoded []byte) (*big.Float, error) {
if len(encoded) < 8 {
return nil, errors.New("Encoded message is too short")
}
var f big.Float
err := f.GobDecode(encoded)
if err != nil {
return nil, err
}
return &f, nil
}
Conclusion
In conclusion, the CVE-2022-32189 vulnerability in the Go stdlib package's math/big module can result in a panic when decoding Float and Rat types. This can lead to a denial of service, impacting the stability and availability of applications that rely on these types. It is crucial to update the package to the recommended versions or implement input validation to mitigate the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for stdlib →
FAQ
The vulnerability can lead to a denial of service, potentially causing the affected application to crash or become unresponsive.
Versions prior to 1.17.13 and 1.18.5 are affected by this vulnerability.
There are no known exploits for this vulnerability at the time of this report.
Yes, updating the Go stdlib package to version 1.17.13 or later, or version 1.18.5 or later, will fix this vulnerability.
Yes, implementing input validation to check the length of the encoded message before decoding can mitigate this vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for stdlib.