Header bannerHeader banner

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

February 1, 2022


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-022
  • CERT/CC assigned case number: VU#796611
  • Insyde PSIRT assigned CVE identifier: CVE-2021-42060
  • CVSS v3.1: 7.5 High AV:L/AC:H/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 Int15ServiceSmm 08ADB25DDCFC2111CC0AD0D1C9F1D3FA0CB2BFD1EE88AAD0487CFBF5BFB6F3C3 7D4E94A9-269A-47A1-80F0-2B0EB42F7B4B

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 SW SMI handler registered with number 0xF9 and located at offset 0x06F0 in the driver:

EFI_STATUS SwSmiHandler(EFI_HANDLE DispatchHandle, const void *Context, void *CommBuffer, UINTN *CommBufferSize)
    if ( !*((_WORD *)gSmmBuffer + 3) )
        return sub_80000D18();

As we can see, depending on the contents of a buffer allocated in SMRAM pointed by gSmmBuffer, a routine sub_80000D18() is invoked that dereferences EFI_BOOT_SERVICES pointer to call LocateProtocol():

__int64 sub_80000D18()
    gEfiBootServices->LocateProtocol(&EFI_SMM_RUNTIME_PROTOCOL_GUID, 0, &EfiSmmRuntimeProtocol);
    if ((gEfiBootServices->LocateProtocol(&UNKNOWN_PROTOCOL_3D819F77_GUID, 0, &UnknownProtocol3d819f77) & 0x8000000000000000) == 0)
        *(_QWORD *)(0x10 * *((unsigned __int16 *)UnknownProtocol3d819f77 + 1) + 0x32) = sub_80001104;
        *(_DWORD *)gSmmBuffer = 'S51I';
        *((_WORD *)gSmmBuffer + 2) = *(_WORD *)UnknownProtocol3d819f77;
        *((_WORD *)gSmmBuffer + 3) = *((_WORD *)UnknownProtocol3d819f77 + 1);
        *((_QWORD *)gSmmBuffer + 2) = sub_80000B2C;
        *((_QWORD *)gSmmBuffer + 3) = sub_80001040;

It is worth mentioning that sub_80000D18() is also called from the initialization procedure in this driver just after the allocation of gSmmBuffer. The value in *((_WORD *)gSmmBuffer + 3) will be initialized with a value taken from 3d819f77-ad7d-407d-8d44-e7a61f0cb49c protocol. However this value could be 0 which allows the execution of the sub_80000D18() function in the SW SMI handler.

In any case, the usage of EFI_BOOT_SERVICES and EFI_RUNTIME_SERVICES is unsafe inside a code intended to run in the SMM (from SMRAM), especially in SMI handlers, because an attacker capable of executing code in DXE phase could exploit this vulnerability 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 LocateProtocol() service pointer in it with the shellcode address.
  3. Trigger the SW SMI handler 0xF9 via 0xB2 IO port.

To fix this vulnerability, it is essential that usage of 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-07
Insyde PSIRT provide patch release 2021-11-09
BINARLY public disclosure date 2022-02-01


BINARLY efiXplorer team