Skip to content

net/http: lack of limit when parsing cookies can cause memory exhaustion (CVE-2025-58186) #75672

Closed

Description

@nicholashusin

Despite HTTP headers having a default limit of 1 MB, the number of cookies that can be parsed did not have a limit.
By sending a lot of very small cookies such as "a=;", an attacker can make an HTTP server allocate a large amount of structs, causing large memory consumption.

net/http now limits the number of cookies accepted to 3000, which can be adjusted using the httpcookiemaxnum GODEBUG option.

Thanks to jub0bs for reporting this issue.

This is CVE-2025-58186 and Go issue https://go.dev/issue/75672.


This is a PRIVATE issue for CVE-2025-58186, tracked in http://b/442560983 and fixed by https://go-internal-review.git.corp.google.com/c/go/+/2720.

/cc @golang/security and @golang/release

Activity

  1. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Sep 30, 2025
  2. added this to the Go1.26 milestone on Sep 30, 2025
  3. removed
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Sep 30, 2025
  4. neild commented on Oct 1, 2025

    @neild
    Contributor

    @gopherbot please open backport issues for this security fix

  5. gopherbot commented on Oct 1, 2025

    @gopherbot
    Contributor

    Backport issue(s) opened: #75706 (for 1.24), #75707 (for 1.25).

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

  6. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Oct 2, 2025
  7. gopherbot commented on Oct 7, 2025

    @gopherbot
    Contributor

    Change https://go.dev/cl/709840 mentions this issue: [release-branch.go1.24] net/http: add httpcookiemaxnum GODEBUG option to limit number of cookies parsed

  8. gopherbot commented on Oct 7, 2025

    @gopherbot
    Contributor

    Change https://go.dev/cl/709849 mentions this issue: [release-branch.go1.25] net/http: add httpcookiemaxnum GODEBUG option to limit number of cookies parsed

  9. gopherbot commented on Oct 7, 2025

    @gopherbot
    Contributor

    Change https://go.dev/cl/709855 mentions this issue: net/http: add httpcookiemaxnum GODEBUG option to limit number of cookies parsed

  10. changed the title [-]security: fix CVE-2025-58186[/-] [+]net/http: lack of limit when parsing cookies can cause memory exhaustion (CVE-2025-58186)[/+] on Oct 7, 2025
  11. locked and limited conversation to collaborators on Oct 8, 2026
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