Skip to content

x/text/language: ParseAcceptLanguage takes a long time to parse complex tags #56152

Closed

Description

@rolandshoemaker

The BCP 47 tag parser has quadratic time complexity due to inherent aspects of its design. Since the parser is, by design, exposed to untrusted user input, this can be leveraged to force a program to consume significant time parsing Accept-Language headers.

This is a PRIVATE issue for CVE-2022-32149, tracked in http://b/238189978 and fixed by http://tg/1565112

/cc @golang/security

Activity

  1. gopherbot commented on Oct 11, 2022

    @gopherbot
    Contributor

    Change https://go.dev/cl/442235 mentions this issue: language: reject excessively large Accept-Language strings

  2. changed the title [-]security: fix CVE-2022-32149[/-] [+]x/text/language: ParseAcceptLanguage takes a long time to parse complex tags[/+] on Oct 11, 2022
  3. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Oct 11, 2022
  4. added this to the Unreleased milestone on Oct 11, 2022
  5. added a commit that references this issue on Oct 26, 2022
  6. added a commit that references this issue on Feb 25, 2023
  7. maariitsme commented on Jul 24, 2023

    @maariitsme

    Hi Team
    @rolandshoemaker @gopherbot @dmitshur @evanphx
    It is patched in which golang version?

  8. ianlancetaylor commented on Jul 25, 2023

    @ianlancetaylor
    Contributor

    This was fixed in the golang.org/x/text repository. It's not in any particular Go release. I think the first revision of golang.org/x/text with the fix is v0.4.0.

  9. added a commit that references this issue on Jan 30, 2024
    434eadc
  10. ChrisZhangJin commented on Apr 3, 2024

    @ChrisZhangJin

    yes, it is fixed in golang.org/x/text repository, and it is not in any particular Go release. but there is reference relationship between the go version and x/text version.

    when i run go mod graph in the src of go(any version), i can see the dependencies like this

    go mod graph | grep text
    
    std golang.org/x/text@v0.11.0
    golang.org/x/crypto@v0.11.1-0.20230711161743-2e82bdd1719d golang.org/x/text@v0.11.0
    golang.org/x/net@v0.12.1-0.20231027154334-5ca955b1789c golang.org/x/text@v0.11.0
    golang.org/x/text@v0.11.0 golang.org/x/tools@v0.6.0
    golang.org/x/text@v0.11.0 golang.org/x/mod@v0.8.0
    golang.org/x/text@v0.11.0 golang.org/x/sys@v0.5.0
    

    the text version was referred in the source code, i think. even if i upgrade the version of the x/text, how can i handle this part?

  11. neild commented on Apr 3, 2024

    @neild
    Contributor

    Nothing in the Go standard library uses this function, so no versions of Go itself are affected.

  12. locked and limited conversation to collaborators on Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.Security

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions