Header bannerHeader banner
Advisory ID:
BRLY-2021-031

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

February 1, 2022
Severity:
High
CVSS Score
8.2
Public Disclosure Date:
February 1, 2022

Summary

Binarly REsearch 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.
Vendors Affected Icon

Vendors Affected

Insyde
Affected Products icon

Affected Products

BullSequana Edge server

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).

Summary

Binarly REsearch 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-031
  • CERT/CC assigned case number: VU#796611
  • Insyde PSIRT assigned CVE identifier: CVE-2021-43323
  • 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 REsearch Team

Package File Name SHA256 (File PE32 section) File GUID
BIOS_SKD080.18.02.003.sign.tar.gz UsbCoreDxe B8B990B3CEBE83304F38F3DD374E98C95A4557CC109B5F6FC62C4F52F0E2F215 31FD7EAF-80A7-435E-8E0A-3F185F8667DD

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 0xFD and located at offset 0x291C in the driver:

EFI_STATUS SwSmiHandler(EFI_HANDLE DispatchHandle, const void *Context, void *CommBuffer, UINTN *CommBufferSize)
{
    if ( *((_BYTE *)gUnknownProtocol2 + 0x19B2) )
    {
        *((_QWORD *)gUnknownProtocol2 + 0x334) = 3;
        if ( !sub_8000717C((_QWORD *)gUnknownProtocol2 + 0x71) )
        {
            (*((_QWORD *)gUnknownProtocol2 + 0x50) + 0xC0))(&unk_8000ABD0, sub_800018D8, v9);
... 

As we can see, depending on the contents of a protocol pointed by gUnknownProtocol2 a function is invoked pointed by a value extracted from it. This protocol is located and configured during the initialization procedure in the driver.

...
gUnknownProtocol2Guid = {"c965c76a-d71e-4e66-ab06-c6230d528425"};
gEfiBootServices->LocateProtocol(&gUnknownProtocol2Guid, 0, &UnknownProtocol2);
...

Hence, a possible attacker with a R/W access to system memory has an opportunity to find this protocol in the system memory and modify it to hook the function being called in the SW SMI handler to escalate privileges to SMM (ring -2).

To exploit this vulnerability it is enough to:

  1. Find gUnknownProtocol2 protocol in system memory.
  2. Overwrite *((_QWORD *)gUnknownProtocol2 + 0x50) + 0xC0))() function pointer in it with the shellcode address.
  3. Trigger the SW SMI handler 0xFD via 0xB2 IO port.

To fix this vulnerability, it is essential that the usage of protocols from the system memory 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 REsearch Team

Tags
SMM
FWHunt
See if you are impacted now with our Firmware Vulnerability Scanner