]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/Pkcs7Verify: Add the comments to address security problem
authorLong Qin <qin.long@intel.com>
Thu, 12 Oct 2017 01:12:42 +0000 (09:12 +0800)
committerLong Qin <qin.long@intel.com>
Wed, 18 Oct 2017 15:03:38 +0000 (23:03 +0800)
Add the comments to address security problems in the Pkcs7Verify Protocol
per UEFI 2.7 updates.

The Pkcs7Verifier function VerifySignature() has problematic use cases
where it might be used to unwittingly bypass security checks.  The specific
problem is that if the supplied hash is a different algorithm from the
blacklist hash, the hash will be approved even if it should have been
denied. The added comments place a strong warning about the problem.
It is possible to use the protocol reliably, either by agreeing a hash to
use for all time (like sha256) or by looping over all supported hashes when
using the protocol.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
MdePkg/Include/Protocol/Pkcs7Verify.h
SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c

index ca5ec759108d718f3bcb74ba646b90f8e8abcd21..eaeda48300d369ce5ae0772c6a9f09a139cab36f 100644 (file)
@@ -6,7 +6,7 @@
   PKCS#7 is a general-purpose cryptographic standard (defined by RFC2315,\r
   available at http://tools.ietf.org/html/rfc2315).\r
 \r
   PKCS#7 is a general-purpose cryptographic standard (defined by RFC2315,\r
   available at http://tools.ietf.org/html/rfc2315).\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under\r
 the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
 This program and the accompanying materials are licensed and made available under\r
 the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
@@ -140,6 +140,14 @@ EFI_STATUS
   verifies the signature of the content is valid and signing certificate was not revoked\r
   and is contained within a list of trusted signers.\r
 \r
   verifies the signature of the content is valid and signing certificate was not revoked\r
   and is contained within a list of trusted signers.\r
 \r
+  Note: because this function uses hashes and the specification contains a variety of\r
+        hash choices, you should be aware that the check against the RevokedDb list\r
+        will improperly succeed if the signature is revoked using a different hash\r
+        algorithm.  For this reason, you should either cycle through all UEFI supported\r
+        hashes to see if one is forbidden, or rely on a single hash choice only if the\r
+        UEFI signature authority only signs and revokes with a single hash (at time\r
+        of writing, this hash choice is SHA256).\r
+\r
   @param[in]     This                 Pointer to EFI_PKCS7_VERIFY_PROTOCOL instance.\r
   @param[in]     Signature            Points to buffer containing ASN.1 DER-encoded PKCS\r
                                       detached signature.\r
   @param[in]     This                 Pointer to EFI_PKCS7_VERIFY_PROTOCOL instance.\r
   @param[in]     Signature            Points to buffer containing ASN.1 DER-encoded PKCS\r
                                       detached signature.\r
index 0da549a6bd57a09071c1c2d1fc4819e566bc50ab..ac83e6d5c249264ebee6da09909852fe5d41170c 100644 (file)
@@ -1321,6 +1321,14 @@ _Exit:
   verifies the signature of the content is valid and signing certificate was not revoked\r
   and is contained within a list of trusted signers.\r
 \r
   verifies the signature of the content is valid and signing certificate was not revoked\r
   and is contained within a list of trusted signers.\r
 \r
+  Note: because this function uses hashes and the specification contains a variety of\r
+        hash choices, you should be aware that the check against the RevokedDb list\r
+        will improperly succeed if the signature is revoked using a different hash\r
+        algorithm.  For this reason, you should either cycle through all UEFI supported\r
+        hashes to see if one is forbidden, or rely on a single hash choice only if the\r
+        UEFI signature authority only signs and revokes with a single hash (at time\r
+        of writing, this hash choice is SHA256).\r
+\r
   @param[in]     This                 Pointer to EFI_PKCS7_VERIFY_PROTOCOL instance.\r
   @param[in]     Signature            Points to buffer containing ASN.1 DER-encoded PKCS\r
                                       detached signature.\r
   @param[in]     This                 Pointer to EFI_PKCS7_VERIFY_PROTOCOL instance.\r
   @param[in]     Signature            Points to buffer containing ASN.1 DER-encoded PKCS\r
                                       detached signature.\r