CVE-2025-69419: Out of bounds write in PKCS12_get_friendlyname() UTF-8 conversion
Issue summary: Calling PKCS12getfriendlyname() function on a maliciously crafted PKCS#12 file with a BMPString (UTF-16BE) friendly name containing non-ASCII BMP code point can trigger a one byte write before the allocated buffer.
Impact summary: The out-of-bounds write can cause a memory corruption which can have various consequences including a Denial of Service.
The OPENSSLuni2utf8() function performs a two-pass conversion of a PKCS#12 BMPString (UTF-16BE) to UTF-8. In the second pass, when emitting UTF-8 bytes, the helper function bmptoutf8() incorrectly forwards the remaining UTF-16 source byte count as the destination buffer capacity to UTF8putc(). For BMP code points above U+07FF, UTF-8 requires three bytes, but the forwarded capacity can be just two bytes. UTF8putc() then returns -1, and this negative value is added to the output length without validation, causing the length to become negative. The subsequent trailing NUL byte is then written at a negative offset, causing write outside of heap allocated buffer.
The vulnerability is reachable via the public PKCS12getfriendlyname() API when parsing attacker-controlled PKCS#12 files. While PKCS12parse() uses a different code path that avoids this issue, PKCS12getfriendlyname() directly invokes the vulnerable function. Exploitation requires an attacker to provide a malicious PKCS#12 file to be parsed by the application and the attacker can just trigger a one zero byte write before the allocated buffer. For that reason the issue was assessed as Low severity according to our Security Policy.
The FIPS modules in 3.6, 3.5, 3.4, 3.3 and 3.0 are not affected by this issue, as the PKCS#12 implementation is outside the OpenSSL FIPS module boundary.
OpenSSL 3.6, 3.5, 3.4, 3.3, 3.0 and 1.1.1 are vulnerable to this issue.
OpenSSL 1.0.2 is not affected by this issue.
Other sources
The out-of-bounds write can cause a memory corruption which can have various consequences including a Denial of Service or Execution of attacker-supplied code.
The OPENSSLuni2utf8() function performs a two-pass conversion of a PKCS#12 BMPString (UTF-16BE) to UTF-8. In the second pass, when emitting UTF-8 bytes, the helper function bmptoutf8() incorrectly forwards the remaining UTF-16 source byte count as the destination buffer capacity to UTF8putc(). For BMP code points above U+07FF, UTF-8 requires three bytes, but the forwarded capacity can be just two bytes. UTF8putc() then returns -1, and this negative value is added to the output length without validation, causing the length to become negative. The subsequent trailing NUL byte is then written at a negative offset, causing write outside of heap allocated buffer.
The vulnerability is reachable via the public PKCS12getfriendlyname() API when parsing attacker-controlled PKCS#12 files. While PKCS12parse() uses a different code path that avoids this issue, PKCS12getfriendlyname() directly invokes the vulnerable function. Exploitation requires an attacker to provide a malicious PKCS#12 file to be parsed by the application. For that reason the issue was assessed as Moderate severity according to our Security Policy.
The FIPS modules in 3.6, 3.5, 3.4, 3.3 and 3.0 are not affected by this issue, as the PKCS#12 implementation is outside the OpenSSL FIPS module boundary.
OpenSSL 3.6, 3.5, 3.4, 3.3, 3.0 and 1.1.1 are vulnerable to this issue.
OpenSSL 1.0.2 is not affected by this issue.
OpenSSL 3.6 users should upgrade to OpenSSL 3.6.1.
OpenSSL 3.5 users should upgrade to OpenSSL 3.5.5.
OpenSSL 3.4 users should upgrade to OpenSSL 3.4.4.
OpenSSL 3.3 users should upgrade to OpenSSL 3.3.6.
OpenSSL 3.0 users should upgrade to OpenSSL 3.0.19.
OpenSSL 1.1.1 users should upgrade to OpenSSL 1.1.1ze (premium support customers only).
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
OpenSSL 1.1.1to a version that resolves this vulnerability.Fixed in 1.1.1ze - Upgrade
Upgrade
OpenSSL 3.0to a version that resolves this vulnerability.Fixed in 3.0.19 - Upgrade
Upgrade
OpenSSL 3.3to a version that resolves this vulnerability.Fixed in 3.3.6 - Upgrade
Upgrade
OpenSSL 3.4to a version that resolves this vulnerability.Fixed in 3.4.4 - Upgrade
Upgrade
OpenSSL 3.5to a version that resolves this vulnerability.Fixed in 3.5.5 - Upgrade
Upgrade
OpenSSL 3.6to a version that resolves this vulnerability.Fixed in 3.6.1 - Compensating control
If the application parses attacker-controlled PKCS#12 files, restrict the sources of PKCS#12 inputs (since exploitation is reachable via the public PKCS12_get_friendlyname() API and can be triggered by a crafted PKCS#12 file with a BMPString (UTF-16BE) friendly name).
Event History
Frequently Asked Questions
What is the severity of CVE-2025-69419?
CVE-2025-69419 is considered to have a critical severity due to its potential for causing arbitrary memory writes.
How do I fix CVE-2025-69419?
To fix CVE-2025-69419, update OpenSSL to a version that is not vulnerable, specifically beyond the affected versions listed.
Which versions of OpenSSL are affected by CVE-2025-69419?
CVE-2025-69419 affects OpenSSL versions 1.1.1, 3.0, 3.3, 3.4, 3.5, and 3.6.
What is the cause of the CVE-2025-69419 vulnerability?
CVE-2025-69419 is caused by an out-of-bounds write due to improper handling of BMPString in UTF-16BE during the PKCS12_get_friendlyname() function.
What is the potential impact of CVE-2025-69419 on systems?
The potential impact of CVE-2025-69419 includes the possibility of memory corruption, which can lead to application crashes or code execution.