Skip to content

math/big: Rat.SetString may consume large amount of RAM and crash #50699

Closed

Description

@katiehockman

Unmarshaling a string into a *Rat may cause resource exhaustion, consuming a huge amount of RAM, which may cause a system to crash or timeout. This is reachable from (*Rat).SetString, (*Rat).UnmarshalText, (*Rat).Scan, and any other function that unmarshals a string into a (*Rat) such as constant.MakeFromLiteral.

Thanks to the OSS-Fuzz project for discovering this issue and to Emmanuel Odeke for reporting it.

This is CVE-2022-23772.

Activity

  1. added this to the Go1.18 milestone on Jan 19, 2022
  2. self-assigned this
    on Jan 19, 2022
  3. katiehockman commented on Jan 19, 2022

    @katiehockman
    ContributorAuthor

    @gopherbot please backport to 1.17 and 1.16 as this is a security issue.

  4. gopherbot commented on Jan 19, 2022

    @gopherbot
    Contributor

    Backport issue(s) opened: #50700 (for 1.16), #50701 (for 1.17).

    Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

  5. gopherbot commented on Jan 19, 2022

    @gopherbot
    Contributor

    Change https://golang.org/cl/379537 mentions this issue: math/big: prevent overflow in (*Rat).SetString

  6. dmitshur commented on Jan 26, 2022

    @dmitshur
    Member

    Ping as a release blocker. Is the CL fixing this issue ready to be submitted?

  7. odeke-em commented on Jan 26, 2022

    @odeke-em
    Member

    @dmitshur thank you for the ping! I've given the CL a +2, I shall wait for @katiehockman and the security team too.

  8. gopherbot commented on Jan 27, 2022

    @gopherbot
    Contributor

    Change https://golang.org/cl/381336 mentions this issue: [release-branch.go1.17] math/big: prevent overflow in (*Rat).SetString

  9. gopherbot commented on Jan 27, 2022

    @gopherbot
    Contributor

    Change https://golang.org/cl/381337 mentions this issue: [release-branch.go1.16] math/big: prevent overflow in (*Rat).SetString

  10. locked and limited conversation to collaborators on Jun 22, 2023
  11. added a commit that references this issue on Apr 29, 2024
    ad345c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions