Bug 1628023 (CVE-2018-16425)

Summary: CVE-2018-16425 opensc: Double free handling responses from HSM Cards in pkcs15-sc-hsm.c:sc_pkcs15emu_sc_hsm_init()
Product: [Other] Security Response Reporter: Sam Fowler <sfowler>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: gmazyland, jjelen, klember, nmavrogi, tmraz
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: opensc 0.19.0-rc1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-18 08:03:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1628024, 1628025    
Bug Blocks: 1622787    

Description Sam Fowler 2018-09-12 05:53:15 UTC
A double free when handling responses from an HSM Card in sc_pkcs15emu_sc_hsm_init in libopensc/pkcs15-sc-hsm.c in OpenSC before 0.19.0-rc1 could be used by attackers able to supply crafted smartcards to cause a denial of service (application crash) or possibly have unspecified other impact.


External References:

https://www.x41-dsec.de/lab/advisories/x41-2018-002-OpenSC/


Upstream Patch:

https://github.com/OpenSC/OpenSC/commit/360e95d45ac4123255a4c796db96337f332160ad#diff-d643a0fa169471dbf2912f4866dc49c5

Comment 1 Sam Fowler 2018-09-12 05:53:48 UTC
Created opensc tracking bugs for this issue:

Affects: fedora-all [bug 1628024]

Comment 3 Doran Moppert 2018-09-18 07:58:18 UTC
Does not appear to affect opensc-0.16.0, which bails out early when unable to read EF.C_DevAut rather than attempting to save the context and continue.