Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Buffer over-read prevention
|
| Impact | The CVSS vector (AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L) indicates physical attack vector (smartcard proximity required) and high complexity, yielding a base score of 3.9. However, the actual risk is nuanced: while the low CVSS score reflects the physical barrier to exploitation, the vulnerability occurs when OpenSC processes untrusted data from smart cards or card-like sources, which is its primary operational context. The memory corruption potential (out-of-bounds reads/writes) could enable information disclosure or denial of service in environments where OpenSC interfaces with untrusted or compromised cards. The vulnerability is not actively exploited (no KEV status indicated), and no public exploit code exists at time of analysis, but the condition is easily triggered by malformed compact-TLV structures. The patch availability (version 0.27.0) and upstream fix via commit 6db171bcb6fd7cb3b51098fefbb3b28e44f0a79c reduce operational risk for patched deployments. |
| Exploit ScenarioDerived | An attacker with physical access to a card reader introduces a maliciously crafted smart card containing compact-TLV data with a tag element {0x0A} that claims a 10-byte value in a 1-byte buffer. When an OpenSC-based application (such as a PKI client or access control system) reads the card and calls sc_compacttlv_find_tag to search for tag 0x00, the function returns a pointer to buf+1 with outlen=10, causing subsequent code that dereferences this pointer to read or write beyond the buffer boundary. This could leak sensitive information from adjacent memory or corrupt application state. No public exploit code exists at time of analysis, but the vulnerability is trivially reproducible with a simple malformed TLV structure. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Mar 30, 2026
OpenSC before version 0.27.0 contains an out-of-bounds buffer read vulnerability in the sc_compacttlv_find_tag function that can return pointers beyond the allocated buffer bounds, leading to potential memory corruption when downstream code dereferences the returned pointer. The vulnerability affects OpenSC when processing untrusted compact-TLV data from smart cards or files, where a maliciously crafted single-byte element can claim a length exceeding the remaining buffer size without validation. While the CVSS score of 3.9 reflects the physical attack vector requirement (smartcard interaction) and high attack complexity, the memory corruption potential poses a notable risk in environments where OpenSC processes untrusted card data.
RemediationAI
Vendor-released patch: OpenSC version 0.27.0 or later. Organizations using OpenSC should upgrade to 0.27.0 immediately, which includes the fix committed at 6db171bcb6fd7cb3b51098fefbb3b28e44f0a79c that adds proper bounds validation in sc_compacttlv_find_tag to ensure claimed value lengths do not exceed remaining buffer size. For systems unable to upgrade immediately, limit OpenSC exposure by restricting processing to trusted smart cards and avoiding untrusted card data sources where possible. Consult the vendor advisory at https://github.com/OpenSC/OpenSC/security/advisories/GHSA-72x5-fwjx-2459 for distribution-specific guidance and patch availability.
Affected VersionsENISA
Affected Packages
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 middleware for smart card operations that handles Compact-TLV (Tag-Length-Value) encoded data, a format where a single byte encodes both the tag in the high nibble and value length in the low nibble. The sc_compacttlv_find_tag function is responsible for searching compact-TLV buffers for a specified tag. The root cause (CWE-126: Buffer Over-read) stems from inadequate bounds checking: when processing a buffer like {0x0A}, the function decodes this as tag=0x0 with claimed length=10 bytes, but returns a pointer (buf+1) without verifying that 10 bytes of data actually exist in the remaining buffer. This causes the function to return out-of-bounds pointers that, when dereferenced by calling code, can read from or corrupt memory beyond the intended buffer allocation.
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
AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
Lifecycle Timeline
2DescriptionGitHub Advisory
OpenSC is an open source smart card tools and middleware. Prior to version 0.27.0, sc_compacttlv_find_tag searches a compact-TLV buffer for a given tag. In compact-TLV, a single byte encodes the tag (high nibble) and value length (low nibble). With a 1-byte buffer {0x0A}, the encoded element claims tag=0 and length=10 but no value bytes follow. Calling sc_compacttlv_find_tag with search tag 0x00 returns a pointer equal to buf+1 and outlen=10 without verifying that the claimed value length fits within the remaining buffer. In cases where the sc_compacttlv_find_tag is provided untrusted data (such as being read from cards/files), attackers may be able to influence it to return out-of-bounds pointers leading to downstream memory corruption when subsequent code tries to dereference the pointer. This issue has been patched in version 0.27.0.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
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
Several buffer overflows when handling responses from a Gemsafe V1 Smartcard in gemsafe_get_cert_len in libopensc/pkcs15
Several buffer overflows when handling responses from a TCOS Card in tcos_select_file in libopensc/card-tcos.c in OpenSC
Several buffer overflows when handling responses from a Muscle Card in muscle_list_files in libopensc/card-muscle.c in O
A double free when handling responses from an HSM Card in sc_pkcs15emu_sc_hsm_init in libopensc/pkcs15-sc-hsm.c in OpenS
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
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
A single byte buffer overflow when handling responses from an esteid Card in sc_pkcs15emu_esteid_init in libopensc/pkcs1
Several buffer overflows when handling responses from a CAC Card in cac_get_serial_nr_from_CUID in libopensc/card-cac.c
Several buffer overflows when handling responses from an ePass 2003 Card in decrypt_response in libopensc/card-epass2003
Several buffer overflows when handling responses from a Cryptoflex card in read_public_key in tools/cryptoflex-tool.c in
A buffer overflow when handling string concatenation in util_acl_to_str in tools/util.c in OpenSC before 0.19.0-rc1 coul
EUVD-2025-209127
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB