Executive brief
Crypt::OpenSSL::PKCS12 is a Perl library used to process PKCS#12 files, which typically store digital certificates and private keys. A security flaw in how the library handles certain text attributes allows a specially crafted file to trigger an out-of-bounds memory read. This could allow an attacker to potentially access sensitive information from the application's memory or cause the application to crash.
Technical details
A heap out-of-bounds read exists in the print_attribute() function within PKCS12.xs. The vulnerability occurs because UTF8STRING ASN.1 attribute values are copied into a heap buffer using strncpy() without ensuring a NUL terminator is present. Subsequent calls to strlen() on this non-terminated buffer result in an inflated length, causing newSVpvn() to copy adjacent heap memory into a Perl scalar. This can be triggered via the info() or info_as_hash() methods when processing a malformed PKCS12 file. The issue was fixed in version 1.96 by ensuring proper NUL termination and adding length guards.
Affected products
- JONASBN Crypt::OpenSSL::PKCS12 < 1.96
Timeline
- 2026-05-17: disclosed: Issue reported on GitHub
- 2026-06-19: patched: Fixed in version 1.96
- 2026-06-20: advisory: NVD publication date