A critical buffer overflow vulnerability (CVE-2026-5295) has been identified in wolfSSL, specifically within the PKCS7 decryption process. This flaw allows attackers to exploit a stack buffer overflow by crafting malicious CMS EnvelopedData messages. The vulnerability impacts versions 0.0.0 through 5.9.1 of wolfSSL and has been publicly disclosed on 2026-04-09. A fix is available in version 5.9.1.
The vulnerability lies in the wcPKCS7DecryptOri() function within the pkcs7.c file. When processing CMS EnvelopedData messages with an OtherRecipientInfo (ORI) recipient, the function copies an ASN.1-parsed OID into a fixed 32-byte stack buffer without validating its length. An attacker can exploit this by providing a crafted message containing an OID exceeding 32 bytes, leading to a stack buffer overflow. Successful exploitation could result in denial of service, arbitrary code execution, or information disclosure, depending on the application utilizing wolfSSL. The impact is particularly severe if wolfSSL is used in security-critical applications or embedded systems where memory protection mechanisms are limited.
CVE-2026-5295 was publicly disclosed on 2026-04-09. Currently, there are no known public exploits or active campaigns targeting this vulnerability. The vulnerability requires the library to be built with --enable which may limit its immediate exploitability. Its inclusion in the NVD is pending. The EPSS score is currently pending evaluation.
Exploit Status
EPSS
0.02% (5% percentile)
CISA SSVC
The primary mitigation is to upgrade to wolfSSL version 5.9.1 or later, which contains the fix for this vulnerability. If an immediate upgrade is not feasible, consider implementing temporary workarounds. Input validation is crucial; carefully scrutinize the length of OIDs received in CMS EnvelopedData messages before processing them. WAFs or proxies can be configured to filter out messages with excessively long OIDs. Building wolfSSL with compiler flags that enable stack protection mechanisms (e.g., stack canaries) can also provide some level of defense. After upgrading, confirm the fix by sending a crafted CMS EnvelopedData message with a long OID and verifying that the overflow no longer occurs.
Update to version 5.9.1 or later of wolfSSL to mitigate the stack buffer overflow vulnerability. Ensure the library is compiled with --enable-pkcs7 disabled unless absolutely necessary, and if used, register a custom ORI decrypt callback.
Vulnerability analysis and critical alerts directly to your inbox.
CVE-2026-5295 is a buffer overflow vulnerability in wolfSSL's PKCS7 implementation, allowing attackers to trigger a stack overflow with crafted CMS EnvelopedData messages.
If you are using wolfSSL versions 0.0.0 through 5.9.1 and process CMS EnvelopedData messages, you are potentially affected by this vulnerability.
Upgrade to wolfSSL version 5.9.1 or later to resolve this vulnerability. Implement input validation as a temporary workaround if an upgrade is not immediately possible.
As of the current disclosure date, there are no known public exploits or active campaigns targeting CVE-2026-5295.
Refer to the official wolfSSL security advisory for detailed information and updates regarding CVE-2026-5295. (Link to advisory would be here if available)
Upload your dependency file and we'll tell you instantly if this and other CVEs hit you.