From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.4423.1581588804867944962 for ; Thu, 13 Feb 2020 02:13:24 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: jiewen.yao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2020 02:13:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,436,1574150400"; d="scan'208";a="228099790" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga008.fm.intel.com with ESMTP; 13 Feb 2020 02:13:24 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 13 Feb 2020 02:13:24 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 13 Feb 2020 02:13:23 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.126]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.225]) with mapi id 14.03.0439.000; Thu, 13 Feb 2020 18:13:22 +0800 From: "Yao, Jiewen" To: "Wang, Jian J" , "devel@edk2.groups.io" CC: "Zhang, Chao B" , Laszlo Ersek Subject: Re: [PATCH 7/9] SecurityPkg/DxeImageVerificationLib: tighten default result of IsForbiddenByDbx()(CVE-2019-14575) Thread-Topic: [PATCH 7/9] SecurityPkg/DxeImageVerificationLib: tighten default result of IsForbiddenByDbx()(CVE-2019-14575) Thread-Index: AQHV3Ph9CN61oo8Ku0CTlofnSGQjAagY8mbA Date: Thu, 13 Feb 2020 10:13:21 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F92CC64@shsmsx102.ccr.corp.intel.com> References: <20200206141933.356-1-jian.j.wang@intel.com> <20200206141933.356-8-jian.j.wang@intel.com> In-Reply-To: <20200206141933.356-8-jian.j.wang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jiewen.yao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen Yao > -----Original Message----- > From: Wang, Jian J > Sent: Thursday, February 6, 2020 10:20 PM > To: devel@edk2.groups.io > Cc: Yao, Jiewen ; Zhang, Chao B > ; Laszlo Ersek > Subject: [PATCH 7/9] SecurityPkg/DxeImageVerificationLib: tighten default > result of IsForbiddenByDbx()(CVE-2019-14575) >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1608 >=20 > All intermediate results inside this function will be checked and > returned immediately upon any failure or error, like out-of-resource, > hash calculation error or certificate retrieval failure. >=20 > Cc: Jiewen Yao > Cc: Chao Zhang > Signed-off-by: Jian J Wang > Signed-off-by: Laszlo Ersek > --- > .../DxeImageVerificationLib/DxeImageVerificationLib.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) >=20 > diff --git > a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c > b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c > index a5dfee0f8e..2236ce98ce 100644 > --- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib= .c > +++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib= .c > @@ -1240,7 +1240,7 @@ IsForbiddenByDbx ( > // >=20 > // Variable Initialization >=20 > // >=20 > - IsForbidden =3D FALSE; >=20 > + IsForbidden =3D TRUE; >=20 > Data =3D NULL; >=20 > CertList =3D NULL; >=20 > CertData =3D NULL; >=20 > @@ -1257,7 +1257,14 @@ IsForbiddenByDbx ( > // >=20 > DataSize =3D 0; >=20 > Status =3D gRT->GetVariable (EFI_IMAGE_SECURITY_DATABASE1, > &gEfiImageSecurityDatabaseGuid, NULL, &DataSize, NULL); >=20 > + ASSERT (EFI_ERROR (Status)); >=20 > if (Status !=3D EFI_BUFFER_TOO_SMALL) { >=20 > + if (Status =3D=3D EFI_NOT_FOUND) { >=20 > + // >=20 > + // Evidently not in dbx if the database doesn't exist. >=20 > + // >=20 > + IsForbidden =3D FALSE; >=20 > + } >=20 > return IsForbidden; >=20 > } >=20 > Data =3D (UINT8 *) AllocateZeroPool (DataSize); >=20 > @@ -1366,6 +1373,8 @@ IsForbiddenByDbx ( >=20 >=20 > } >=20 >=20 >=20 > + IsForbidden =3D FALSE; >=20 > + >=20 > Done: >=20 > if (Data !=3D NULL) { >=20 > FreePool (Data); >=20 > -- > 2.24.0.windows.2