From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web08.11898.1603287112862976588 for ; Wed, 21 Oct 2020 06:31:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZrS2X0oN; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603287111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ae1ZvoLWz6t+5vdDbqzIy8p6GhtCjW7PRRqpb9+kGlY=; b=ZrS2X0oNCitGgVRa1y5fIoa/+BAvFPGq2V7kYK9sxsaDbbEl9LnmX7oPTWSHA1W9VxGXTr QfiNUBFjLek6eEhsoroxTKvHk6/zB4NOPCtywaHu12g29snDAJkYZnZ+R0GrDUbhH/ttFF g6/5l92HeZ8Eoe4U9zJIXBat7pTSIQo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-449-XQcB8Ia-NjykVw4k70U_hA-1; Wed, 21 Oct 2020 09:31:25 -0400 X-MC-Unique: XQcB8Ia-NjykVw4k70U_hA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07614186DD35; Wed, 21 Oct 2020 13:31:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-111.ams2.redhat.com [10.36.113.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AF3A60FC2; Wed, 21 Oct 2020 13:31:22 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v1 1/1] CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku To: devel@edk2.groups.io, kun.q@outlook.com Cc: Jian J Wang , Xiaoyu Lu , Jiewen Yao , Guomin Jiang References: <20201021023228.1884-1-kun.q@outlook.com> From: "Laszlo Ersek" Message-ID: <7d518928-8d41-c79f-0b67-b10d8bf85359@redhat.com> Date: Wed, 21 Oct 2020 15:31:21 +0200 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/21/20 04:32, Kun Qin wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2459 > > SignerCert is part of Pkcs7 instance when both have valid content. OpenSLL > PKCS7_free function will release the memory of SignerCert when applicable. Is this a security issue? Thanks Laszlo > Freeing SignerCert with X509_free again might cause page fault if use- > after-free guard is enabled. > > Cc: Jian J Wang > Cc: Xiaoyu Lu > Cc: Jiewen Yao > Cc: Guomin Jiang > > Signed-off-by: Kun Qin > --- > CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c > index c9fdb65b99d1..40cc39afe7dd 100644 > --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c > +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c > @@ -508,10 +508,6 @@ Exit: > free (SignedData); > > } > > > > - if (SignerCert != NULL) { > > - X509_free (SignerCert); > > - } > > - > > if (Pkcs7 != NULL) { > > PKCS7_free (Pkcs7); > > } >