summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/grub/files/CVE-2020-14372_4.patch
diff options
context:
space:
mode:
authorMarta Rybczynska <rybczynska@gmail.com>2022-01-05 09:40:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-11 22:28:38 +0000
commitc55481b8066a32afefdd4404b7ce5a7e8ebbb7cd (patch)
tree4e4cc8ffbd887bfa4cfcefd9592abd0e907383b7 /meta/recipes-bsp/grub/files/CVE-2020-14372_4.patch
parent6e6ede294c3391487df196055ad0544b08c2b1b2 (diff)
downloadpoky-c55481b8066a32afefdd4404b7ce5a7e8ebbb7cd.tar.gz
grub: fix CVE-2020-14372 and CVE-2020-27779
Fix issues with grub in secure boot mode where an attacker could circumvent secure boot by using acpi and cutmem commands. Also include patches fixing similar issues. Most patches are backported directly from grub. One patch (no-insmod-on-sb.patch) comes from Debian, as the upstream implementation is too complicated to backport. CVE-2020-14372 description (from NVD [1]): A flaw was found in grub2 in versions prior to 2.06, where it incorrectly enables the usage of the ACPI command when Secure Boot is enabled. This flaw allows an attacker with privileged access to craft a Secondary System Description Table (SSDT) containing code to overwrite the Linux kernel lockdown variable content directly into memory. The table is further loaded and executed by the kernel, defeating its Secure Boot lockdown and allowing the attacker to load unsigned code. The highest threat from this vulnerability is to data confidentiality and integrity, as well as system availability. CVE-2020-27779 description (from NVD [2]): A flaw was found in grub2 in versions prior to 2.06. The cutmem command does not honor secure boot locking allowing an privileged attacker to remove address ranges from memory creating an opportunity to circumvent SecureBoot protections after proper triage about grub's memory layout. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability. [1] https://nvd.nist.gov/vuln/detail/CVE-2020-14372 [2] https://nvd.nist.gov/vuln/detail/CVE-2020-27779 (From OE-Core rev: da6c0f3cfc920cea57cd409b17303bf735ccd68d) Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp/grub/files/CVE-2020-14372_4.patch')
-rw-r--r--meta/recipes-bsp/grub/files/CVE-2020-14372_4.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/CVE-2020-14372_4.patch b/meta/recipes-bsp/grub/files/CVE-2020-14372_4.patch
new file mode 100644
index 0000000000..ac509b63c7
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/CVE-2020-14372_4.patch
@@ -0,0 +1,52 @@
1From 0d809c0979ced9db4d0e500b3e812bba95e52972 Mon Sep 17 00:00:00 2001
2From: Javier Martinez Canillas <javierm@redhat.com>
3Date: Mon, 28 Sep 2020 20:08:29 +0200
4Subject: [PATCH] efi: Lockdown the GRUB when the UEFI Secure Boot is enabled
5
6If the UEFI Secure Boot is enabled then the GRUB must be locked down
7to prevent executing code that can potentially be used to subvert its
8verification mechanisms.
9
10Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
11Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
12
13Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=98b00a403cbf2ba6833d1ac0499871b27a08eb77]
14CVE: CVE-2020-14372
15Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
16---
17 grub-core/kern/efi/init.c | 15 +++++++++++++++
18 1 file changed, 15 insertions(+)
19
20diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
21index 3dfdf2d..db84d82 100644
22--- a/grub-core/kern/efi/init.c
23+++ b/grub-core/kern/efi/init.c
24@@ -20,6 +20,7 @@
25 #include <grub/efi/efi.h>
26 #include <grub/efi/console.h>
27 #include <grub/efi/disk.h>
28+#include <grub/lockdown.h>
29 #include <grub/term.h>
30 #include <grub/misc.h>
31 #include <grub/env.h>
32@@ -39,6 +40,20 @@ grub_efi_init (void)
33 /* Initialize the memory management system. */
34 grub_efi_mm_init ();
35
36+ /*
37+ * Lockdown the GRUB and register the shim_lock verifier
38+ * if the UEFI Secure Boot is enabled.
39+ */
40+ if (grub_efi_secure_boot ())
41+ {
42+ grub_lockdown ();
43+ /* NOTE: Our version does not have the shim_lock_verifier,
44+ * need to update below if added */
45+#if 0
46+ grub_shim_lock_verifier_setup ();
47+#endif
48+ }
49+
50 efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer,
51 0, 0, 0, NULL);
52