CVE-2026-58102 Overview
CVE-2026-58102 is a heap out-of-bounds read vulnerability in the Crypt::OpenSSL::X509 Perl module for versions before 2.1.3. The flaw resides in the hv_exts() function, which constructs a hash of certificate extensions. When processing a certificate extension with an Object Identifier (OID) whose text representation exceeds 129 bytes, the code reads past the fixed-size buffer allocation. This leaks adjacent heap memory into the returned hash key. Applications parsing untrusted X.509 certificates with this module are exposed to memory disclosure and potential denial of service.
Critical Impact
Attackers can trigger heap memory disclosure and process instability by supplying an X.509 certificate containing a crafted long-OID extension to any Perl service using Crypt::OpenSSL::X509 before 2.1.3.
Affected Products
- Crypt::OpenSSL::X509 Perl module versions prior to 2.1.3
- Perl applications invoking extensions(), extensions_by_long_name(), extensions_by_oid(), or has_extension_oid()
- Downstream services performing X.509 certificate parsing via this module
Discovery Timeline
- 2026-07-13 - CVE-2026-58102 published to the National Vulnerability Database (NVD)
- 2026-07-14 - Last updated in NVD database
Technical Details for CVE-2026-58102
Vulnerability Analysis
The defect is a classic out-of-bounds read [CWE-125] in the extension enumeration path of Crypt::OpenSSL::X509. When building the extension hash, the code allocates a fixed 129-byte buffer to receive the textual OID representation produced by OpenSSL's OBJ_obj2txt(). The return value of OBJ_obj2txt() reports the full length of the OID text, not the number of bytes actually written to the truncated buffer. The vulnerable code then passes this untruncated length as the hash-key length to Perl's hash API.
When an attacker-supplied OID text exceeds 129 bytes, Perl reads beyond the allocated buffer, copying adjacent heap contents into the resulting hash key. This exposes process memory that may contain other certificate data, private material, or unrelated allocations. The extensions_by_name() accessor uses the static shortname lookup path and is not affected.
Root Cause
The root cause is incorrect length accounting between OpenSSL's OID-to-text conversion and Perl's hash-key construction. OBJ_obj2txt() follows snprintf-style semantics: it returns the length the full output would have required, independent of the buffer size argument. The vulnerable version trusted this return value as if it reflected bytes written to the fixed-size buffer.
Attack Vector
An attacker delivers a malicious X.509 certificate containing an extension with an abnormally long OID. Any Perl service that parses the certificate and enumerates extensions triggers the out-of-bounds read. Common exposure points include TLS peer certificate validation, S/MIME processing, and PKI tooling. No authentication or user interaction is required.
static HV* hv_exts(X509* x509, int no_name) {
X509_EXTENSION *ext;
int i, c, r;
- size_t len = 128;
char* key = NULL;
const char* ckey = NULL;
SV* rv;
Source: GitHub commit 757289b — The patch removes the fixed len = 128 assumption and corrects how the actual written length is passed to the Perl hash API.
Detection Methods for CVE-2026-58102
Indicators of Compromise
- Crashes or SIGSEGV faults in Perl processes that invoke Crypt::OpenSSL::X509 extension accessors
- Unexpected non-UTF8 or binary content appearing in log fields derived from certificate extension keys
- Certificates in inbound traffic containing extension OIDs longer than 129 bytes of textual representation
Detection Strategies
- Inventory installed Perl modules using cpan -l or corelist and flag Crypt::OpenSSL::X509 versions below 2.1.3
- Inspect PKI ingest pipelines for calls to extensions(), extensions_by_long_name(), extensions_by_oid(), and has_extension_oid()
- Add parser-level validation that rejects certificates with extension OID text longer than 128 bytes before handoff to the module
Monitoring Recommendations
- Alert on Perl worker crashes or abnormal restarts in services that terminate or process TLS/S/MIME certificates
- Capture and retain sample certificates that trigger parser errors for forensic review
- Monitor CPAN and distribution security feeds for further fixes affecting Crypt::OpenSSL::X509
How to Mitigate CVE-2026-58102
Immediate Actions Required
- Upgrade Crypt::OpenSSL::X509 to version 2.1.3 or later on all systems, including containers and CI/CD images
- Audit application code for use of the affected extension accessors and constrain input certificate sources where feasible
- Restart long-running Perl services after upgrading to ensure the patched module is loaded
Patch Information
The fix is available in Crypt::OpenSSL::X509 version 2.1.3. Refer to the MetaCPAN release changes and the upstream GitHub commit 757289b for the corrected hv_exts() implementation.
Workarounds
- Substitute calls to affected accessors with extensions_by_name(), which uses the unaffected shortname path, when the use case allows
- Pre-filter certificates and reject those whose extension OID text length exceeds 128 bytes
- Isolate certificate-parsing workers in restricted processes to reduce the value of any leaked heap contents
# Upgrade the vulnerable module via cpanm
cpanm Crypt::OpenSSL::X509@2.1.3
# Verify the installed version
perl -MCrypt::OpenSSL::X509 -e 'print $Crypt::OpenSSL::X509::VERSION, "\n"'
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

