Heap-buffer-overflow in sc_pkcs15emu_oberthur_add_pubkey in opensc

opensc Updated 02 Oct 2025

Summary

20/03/2021
MEDIUM
Yes i
Medium
Not published

OSV-2021-538: Heap-buffer-overflow in sc_pkcs15emu_oberthur_add_pubkey. Affects opensc versions >= 6903aebfddc466d966c7b865fae34572bf3ed23e, < 5d4daf6c92e4668f5458f380f3cacea3e879d91a. Fixed in 5d4daf6c92e4668f5458f380f3cacea3e879d91a. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

OpenSC is an open-source smart card library that provides a set of tools and libraries for interacting with smart cards. It enables applications to access smart card functions such as authentication, encryption, and digital signatures. The sc_pkcs15emu_oberthur_add_pubkey function in OpenSC is responsible for adding a public key to the Oberthur smart card. However, a vulnerability has been discovered in this function that can lead to a heap-buffer-overflow read.

Vulnerability Detail

The vulnerability occurs when the sc_pkcs15emu_oberthur_add_pubkey function reads beyond the bounds of a heap buffer. This can result in the disclosure of sensitive information or the execution of arbitrary code. An attacker could exploit this vulnerability by crafting a malicious smart card that triggers the overflow when processed by an application using OpenSC. The vulnerability has a medium severity rating.

How To Fix

Minimum fixed version

5d4daf6c92e4668f5458f380f3cacea3e879d91a

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a workaround, users can avoid using the sc_pkcs15emu_oberthur_add_pubkey function or disable the affected functionality that relies on it. However, it is strongly advised to apply the official fix by updating to the latest version of OpenSC.

Conclusion

In conclusion, a heap-buffer-overflow vulnerability has been discovered in the sc_pkcs15emu_oberthur_add_pubkey function in OpenSC. This vulnerability can be fixed by updating to the latest version of OpenSC. It is recommended to apply the official fix to ensure the security of applications using OpenSC. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for opensc →

Share this vulnerability

FAQ

OpenSC is an open-source smart card library that provides tools and libraries for interacting with smart cards.

The sc_pkcs15emu_oberthur_add_pubkey function is responsible for adding a public key to the Oberthur smart card in OpenSC.

A heap-buffer-overflow vulnerability occurs when a program reads or writes data beyond the bounds of a heap buffer, potentially leading to memory corruption and security issues.

The vulnerability could allow an attacker to disclose sensitive information or execute arbitrary code by exploiting the heap-buffer-overflow read.

To fix this vulnerability, update to the latest version of OpenSC, which includes the patched code. The specific commit that addresses this issue is 5d4daf6c92e4668f5458f380f3cacea3e879d91a.

Related vulnerabilities

Recent vulnerabilities recorded for opensc.

How To Fix

Minimum fixed version

5d4daf6c92e4668f5458f380f3cacea3e879d91a

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback