Header bannerHeader banner

[BRLY-2021-025] SMM callout vulnerability in combined DXE/SMM driver on BullSequana Edge server

February 1, 2022

Summary

BINARLY efiXplorer team has discovered a SMM callout vulnerability on a BullSequana Edge server allowing a possible attacker to hijack execution flow of a code running in System Management Mode. Exploiting this issue could lead to escalating privileges to SMM.

Vulnerability Information

  • BINARLY internal vulnerability identifier: BRLY-2021-025
  • CERT/CC assigned case number: VU#796611
  • Insyde PSIRT assigned CVE identifier: CVE-2022-24069
  • CVSS v3.1: 8.2 High AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H

Affected BullSequana Edge servers firmwares with confirmed impact by BINARLY team

Package File Name SHA256 (File PE32 section) File GUID
BIOS_SKD080.18.02.003.sign.tar.gz AhciBusDxe B53316361C54660956F1D8D0FBD16F4B645657A3B6E83AEA7602C8981140F585 3ACC966D-8E33-45C6-B4FE-62724BCD15A9

Potential impact

An attacker can exploit this vulnerability to elevate privileges from ring 0 to ring -2, execute arbitrary code in System Management Mode - an environment more privileged than operating system (OS) and completely isolated from it. Running arbitrary code in SMM additionally bypasses SMM-based SPI flash protections against modifications, which can help an attacker to install a firmware backdoor/implant into the BIOS. Such a malicious firmware code in the BIOS could persist across operating system re-installs. Additionally, this vulnerability could potentially be used by threat actors to bypass security mechanisms provided by the UEFI firmware (for example, Secure Boot and some types of memory isolation for hypervisors).

Vulnerability description

The vulnerability exists in the child SW SMI handler registered with the GUID 56947330-585c-4470-a95d-c55c529feb47 and located at offset 0x1328 in the driver:

EFI_STATUS SmiHandler(EFI_HANDLE DispatchHandle, const void *Context, void *CommBuffer, UINTN *CommBufferSize)
{
    if ( CommBuffer && CommBufferSize )
    {
        if ( *(_QWORD *)CommBuffer == 1 )
        {
            v11 = 0;
            if ( gEfiBootServices->LocateHandleBuffer)(2, &EFI_ATA_PASS_THRU_PROTOCOL_GUID, 0, &v13, &v11) )
...

As we can see, in case 1 is passed in the first QWORD inside a Communication Buffer, EFI_BOOT_SERVICES pointer will be dereferenced to call LocateHandleBuffer().

Usage of EFI_BOOT_SERVICES and EFI_RUNTIME_SERVICES is unsafe inside a code intended to run in SMM (from SMRAM), especially in SMI handlers, because a possible attacker with a R/W access to system memory could hook pointers in these tables to escalate privileges to SMM (ring -2).

To exploit this vulnerability it is enough to:

  1. Find EFI_BOOT_SERVICES table in system memory.
  2. Overwrite LocateHandleBuffer() service pointer in it with the shellcode address.
  3. Set up the first QWORD of a Communication Buffer with a value of 1.
  4. Trigger the SW SMI Handler (SW SMI number and pointer to Communication Buffer are specified in UEFI ACPI table) via 0xB2 IO port.

To fix this vulnerability, it is essential that the usage of the EFI_BOOT_SERVICES is minimised only to SMM driver's early initialization routine.

Disclosure timeline

This bug is subject to a 90 day disclosure deadline. After 90 days elapsed or a patch has been made broadly available (whichever is earlier), the bug report will become visible to the public.

Disclosure Activity Date
CERT/CC created a case 2021-09-27
Insyde PSIRT confirmed issue 2021-09-29
Insyde PSIRT assigned CVE number 2021-11-03
Insyde PSIRT provide patch release 2021-11-09
BINARLY public disclosure date 2022-02-01

Acknowledgements

BINARLY efiXplorer team

Tags
SMM
DXE