Stack-use-after-return in template_sanity_check in opensc

opensc Updated 02 Oct 2025

Summary

21/03/2022
N/A
Yes i
Unrated
Not published

OSV-2022-268: Stack-use-after-return in template_sanity_check. Affects opensc versions >= bec4f63c5b8308d7fdca842c5c0b62c3491d106a, < 8697a01850d5e02a3099acd5160d0a0ee2d31077. Fixed in 8697a01850d5e02a3099acd5160d0a0ee2d31077. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

OpenSC is an open-source smart card library that provides a set of cryptographic and security functions for smart card applications. It is widely used in various applications that require smart card authentication and encryption. The vulnerability in the template_sanity_check function of OpenSC allows for a stack-use-after-return, which can lead to potential security breaches and unauthorized access to sensitive information.

Vulnerability Detail

The stack-use-after-return vulnerability in template_sanity_check arises due to improper handling of memory after a function returns. This can result in reading data from the stack that has already been deallocated, leading to unpredictable behavior and potential security risks. In the case of OpenSC, this vulnerability can be exploited to execute arbitrary code or cause a denial-of-service attack. The vulnerability was reported through the OSS-Fuzz project and has been assigned the identifier OSV-2022-268.

How To Fix

Minimum fixed version

8697a01850d5e02a3099acd5160d0a0ee2d31077

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 temporary workaround, users can disable or restrict access to the affected functionality in OpenSC to mitigate the risk of exploitation. This can be achieved by modifying the configuration or access control settings of the application or system utilizing OpenSC. However, applying the official fix is strongly recommended to ensure complete resolution of the vulnerability.

Conclusion

The stack-use-after-return vulnerability in template_sanity_check of OpenSC can pose significant security risks and should be addressed promptly. Users are advised to update their OpenSC installations to a fixed version or apply the recommended workaround until the fix can be implemented. For further assistance or support in resolving this vulnerability, please contact DevNack.com.

See every vulnerability recorded for opensc →

Share this vulnerability

FAQ

OpenSC is an open-source smart card library that provides cryptographic and security functions for smart card applications.

A stack-use-after-return vulnerability occurs when a program reads data from the stack after it has been deallocated, leading to unpredictable behavior and potential security risks.

This vulnerability in OpenSC can be exploited to execute arbitrary code or cause a denial-of-service attack.

To fix this vulnerability, update the OpenSC package to a version that includes the fix, such as commit 8697a01850d5e02a3099acd5160d0a0ee2d31077 of the OpenSC GitHub repository.

As a temporary workaround, users can disable or restrict access to the affected functionality in OpenSC. However, applying the official fix is strongly recommended.

Related vulnerabilities

Recent vulnerabilities recorded for opensc.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

8697a01850d5e02a3099acd5160d0a0ee2d31077

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