Executive brief
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.
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