Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 773991 (CVE-2020-14372, CVE-2020-25632, CVE-2020-25647, CVE-2020-27749, CVE-2020-27779, CVE-2021-20225, CVE-2021-20233)

Summary: <sys-boot/grub-2.06_rc1: multiple vulnerabilities
Product: Gentoo Security Reporter: Thomas Deutschmann (RETIRED) <whissi>
Component: VulnerabilitiesAssignee: Gentoo Security <security>
Status: RESOLVED FIXED    
Severity: normal CC: base-system, bertrand, hydrapolic, jasmin+gentoo
Priority: Normal Flags: nattka: sanity-check+
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://www.mail-archive.com/grub-devel@gnu.org/msg31641.html
See Also: https://bugs.gentoo.org/show_bug.cgi?id=778431
Whiteboard: A2 [glsa+ cve]
Package list:
sys-boot/grub-2.06_rc1
Runtime testing required: ---

Description Thomas Deutschmann (RETIRED) gentoo-dev 2021-03-02 15:29:38 UTC
Incoming details.
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2021-03-02 18:11:48 UTC
CVE-2020-14372 grub2: acpi command allows privileged user to load crafted
              ACPI tables when secure boot is enabled
CWE-184
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H


GRUB2 enables the use of the command acpi even when secure boot is
signaled by the firmware.  An attacker with local root privileges to
can drop a small SSDT in /boot/efi and modify grub.cfg to instruct
grub to load said SSDT.  The SSDT then gets run by the kernel and it
overwrites the kernel lockdown configuration enabling the attacker to
load unsigned kernel modules and kexec unsigned code.

====================================================================

CVE-2020-25632 grub2: use-after-free in rmmod command
CWE-416
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

The rmmod implementation for grub2 is flawed, allowing an attacker to
unload a module used as dependency without checking if any other
dependent module is still loaded. This leads to an use-after-free
scenario possibly allowing an attacker to execute arbitrary code and
by-pass Secure Boot protections.

====================================================================

CVE-2020-25647 grub2: out-of-bound write in grub_usb_device_initialize()
CWE-787
6.9/CVSS:3.1/AV:P/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

grub_usb_device_initialize() is called to handle USB device
initialization. it reads out the descriptors it needs from the USB
device and uses that data to fill in some USB data
structures. grub_usb_device_initialize() performs very little bounds
checking and simply assumes the USB device provides sane values. This
behavior can trigger memory corruption. If properly exploited, this
would lead to arbitrary code execution allowing the attacker to
by-pass SecureBoot mechanism.

Joseph Tartaro (IOActive), Ilja van Sprundel (IOActive)

====================================================================

CVE-2020-27749 grub2: Stack buffer overflow in grub_parser_split_cmdline
CWE-121
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

grub_parser_split_cmdline expands variable names present in the
supplied command line in to their corresponding variable contents and
uses a 1kB stack buffer for temporary storage without sufficient
bounds checking. If the function is called with a command line that
references a variable with a sufficiently large payload, it is
possible to overflow the stack buffer, corrupt the stack frame and
control execution.  An attacker may use this to circumvent Secure Boot
protections.

====================================================================

CVE-2020-27779 grub2: cutmem command allows privileged user to remove
              memory regions when Secure Boot is enabled
CWE-285
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

The grub2's cutmem command does not honor secure boot locking. This
allows an privileged attacker to remove address ranges from memory
creating an opportunity to circumvent SecureBoot protections after
proper triage about grub's memory layout.

====================================================================

CVE-2021-20225 grub2: heap out-of-bounds write in short form option parser
CWE-787
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

The option parser in grub2 allows an attacker to write past the end of
a heap-allocated buffer by calling certain commands with a large
number of specific short forms of options.

====================================================================

CVE-2021-20233 grub2: heap out-of-bound write due to mis-calculation of
              space required for quoting
CWE-787
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

There's a flaw on grub2 menu rendering code setparam_prefix() in the
menu rendering code performs a length calculation on the assumption
that expressing a quoted single quote will require 3 characters, while
it actually requires 4 characters. This allow an attacker to corrupt
memory by one byte for each quote in the input.
Comment 2 Mike Gilbert gentoo-dev 2021-03-14 19:00:26 UTC
I have added grub-2.06~rc1 to the gentoo repository today. Let's give it a week for people to test it.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-03-25 23:16:32 UTC
x86 done
Comment 4 Agostino Sarubbo gentoo-dev 2021-03-26 13:40:21 UTC
ppc stable
Comment 5 Agostino Sarubbo gentoo-dev 2021-03-26 14:24:48 UTC
amd64 stable
Comment 6 Agostino Sarubbo gentoo-dev 2021-03-27 18:25:34 UTC
ppc64 stable
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-03-28 07:10:07 UTC
arm64 done
Comment 8 Matt Turner gentoo-dev 2021-04-21 03:38:09 UTC
sparc done

all arches done
Comment 9 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2021-04-21 12:34:56 UTC
Please cleanup.
Comment 10 Larry the Git Cow gentoo-dev 2021-04-21 15:43:36 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6daa5197e9a530c71e1e78d25c1ffb356f78c972

commit 6daa5197e9a530c71e1e78d25c1ffb356f78c972
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2021-04-21 15:41:38 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2021-04-21 15:41:38 +0000

    sys-boot/grub: drop 2.04-r2, 2.05_alpha20200310-r1
    
    Bug: https://bugs.gentoo.org/773991
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-boot/grub/Manifest                           |   2 -
 sys-boot/grub/files/2.04-sparc64-bios-boot.patch |  50 ----
 sys-boot/grub/grub-2.04-r2.ebuild                | 297 -----------------------
 sys-boot/grub/grub-2.05_alpha20200310-r1.ebuild  | 288 ----------------------
 4 files changed, 637 deletions(-)
Comment 11 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2021-04-21 16:15:55 UTC
Thanks!
Comment 12 Thomas Deutschmann (RETIRED) gentoo-dev 2021-04-30 23:17:06 UTC
Added to an existing GLSA request.
Comment 13 GLSAMaker/CVETool Bot gentoo-dev 2021-05-01 00:01:55 UTC
This issue was resolved and addressed in
 GLSA 202104-05 at https://security.gentoo.org/glsa/202104-05
by GLSA coordinator Thomas Deutschmann (whissi).