CVE-2026-40510: OpenSC < 0.27.0-rc1 Stack Buffer Overflow via piv_process_history() in card-piv.c
OpenSC before 0.27.0-rc1, fixed in commit 3f24f0b, contains a stack buffer overflow vulnerability in piv_process_history() in src/libopensc/card-piv.c that allows physically present attackers to trigger memory corruption by presenting a crafted PIV smart card or USB device returning a URL field longer than 118 bytes in the Key History Object ASN.1 response.
Security readout for executives and security teams
Plain-English summary
OpenSC has a low-severity memory corruption flaw triggered by a crafted PIV smart card or USB device. An attacker must be physically present and persuade or cause a user to interact with the device. The main business risk is limited endpoint compromise or disruption in environments that use OpenSC for smart-card authentication.
Executive priority
Treat this as a targeted physical-access risk, not an emergency internet-facing exposure. Patch during the next endpoint maintenance cycle, faster for environments relying heavily on PIV smart-card authentication or accepting third-party cards or tokens.
Technical view
CVE-2026-40510 is a CWE-121 stack buffer overflow in OpenSC before 0.27.0-rc1, in piv_process_history() within src/libopensc/card-piv.c. The issue is tied to processing an overlong URL field in the PIV Key History Object ASN.1 response. It is fixed by OpenSC commit 3f24f0b.
Likely exposure
Exposure is most likely on workstations or systems running vulnerable OpenSC builds and interacting with PIV smart cards, tokens, or USB devices. Systems without OpenSC or without PIV smart-card use are unlikely to be exposed based on the provided sources.
Exploitation context
The CVSS vector requires physical access, high attack complexity, and user interaction. The source bundle does not report active exploitation, and KEV status is false. The credible scenario is a physically presented malicious card or USB device, not remote internet exploitation.
Researcher notes
The evidence supports a stack buffer overflow in OpenSC PIV handling, fixed upstream in commit 3f24f0b and described as affecting versions before 0.27.0-rc1. Public sources provided do not establish exploit availability, active exploitation, or broader affected products beyond OpenSC.
Mitigation direction
Upgrade OpenSC to 0.27.0-rc1 or a build containing commit 3f24f0b.
Check operating-system or package-maintainer advisories for backported OpenSC fixes.
Restrict use of untrusted PIV cards, tokens, and USB smart-card devices.
Prioritize shared workstations and smart-card authentication endpoints first.
Validation and detection
Inventory endpoints and servers with OpenSC installed.
Confirm installed OpenSC versions are not earlier than the fixed release or patched build.
Identify systems that process PIV smart cards or USB smart-card devices.
Review endpoint controls for unauthorized removable smart-card or USB device use.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-121: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-121 · source CWE mapping
Stack-based Buffer Overflow
Stack-based Buffer Overflow represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.