CVE-2025-66038
OpenSC: `sc_compacttlv_find_tag` can return out-of-bounds pointers
Check your servers for CVE-2025-66038
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-66038 affects opensc, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
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.
Severity (CVSS)
CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
- Attack vector
- physical: the attacker has to touch the device
- Attack complexity
- high: an attack depends on conditions outside the control of the attacker, such as a race
- Privileges required
- none: the attacker does not need an account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality low, integrity low, availability low: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.33%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 18.6% of all scored CVEs. Scores of 30 Nov 2026.
The assessment of CISA (SSVC, 1 Apr 2026):
- Exploitation
- poc: a proof of concept is public
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Weakness
- CWE-126 Buffer Over-read
Affected products
As the CNA lists them.
Is my server affected?
Find the installed version of opensc and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i opensc
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2025-66038 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2025-66038RHEL, Rocky, Alma, Fedora
rpm -q opensc
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2025-66038Alpine
apk list --installed | grep -i openscWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-66038
trivy image --scanners vuln IMAGE | grep CVE-2025-66038
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
Other references
- https://github.com/OpenSC/OpenSC/commit/6db171bcb6fd7cb3b51098fefbb3b28e44f0a79c github.com
- https://github.com/OpenSC/OpenSC/wiki/CVE-2025-66038 github.com
Source: the record CVE-2025-66038 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse