Bug 2240913 (CVE-2023-40661) - CVE-2023-40661 OpenSC: multiple memory issues with pkcs15-init (enrollment tool)
Summary: CVE-2023-40661 OpenSC: multiple memory issues with pkcs15-init (enrollment tool)
Keywords:
Status: NEW
Alias: CVE-2023-40661
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 2248099
Blocks: 2240943
TreeView+ depends on / blocked
 
Reported: 2023-09-27 08:41 UTC by TEJ RATHI
Modified: 2023-12-18 11:01 UTC (History)
0 users

Fixed In Version: OpenSC 0.24.0-rc1
Doc Type: If docs needed, set a value
Doc Text:
Several memory vulnerabilities were identified within the OpenSC packages, particularly in the card enrollment process using pkcs15-init when a user or administrator enrolls cards. To take advantage of these flaws, an attacker must have physical access to the computer system and employ a custom-crafted USB device or smart card to manipulate responses to APDUs. This manipulation can potentially allow compromise key generation, certificate loading, and other card management operations during enrollment.
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2023:7876 0 None None None 2023-12-18 07:38:03 UTC
Red Hat Product Errata RHSA-2023:7879 0 None None None 2023-12-18 11:01:49 UTC

Description TEJ RATHI 2023-09-27 08:41:15 UTC
Several memory issues that are security relevant that were reported since the release of OpenSC 0.23.0 and that are relevant to the handling the card enrollment process using pkcs15-init.

All of these require physical access to the computer at the time user or administrator would be enrolling the cards (generating keys and loading certificates, other card/token management) operations. The attack requires crafted USB device or smart card that would present the system with specially crafted responses to the APDUs so they are considered a high-complexity and low-severity. This issue is not exploitable just by using a PKCS#11 module as done in most of the end-user deployments.

https://github.com/OpenSC/OpenSC/issues/2792#issuecomment-1674806651
https://github.com/OpenSC/OpenSC/wiki/OpenSC-security-advisories
https://github.com/OpenSC/OpenSC/releases/tag/0.24.0-rc1

Comment 1 TEJ RATHI 2023-09-27 08:51:05 UTC
All memory issues reference bugs:

* Stack buffer overflow in sc_pkcs15_get_lastupdate in pkcs15init
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60769 
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60527

 * Heap buffer overflow in setcos_create_key in pkcs15init
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60672 

 * Heap buffer overflow in cosm_new_file in pkcs15init
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60650 

 * Heap double free in sc_pkcs15_free_object_content
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60616 

 * Stack buffer overflow in cflex_delete_file in pkcs15init
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58932 

 * Heap buffer overflow in sc_hsm_write_ef in pkcs15init
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56213 

 * Stack buffer overflow while parsing pkcs15 profile files
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55998 
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55851

 * Stack buffer overflow in muscle driver in pkcs15init
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54312 

 * Stack buffer overflow in cardos driver in pkcs15init
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53927

Comment 3 TEJ RATHI 2023-11-06 06:13:51 UTC
Created opensc tracking bugs for this issue:

Affects: fedora-all [bug 2248099]

Comment 4 errata-xmlrpc 2023-12-18 07:38:02 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2023:7876 https://access.redhat.com/errata/RHSA-2023:7876

Comment 5 errata-xmlrpc 2023-12-18 11:01:48 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2023:7879 https://access.redhat.com/errata/RHSA-2023:7879


Note You need to log in before you can comment on or make changes to this bug.