mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-23 15:49:23 +00:00
shim_lock: Only skip loading shim_lock verifier with explicit consent
Commit 32ddc42c (efi: Only register shim_lock verifier if shim_lock
protocol is found and SB enabled) reintroduced CVE-2020-15705 which
previously only existed in the out-of-tree linuxefi patches and was
fixed as part of the BootHole patch series.
Under Secure Boot enforce loading shim_lock verifier. Allow skipping
shim_lock verifier if SecureBoot/MokSBState EFI variables indicate
skipping validations, or if GRUB image is built with --disable-shim-lock.
Fixes: 132ddc42c (efi: Only register shim_lock verifier if shim_lock
protocol is found and SB enabled)
Fixes: CVE-2020-15705
Fixes: CVE-2021-3418
Reported-by: Dimitri John Ledkov <xnox@ubuntu.com>
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
bb51ee2b49
commit
968de8c23c
7 files changed
+57
-10
No files matched your search
+16
-1
@@ -21,9 +21,11 @@
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/pe32.h>
|
||||
#include <grub/efi/sb.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/i386/linux.h>
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/verify.h>
|
||||
@@ -160,14 +162,27 @@ struct grub_file_verifier shim_lock_verifier =
|
||||
void
|
||||
grub_shim_lock_verifier_setup (void)
|
||||
{
|
||||
struct grub_module_header *header;
|
||||
grub_efi_shim_lock_protocol_t *sl =
|
||||
grub_efi_locate_protocol (&shim_lock_guid, 0);
|
||||
|
||||
/* shim_lock is missing, check if GRUB image is built with --disable-shim-lock. */
|
||||
if (!sl)
|
||||
return;
|
||||
{
|
||||
FOR_MODULES (header)
|
||||
{
|
||||
if (header->type == OBJ_TYPE_DISABLE_SHIM_LOCK)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Secure Boot is off. Do not load shim_lock. */
|
||||
if (grub_efi_get_secureboot () != GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
||||
return;
|
||||
|
||||
/* Enforce shim_lock_verifier. */
|
||||
grub_verifier_register (&shim_lock_verifier);
|
||||
|
||||
grub_env_set ("shim_lock", "y");
|
||||
grub_env_export ("shim_lock");
|
||||
}
|
||||
Reference in new issue
Block a user