Skip to main content

OpenSC EUVDEUVD-2026-33320

| CVE-2026-40528 LOW
Stack-based Buffer Overflow (CWE-121)
2026-05-29 VulnCheck GHSA-vxjj-52h8-95w5
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 provisioning workstation
  2. Delivery
    Craft or replace pkcs15-init profile configuration file
  3. Exploit
    User invokes pkcs15-init with malicious profile
  4. Execution
    do_key_value() executes unchecked memcpy into keybuf
  5. Persist
    Stack and heap memory corrupted
  6. Impact
    Process crash or limited code execution

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

Physical access to the target system is required (CVSS AV:P). The vulnerability is triggered exclusively during pkcs15-init invocation - the PKCS#15 smart card initialization tool must be actively run by a user (UI:P) against a profile configuration file that the attacker has been able to craft or substitute. The malicious profile file must contain a key-value entry where the value begins with '=' and has a byte length exceeding sizeof(keybuf) in the OpenSC build. Exploitation is further constrained by high attack complexity (AC:H), meaning reliable memory corruption control is not straightforward. Limiting factors include: physical presence requirement, dependency on user action to invoke the tool, attacker's ability to modify or replace the profile file path used, and the non-default nature of running pkcs15-init (it is a provisioning tool, not a routine daemon). Systems that do not perform smart card initialization using pkcs15-init are not affected.

Impact

The aggregate risk signal is very low despite the memory-corruption class of vulnerability. CVSS 4.0 scores this at 1.0 with AV:P (physical access required), AC:H (high attack complexity), PR:N (no privileges needed by the attacker), UI:P (user interaction required), and limited impact metrics (VC:L/VI:L/VA:L). No EPSS data was provided in the source intelligence, and this CVE does not appear in the CISA KEV catalog, indicating no confirmed active exploitation. No public proof-of-concept code was identified. The physical access vector is the dominant risk-reduction factor: an attacker must be able to place a crafted profile file in a location where a user subsequently invokes pkcs15-init against it. The high attack complexity further reduces likelihood of reliable exploitation even when access conditions are met. The impact scope is limited to the local process - SC:N/SI:N/SA:N confirms no cross-component scope change. Real-world priority is low for most organizations; only environments where physical access to smart card provisioning workstations is not tightly controlled warrant elevated concern.

Exploit ScenarioDerived

An attacker with physical access to a smart card provisioning workstation replaces or supplants a legitimate pkcs15-init profile configuration file with a crafted variant containing a key value entry that begins with '=' and includes a payload exceeding sizeof(keybuf) bytes. When an operator runs pkcs15-init and the malicious profile is parsed, do_key_value() performs an unchecked memcpy into keybuf, overflowing the stack buffer and corrupting adjacent memory, potentially leading to a crash or limited code execution within the pkcs15-init process context. No public proof-of-concept is known at time of analysis, and the high attack complexity rating reflects the difficulty of reliably controlling execution after 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 and heap buffer overruns in OpenSC's pkcs15-init tooling corrupt memory when processing a maliciously crafted PKCS#15 profile configuration file. Affected versions prior to 0.27.0 contain no length validation in the do_key_value() function before a memcpy into the fixed-size keybuf buffer, allowing overflow when a key value entry begins with '=' and exceeds sizeof(keybuf) bytes. Exploitation is severely constrained by a CVSS 4.0 score of 1.0 - physical access, high attack complexity, and user interaction are all required - and no public exploit or CISA KEV listing exists at time of analysis.

RemediationAI

Upgrade OpenSC to version 0.27.0 or later, which incorporates the fix from commit 0358817. The upstream patch is available at https://github.com/OpenSC/OpenSC/commit/0358817ec74aeca654f83e7709c7720b14c5db59. If upgrading immediately is not feasible, restrict write access to profile configuration files used by pkcs15-init so that only trusted administrators can supply or modify them - this eliminates the primary attack vector since exploitation requires delivering a crafted profile file to the target. Additionally, enforce physical access controls on workstations where pkcs15-init is invoked for smart card provisioning, as AV:P requires local physical presence. Auditing existing profile configuration files for anomalous key-value entries longer than expected is a low-cost compensating check while a patch is staged.

Affected VersionsENISA

opensc 0 <0358817ec74aeca654f83e7709c7720b14c5db59
opensc 0 <0.27.0

Affected Packages

euvd opensc fix: 0.27.0

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 an open-source smart card middleware library used for PKCS#11 and PKCS#15 cryptographic operations. The pkcs15-init utility processes profile configuration files to initialize smart card token structures. The vulnerable code path in src/pkcs15init/profile.c within the do_key_value() function reads key-value pairs from these profile files. Prior to the fix in commit 0358817, a key value entry beginning with '=' was passed directly to memcpy into the stack-allocated keybuf without first comparing key_len against sizeof(keybuf). CWE-121 (Stack-based Buffer Overflow) is the root cause class: the unbounded copy overflows keybuf on the stack and can also corrupt adjacent heap allocations depending on allocator layout. The fix introduces an explicit guard - if (key_len > sizeof(keybuf)) { parse_error(...); return 1; } - rejecting oversized values before the copy executes. CPE cpe:2.3:a:opensc:opensc:*:*:*:*:*:*:*:* indicates all OpenSC versions prior to the patch are affected.

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, fixed in commit 0358817, contains a stack and heap buffer overrun vulnerability in the do_key_value() function in src/pkcs15init/profile.c that allows attackers to corrupt memory by supplying a crafted profile configuration file. During pkcs15-init invocation, a key value entry beginning with '=' followed by more than sizeof(keybuf) characters is copied into keybuf via memcpy without a length check, causing both stack and heap buffer overruns.

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