# CVE-2026-40528: OpenSC buffer overrun in do_key_value function

Source: https://junglewise.ai/threats/cve-2026-40528-opensc-buffer-overrun-in-do-key-value-function  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-29. Updated: 2026-05-29  
License: CC BY 4.0 with a link back

CVE-2026-40528 · Severity: low · CVSS 3.8 · Published 2026-05-29

OpenSC is a set of software tools and libraries for working with smart cards. A vulnerability in how it processes configuration files could allow an attacker to cause a system crash or memory corruption if they can convince a user to use a specially crafted profile file. This primarily impacts the initialization process of smart cards, potentially affecting the integrity of the card setup.

## Quick answers

**Is CVE-2026-40528 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40528 being exploited in the wild.

**How severe is CVE-2026-40528?** Low severity, with a CVSS score of 3.8, published 29 May 2026.

**Which products and versions are affected?** OpenSC OpenSC < 0.27.0.

**Is there a fix for CVE-2026-40528?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2026-40528 attacked?** It is attacked with physical access, in a software library.

**Am I affected by CVE-2026-40528?** Check whether anything you run is named in the advisory. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A stack and heap-based buffer overflow exists in OpenSC's pkcs15init/profile.c within the do_key_value() function. The vulnerability is triggered during pkcs15-init invocation when a profile configuration file contains a key value entry starting with '=' followed by more than the allocated buffer size (sizeof(keybuf)). The application uses memcpy() to copy the string without performing a length check, leading to memory corruption. Exploitation requires physical access to the system and user interaction to load the malicious profile file. The issue was fixed in version 0.27.0 and commit 0358817.

## Affected products

- OpenSC OpenSC < 0.27.0

## Timeline

- 2026-05-29: disclosed
- 2026-05-29: advisory

## References

- [https://github.com/OpenSC/OpenSC/commit/0358817ec74aeca654f83e7709c7720b14c5db59](https://github.com/OpenSC/OpenSC/commit/0358817ec74aeca654f83e7709c7720b14c5db59)
- [https://www.vulncheck.com/advisories/opensc-buffer-overrun-in-do-key-value-via-profile-c](https://www.vulncheck.com/advisories/opensc-buffer-overrun-in-do-key-value-via-profile-c)
