Stack-buffer-overflow in pgp_parse_algo_attr_blob in opensc
Summary
OSV-2020-969: Stack-buffer-overflow in pgp_parse_algo_attr_blob. Affects opensc versions >= c4dcac5de77825e79763c9cd5f58aa8bde22f0b2, < 333c41c5d51450177553b8fd8cb2d710a7f7dec5. Fixed in 333c41c5d51450177553b8fd8cb2d710a7f7dec5. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
OpenSC is an open-source smart card library that provides a set of cryptographic functions and protocols for interacting with smart cards. It is commonly used in applications that require secure authentication and data encryption. The vulnerability in question, identified as OSV-2020-969, affects the pgp_parse_algo_attr_blob function in OpenSC. This function is responsible for parsing algorithm attribute blobs in the Pretty Good Privacy (PGP) protocol. The vulnerability allows for a stack-buffer-overflow WRITE 4, which can lead to a crash or potentially be exploited by an attacker to execute arbitrary code.
Vulnerability Detail
The vulnerability originates from a stack-buffer-overflow WRITE 4 in the pgp_parse_algo_attr_blob function. When processing a specially crafted algorithm attribute blob, the function fails to properly validate the size of the buffer, resulting in a buffer overflow. This can overwrite adjacent memory and potentially lead to a crash or arbitrary code execution. The vulnerability was discovered through an OSS-Fuzz report and has been assigned a severity rating of HIGH. The exact range of affected versions is unknown, but it was introduced at commit c4dcac5de77825e79763c9cd5f58aa8bde22f0b2 and fixed at commit 333c41c5d51450177553b8fd8cb2d710a7f7dec5 in the OpenSC GitHub repository.
How To Fix
Minimum fixed version
333c41c5d51450177553b8fd8cb2d710a7f7dec5
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 the vulnerability by disabling or not using the affected functionality related to the pgp_parse_algo_attr_blob function. This can be achieved by modifying the code or configuration of the application that utilizes OpenSC.
Conclusion
In conclusion, the pgp_parse_algo_attr_blob function in OpenSC is vulnerable to a stack-buffer-overflow WRITE 4, which can result in a crash or arbitrary code execution. It is recommended to update the OpenSC package to a fixed version or apply a workaround to mitigate the risk. For further assistance with vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for opensc →
FAQ
OpenSC is an open-source smart card library that provides cryptographic functions and protocols for interacting with smart cards.
The vulnerability can lead to a crash or potentially be exploited by an attacker to execute arbitrary code.
The vulnerability was discovered through an OSS-Fuzz report.
The vulnerability has been assigned a severity rating of HIGH.
To fix this vulnerability, update the OpenSC package to a version that includes the fix commit 333c41c5d51450177553b8fd8cb2d710a7f7dec5 or later.
References
Related vulnerabilities
Recent vulnerabilities recorded for opensc.