Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2040853

Summary: Double free due to incorrect fix for CVE-2021-3712
Product: Red Hat Enterprise Linux 7 Reporter: Sara Golemon <sara.golemon>
Component: opensslAssignee: Sahana Prasad <sahana>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.9CC: orion, pasik
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-17 03:37:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sara Golemon 2022-01-14 19:37:37 UTC
Description of problem:

The fix for CVE-2021-3712 (Ref: https://git.centos.org/rpms/openssl/blob/2906dac54f4739d3cad6c96ad5dd11fec982098b/f/SOURCES/openssl-1.0.2k-cve-2021-3712.patch#_304 ) incorrectly frees `emtmp` and destroys the target stack after *successfully* adding it to the stack.  When this stack is destroyed, the pointer is freed again, causing a fault.

The root cause seems to be a logic inversion where, prior to this patch, destruction and `return 0;` happens on `!sk_OPENSSL_STRING_push(*sk, emtmp)` whereas after the patch, it happens on `sk_OPENSSL_STRING_push(*sk, emtmp)` (note the lack of negation in the latter case.

Version-Release number of selected component (if applicable):
1.0.2k-22.el7_9 vs 1.0.2k-23.el7_9

How reproducible:
This was reported by a customer of ours (MongoDB) with OCSP enabled.

Steps to Reproduce:
1. Install MongoDB 4.4.latest with RHEL7 openssl-1.0.2k-23.el7_9
2. Startup mongod with OCSP enabled.
3. Crash.

Actual results:

No crash.

Expected results:

Crash due to double free.

Additional info:

Interrestingly, upstream sources do not try to free emtmp even in the event of failure, but I suspect that's either a leak, or intentionally ignoring the use of block allocated scratch space. (Ref: https://github.com/openssl/openssl/blob/081314d07705aa58912845c213a48414d8f616a9/crypto/x509v3/v3_utl.c#L621-L626 )

Comment 3 Sahana Prasad 2022-01-17 03:37:09 UTC

*** This bug has been marked as a duplicate of bug 2039993 ***