Skip to content

encoding/asn1: pre-allocating memory when parsing DER payload can cause memory exhaustion (CVE-2025-58185) #75671

Closed

Description

@nicholashusin

When parsing DER payloads, memories were being allocated prior to fully validating the payloads.
This permits an attacker to craft a big empty DER payload to cause memory exhaustion in functions such as asn1.Unmarshal, x509.ParseCertificateRequest, and ocsp.ParseResponse.

Thanks to Jakub Ciolek for reporting this issue.

This is CVE-2025-58185 and Go issue https://go.dev/issue/75671.


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

/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 and removed
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Sep 30, 2025
  3. modified the milestones: Go1.25.2, Go1.26 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: #75704 (for 1.24), #75705 (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/709841 mentions this issue: [release-branch.go1.24] encoding/asn1: prevent memory exhaustion when parsing using internal/saferio

  8. gopherbot commented on Oct 7, 2025

    @gopherbot
    Contributor

    Change https://go.dev/cl/709856 mentions this issue: encoding/asn1: prevent memory exhaustion when parsing using internal/saferio

  9. gopherbot commented on Oct 7, 2025

    @gopherbot
    Contributor

    Change https://go.dev/cl/709850 mentions this issue: [release-branch.go1.25] encoding/asn1: prevent memory exhaustion when parsing using internal/saferio

  10. changed the title [-]security: fix CVE-2025-58185[/-] [+]encoding/asn1: pre-allocating memory when parsing DER payload can cause memory exhaustion (CVE-2025-58185)[/+] 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