Skip to main content

OpenSC EUVDEUVD-2026-33315

| CVE-2026-40510 LOW
Stack-based Buffer Overflow (CWE-121)
2026-05-29 VulnCheck GHSA-7rrw-cv3r-3cgg
1.0
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Gain physical access to target machine
  2. Delivery
    Insert crafted PIV smart card or USB emulator
  3. Exploit
    System invokes PIV card processing via OpenSC
  4. Execution
    piv_process_history() reads Key History Object ASN.1 response
  5. Persist
    URL field >118 bytes overflows fixed stack buffer
  6. Impact
    Memory corruption with limited Low-level CIA impact on OpenSC process

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Stack buffer bounds checking
MITRE ATT&CK

1 technique across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the attacker to be physically present and able to insert a crafted PIV smart card or USB device emulating a smart card into the target machine - remote exploitation is not possible per AV:P. The target must be running a vulnerable OpenSC version (before 0.27.0-rc1) with PIV card support enabled, which is the default for PIV-capable builds. The overflow is triggered specifically during processing of the Key History Object's URL field in the ASN.1 response; PIV cards that do not present a Key History Object, or whose URL field is 118 bytes or fewer, will not trigger the vulnerability. Additionally, the CVSS vector specifies UI:P (passive user interaction), meaning the card must be read and processed by the host system - simply having physical proximity is insufficient without triggering a card read operation. Key limiting factors include: mandatory physical access to the target machine, high attack complexity, the need for a specially crafted card or device, and the requirement that PIV card processing is actively invoked.

Impact

The CVSS 4.0 score of 1.0 is the primary quantitative signal and accurately reflects severe real-world constraints: physical access required (AV:P), high attack complexity (AC:H), passive user interaction required (UI:P), and only Low impact across confidentiality, integrity, and availability with no scope change to subsequent components (SC:N/SI:N/SA:N). The vulnerability is not listed in CISA KEV, and no public exploit or POC code has been identified at time of analysis; EPSS data was not provided in the input. Despite being a classic stack buffer overflow - a class historically associated with high exploitability - the physical access prerequisite and high complexity sharply limit the threat model to insider attacks or supply-chain scenarios involving tampered smart cards. The low CIA impact scoring suggests exploitation is more likely to result in localized process instability than reliable arbitrary code execution. This is a low-priority patching item for most organizations, but merits attention in high-security environments where untrusted or externally-sourced smart cards are inserted into sensitive workstations.

Exploit ScenarioDerived

An adversary with physical access to a workstation - such as a malicious insider or a supply-chain attacker who has tampered with smart cards - inserts a crafted PIV card or a USB device emulating a smart card reader that returns a Key History Object whose URL field exceeds 118 bytes in the ASN.1 response. When OpenSC's piv_process_history() function processes the card, the oversized URL overflows the fixed stack buffer before the missing bounds check, triggering memory corruption. No public POC exists at time of analysis; given the high attack complexity (AC:H) and low impact scope, reliable exploitation for code execution may require additional effort beyond triggering the overflow.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 29, 2026

Stack buffer overflow in OpenSC's PIV card handler allows a physically present attacker to corrupt memory by presenting a crafted PIV smart card or USB device that returns a URL field exceeding 118 bytes in the Key History Object ASN.1 response, triggering the overflow in piv_process_history() within src/libopensc/card-piv.c. All OpenSC versions prior to 0.27.0-rc1 are affected; the vulnerability is confirmed by the vendor fix in commit 3f24f0b and PR #3558. With a CVSS 4.0 score of 1.0 (AV:P/AC:H/UI:P), exploitation is severely constrained by mandatory physical access and high attack complexity, with no CISA KEV listing and no public exploit identified at time of analysis.

RemediationAI

The upstream fix is available in commit 3f24f0b and PR #3558 against the OpenSC GitHub repository, targeting release 0.27.0-rc1; however, 0.27.0-rc1 is a release candidate - a final stable tagged release has not been independently confirmed at time of analysis, so organizations should monitor https://github.com/OpenSC/OpenSC/releases for the stable 0.27.0 release. As a compensating control, enforce strict physical access policies restricting which smart cards can be inserted into systems running OpenSC, permitting only organizationally issued and cryptographically verified PIV cards. Environments that process externally sourced, untrusted, or user-supplied smart cards carry the highest residual risk and should treat this with elevated urgency. If PIV card support is not operationally required, disabling the PIV card driver in OpenSC configuration eliminates this attack surface entirely but will prevent all PIV card functionality. Applying the patch by building from the fixed commit is the recommended definitive remediation.

Affected VersionsENISA

opensc 0 <0.27.0-rc1
opensc 0 <3f24f0b48a481a8cf2e46059d8238a283ddc1c13

Affected Packages

euvd opensc fix: 0.27.0-rc1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

OpenSC is a widely used open-source library and toolkit for interacting with PKCS#15 and PIV-compliant smart cards. The vulnerable function piv_process_history() in src/libopensc/card-piv.c processes the Key History Object returned by a PIV card via ASN.1 encoding. Prior to the fix, the function read the URL field from the card's ASN.1 response and copied it into a fixed-size stack buffer without validating the input length against the 118-byte boundary, constituting a classic CWE-121 (Stack-based Buffer Overflow). The patch adds an explicit bounds check rejecting URLs longer than 118 bytes with SC_ERROR_INVALID_ASN1_OBJECT, and additionally introduces SHA-256 hash validation (enforcing exactly 64 ASCII hex characters) for the filename component of the URL. The CPE string cpe:2.3:a:opensc:opensc:*:*:*:*:*:*:*:* confirms the vulnerability affects all versions of the opensc software component regardless of platform.

Know when Opensc gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 1.0 LOW
CVSS:4.0/AV:P/AC:H/AT:N/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N

Primary rating from Vendor (VulnCheck) · only source for this CVE.

CVSS VectorVendor: VulnCheck

Attack Vector
Physical
Attack Complexity
High
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
Low
Vulnerable system: Integrity
Low
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
CVSS changed
May 29, 2026 - 14:22 NVD
3.8 (LOW) 1.0 (LOW)

DescriptionCVE.org

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.

Threat Intelligence Overview

EPSS Score
0.0%
Top 100% exploitable
Data Quality
8 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Low
Technical Impact
Partial

Priority Score

5
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +5
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

A stack-based buffer overflow occurs when a program writes more data to a buffer located on the stack than it was allocated to hold.

More in Opensc

View all
CVE-2019-6502 HIGH POC
7.5 Jan 22

sc_context_create in ctx.c in libopensc in OpenSC 0.19.0 has a memory leak, as demonstrated by a call from eidenv. Rated

CVE-2018-16393 MEDIUM POC
6.8 Sep 03

Several buffer overflows when handling responses from a Gemsafe V1 Smartcard in gemsafe_get_cert_len in libopensc/pkcs15

CVE-2018-16392 MEDIUM POC
6.8 Sep 03

Several buffer overflows when handling responses from a TCOS Card in tcos_select_file in libopensc/card-tcos.c in OpenSC

CVE-2018-16391 MEDIUM POC
6.8 Sep 03

Several buffer overflows when handling responses from a Muscle Card in muscle_list_files in libopensc/card-muscle.c in O

CVE-2018-16425 MEDIUM POC
6.6 Sep 04

A double free when handling responses from an HSM Card in sc_pkcs15emu_sc_hsm_init in libopensc/pkcs15-sc-hsm.c in OpenS

CVE-2018-16424 MEDIUM POC
6.6 Sep 04

A double free when handling responses in read_file in tools/egk-tool.c (aka the eGK card tool) in OpenSC before 0.19.0-r

CVE-2018-16423 MEDIUM POC
6.6 Sep 04

A double free when handling responses from a smartcard in sc_file_set_sec_attr in libopensc/sc.c in OpenSC before 0.19.0

CVE-2018-16422 MEDIUM POC
6.6 Sep 04

A single byte buffer overflow when handling responses from an esteid Card in sc_pkcs15emu_esteid_init in libopensc/pkcs1

CVE-2018-16421 MEDIUM POC
6.6 Sep 04

Several buffer overflows when handling responses from a CAC Card in cac_get_serial_nr_from_CUID in libopensc/card-cac.c

CVE-2018-16420 MEDIUM POC
6.6 Sep 04

Several buffer overflows when handling responses from an ePass 2003 Card in decrypt_response in libopensc/card-epass2003

CVE-2018-16419 MEDIUM POC
6.6 Sep 04

Several buffer overflows when handling responses from a Cryptoflex card in read_public_key in tools/cryptoflex-tool.c in

CVE-2018-16418 MEDIUM POC
6.6 Sep 04

A buffer overflow when handling string concatenation in util_acl_to_str in tools/util.c in OpenSC before 0.19.0-rc1 coul

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy