CVE-2025-66037: 
NixOS vulnerability analysis and mitigation

Overview

CVE-2025-66037 is an out-of-bounds heap read vulnerability in OpenSC, an open-source smart card tools and middleware library. The flaw exists in the X.509/SPKI handling path and was discovered via OSS-Fuzz fuzzing, originally reported by Aldo Ristori. It affects all OpenSC versions prior to 0.27.0 (including v0.26.1 and earlier). The vulnerability was disclosed on March 30, 2026, and carries a CVSS v3.1 base score of 6.8 (Medium) per NVD, though the OpenSC advisory rates it 3.9 (Low) with a physical/high-complexity vector (GitHub Advisory, Red Hat Bugzilla).

Technical details

The root cause is classified as CWE-125 (Out-of-bounds Read). The vulnerable function sc_pkcs15_pubkey_from_spki_fields() parses ASN.1/SPKI data from a smart card's X.509 certificate and can receive a zero-length buffer from malformed or adversarial input. It calls malloc(0), producing a valid pointer to a zero-byte heap block, then unconditionally reads one byte past the end of that allocation without first checking that the buffer length is at least one byte. This is confirmed by Valgrind as an "Invalid read of size 1" at address 0 bytes after a block of size 0. The bug is reachable from multiple fuzzing harnesses (fuzz_pkcs15_reader and fuzz_pkcs15_crypt), indicating a single underlying defect in the shared certificate/public-key decoding logic. Exploitation requires physical access — an attacker must present a crafted USB smart card or device that returns malicious APDU responses (GitHub Advisory, OpenSC Wiki).

Impact

Successful exploitation can cause undefined behavior during certificate parsing, manifesting as application crashes or subtle misparsing depending on the allocator and build configuration. There is a low-severity information-exposure risk, as the one-byte out-of-bounds read could theoretically disclose adjacent heap memory contents. The vulnerability affects the libopensc library, making it accessible from OpenSC tools, the PKCS#11 module, the minidriver, and the Cryptographic Token Kit (CTK), broadening the attack surface across all consumers of the library (GitHub Advisory, OpenSC Wiki).

Exploitability

A proof-of-concept is publicly available in the GitHub Security Advisory, including OSS-Fuzz reproduction steps, Valgrind trace, and testcase artifacts (archive0.zip, archive1.zip). There is no evidence of in-the-wild exploitation at this time, and no threat actor attribution has been reported. The EPSS score is approximately 0.005% (very low probability of exploitation in the near term). The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. Physical access to a smart card reader is required, significantly limiting the attacker pool (GitHub Advisory, Feedly).

Exploitation steps

  1. Prepare a malicious smart card or USB device: Craft a smart card or USB device that responds to APDU commands with a malformed X.509 certificate containing a zero-length SubjectPublicKeyInfo (SPKI) field.
  2. Physical access: Insert the crafted smart card or USB device into a system running a vulnerable version of OpenSC (< 0.27.0) with a connected smart card reader.
  3. Trigger certificate parsing: Cause the target system to read and parse the certificate from the card — this can occur automatically when the card is inserted, or by invoking OpenSC tools (e.g., pkcs15-tool, pkcs11-tool) or any application using the OpenSC PKCS#11 module or minidriver.
  4. Trigger the out-of-bounds read: The malformed SPKI data causes sc_pkcs15_pubkey_from_spki_fields() to call malloc(0) and then read one byte past the end of the zero-length allocation, resulting in undefined behavior (crash or potential heap memory disclosure).
  5. Observe impact: Depending on the build and allocator, the result may be an application crash, silent misparsing, or a one-byte heap memory leak (GitHub Advisory, OpenSC Wiki).

Indicators of compromise

  • Process: Unexpected crashes or segmentation faults in OpenSC-linked processes (e.g., pkcs15-tool, pkcs11-tool, browser or SSH agent using PKCS#11 module) when a smart card is inserted.
  • Logs: Application or system logs showing memory errors or crashes in libopensc during certificate parsing; Valgrind output referencing sc_pkcs15_pubkey_from_spki_fields with "Invalid read of size 1".
  • Physical: Presence of an unknown or unrecognized smart card or USB device connected to a smart card reader on a sensitive system.
  • File System: Core dump files generated by OpenSC-linked processes following smart card insertion events.

Mitigation and workarounds

The primary remediation is to upgrade OpenSC to version 0.27.0 or later, which contains the fix (commit 65fc211015cfcac27b10d0876054156c97225f50). If immediate patching is not possible, restrict physical access to smart card readers and enforce policies limiting which smart cards can be inserted into OpenSC-enabled systems. Organizations using OpenSC via Linux distributions should apply vendor-provided package updates (e.g., openSUSE, Fedora packages have been updated) (GitHub Advisory, OpenSC Wiki).

Community reactions

The vulnerability was reported through OSS-Fuzz by Aldo Ristori (credited as "Kaldreic" in the advisory) and patched by OpenSC maintainer Jakub Jelen. Red Hat tracked the issue via Bugzilla and Microsoft acknowledged it in their Security Response Center update guide. The OpenSC project rated the severity as Low (3.9) due to the physical access requirement and high attack complexity, while NVD assigned a higher Medium score (6.8). No significant social media discussion or broader media coverage has been identified (GitHub Advisory, Microsoft MSRC).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

opensc

Affected

sid

opensc: 0.27.1-1

Fixed

trixie

opensc

Affected

Ubuntu

Unknown

bionic (esm-apps)

opensc

Unknown

devel

opensc

Unknown

focal (esm-apps)

opensc

Unknown

jammy

opensc

Unknown

jammy (esm-apps)

opensc

Unknown

noble

opensc

Unknown

noble (esm-apps)

opensc

Unknown

resolute

opensc

Unknown

RHEL / CentOS

Affected

RHEL 8

opensc.src

Affected

RHEL 9

opensc.src

Affected

RHEL 10

opensc.src

Affected

Alpine

Fixed

edge

opensc: 0.27.1-r0

Fixed

Source: This report was generated using AI

Related NixOS vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-112940HIGH7.1
  • Python logoPython
  • py3-filelock
NoYesOct 20, 2026
CVE-2026-112937MEDIUM6.1
  • Python logoPython
  • python-filelock
NoYesOct 20, 2026
CVE-2026-112936MEDIUM6.1
  • Python logoPython
  • python-filelock
NoYesOct 20, 2026
CVE-2026-112939MEDIUM4.7
  • Python logoPython
  • python-filelock
NoYesOct 20, 2026
CVE-2026-112941LOW3.3
  • Python logoPython
  • filelock
NoYesOct 20, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management