CVE-2022-32189: Panic when decoding Float and Rat types in math/big

stdlib Updated 02 Oct 2025

Summary

01/08/2022
Yes i
Unrated
Not published

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

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

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.13 1.17.13
    go get stdlib@v1.17.13
  • >= 1.18.0-0, < 1.18.5 1.18.5
    go 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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for stdlib.

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.13 1.17.13
    go get stdlib@v1.17.13
  • >= 1.18.0-0, < 1.18.5 1.18.5
    go 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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback