CVE-2025-58185 Overview
CVE-2025-58185 affects the Go programming language standard library's Distinguished Encoding Rules (DER) parser. A maliciously crafted DER payload can cause the parser to allocate excessive amounts of memory, leading to memory exhaustion and denial of service. The flaw is tracked upstream as GO-2025-4011 and is categorized under CWE-770: Allocation of Resources Without Limits or Throttling.
The vulnerability is exploitable over the network with low attack complexity and requires no authentication or user interaction. Applications written in Go that decode untrusted DER-encoded data, such as X.509 certificates or other ASN.1 structures, are at risk.
Critical Impact
Remote attackers can send crafted DER input to Go-based services to trigger uncontrolled memory allocation, causing process crashes and service disruption.
Affected Products
- Golang Go standard library (versions prior to the fix referenced in GO-2025-4011)
- Go applications and services that parse untrusted DER-encoded payloads using encoding/asn1 or crypto/x509
- Any downstream software linking the vulnerable Go runtime or libraries
Discovery Timeline
- 2025-10-08 - Vulnerability disclosed publicly via Openwall OSS-Security Mailing List
- 2025-10-29 - CVE-2025-58185 published to NVD
- 2026-02-06 - Last updated in NVD database
Technical Details for CVE-2025-58185
Vulnerability Analysis
The vulnerability resides in Go's DER decoding logic. DER is a binary encoding for ASN.1 data structures used extensively in X.509 certificates, PKCS containers, and other cryptographic formats. The parser reads length fields from the DER stream and allocates buffers based on those values.
When a crafted payload declares an oversized length, the parser pre-allocates memory without first validating that the declared size is consistent with the actual input data available. An attacker can submit a small input that claims to contain very large structures, forcing the process to consume substantial heap memory. Further technical detail is available in the Go.dev Vulnerability Report: GO-2025-4011 and the upstream patch Go.dev Change Log #709856.
Root Cause
The root cause is the absence of effective bounds checks between declared element lengths in the DER stream and the size of the input buffer. The parser trusts attacker-controlled length fields when sizing internal allocations, mapping directly to [CWE-770].
Attack Vector
An attacker delivers a malicious DER blob to any network-accessible endpoint that decodes ASN.1 data. Common entry points include TLS handshakes presenting client or server certificates, certificate validation in API clients, and services that ingest signed payloads or PKCS structures from untrusted sources. Repeated submissions amplify memory pressure and can crash the target process.
No verified public exploit code is available. Refer to the Go.dev Issue Tracker #75671 for the technical reproducer discussion.
Detection Methods for CVE-2025-58185
Indicators of Compromise
- Sudden spikes in resident memory usage of Go-based services followed by out-of-memory (OOM) terminations
- Repeated TLS handshake failures or ASN.1 parse errors logged immediately before process crashes
- Inbound traffic delivering unusually small DER payloads that reference very large internal lengths
Detection Strategies
- Monitor process memory and OOM-killer events on hosts running Go services that handle external certificates or DER-encoded data
- Inspect TLS and API gateway logs for malformed certificate or ASN.1 decoding errors from untrusted peers
- Apply network-layer rate limiting and anomaly detection on endpoints that accept certificate uploads or mTLS connections
Monitoring Recommendations
- Track Go runtime metrics (runtime.MemStats) and alert on rapid heap growth in services exposed to untrusted input
- Correlate crash events with the version of Go used to build each binary to prioritize patching
- Enable cgroup memory limits on containerized Go workloads so a single malicious request cannot exhaust host memory
How to Mitigate CVE-2025-58185
Immediate Actions Required
- Inventory all Go binaries and identify those built with vulnerable Go toolchain versions referenced in GO-2025-4011
- Rebuild affected applications using a patched Go release and redeploy to production
- Restrict exposure of endpoints that accept untrusted DER or X.509 data behind authenticated channels where feasible
Patch Information
The fix is committed in Go.dev Change Log #709856 and tracked in the Go.dev Vulnerability Report: GO-2025-4011. Upgrade to the Go release containing this change and rebuild all dependent applications. The fix is also announced on the Golang Announce Group Post.
Workarounds
- Enforce strict size limits on inbound DER payloads at reverse proxies or load balancers before they reach Go services
- Run Go services with memory cgroup limits so memory exhaustion is contained to a single process
- Validate certificates and ASN.1 structures with size-bounded pre-checks before passing them to encoding/asn1 or crypto/x509
# Verify installed Go version and use govulncheck to identify affected modules
go version
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


