Header bannerHeader banner
Advisory ID:
BRLY-2021-029

[BRLY-2021-029] SMM memory corruption vulnerability in combined DXE/SMM driver on BullSequana Edge server

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

Summary

Binarly REsearch Team has discovered a SMM memory corruption vulnerability on a BullSequana Edge server allowing a possible attacker to write fixed or predictable data to SMRAM. 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 UEFI firmware (for example, Secure Boot and some types of memory isolation for hypervisors).

Summary

Binarly REsearch Team has discovered a SMM memory corruption vulnerability on a BullSequana Edge server allowing a possible attacker to write fixed or predictable data to SMRAM. Exploiting this issue could lead to escalating privileges to SMM.

Vulanerability Information

  • BINARLY internal vulnerability identifier: BRLY-2021-029
  • CERT/CC assigned case number: VU#796611
  • Insyde PSIRT assigned CVE identifier: CVE-2021-33625
  • 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 REsearch Team

Package File Name SHA256 (File PE32 section) File GUID
BIOS_SKD080.18.02.003.sign.tar.gz HddPassword 1753665EA4300109A9CD9D36C1D370D3BAEDB1F055A3A3E8EBD8CF2F5E715EC9 E8571188-00C1-4ED4-B14E-E38451351EC4

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

Vulnerabilities description

The vulnerability exists in the SW SMI handler registered with the GUID 9c28be0c-ee32-43d8-a223-e7c1614ef7ca and located at offset 0x23B0 in the driver:

EFI_STATUS SmiHandler(EFI_HANDLE DispatchHandle, const void *Context, void *CommBuffer, UINTN *CommBufferSize)
{
    if ( CommBuffer && CommBufferSize )
    {
        if ( *(_QWORD *)CommBuffer != 1 )
        {
            if ( *(_QWORD *)CommBuffer == 2 )
            {
                ...
            }
            if ( *(_QWORD *)CommBuffer != 3i64 )
                goto LABEL_43;
        }
        
        ...
        
        CommBuffer[1] = Status;
    }
    
    return EFI_SUCCESS;
}

As we can see, the input Communication Buffer is not validated to be outside of SMRAM since the Communication Buffer size (*CommBufferSize) is not checked to be valid (not 0 or equal to any fixed expectable value) for relying on the validation implemented in PiSmmCommunicationSmm module (based on a Communication Header).

Keeping this in mind, a possible attacker has limited but still an opportunity to corrupt some SMM memory by pointing this buffer into SMRAM contents. This leads to rewriting pointed area with a fixed or predictable data - Status code. Writing such data into SMRAM could allow a possible attacker to corrupt some structures in the beginning of this memory (for example, change SMM S3 resume code pointer and hijack execution flow during SMM S3 wake up procedure). This could lead to gaining arbitrary code execution in SMM.

To exploit this vulnerability it is enough to:

  1. Set up a Communication Buffer (only a Communication Header with MessageSize = 0) just before SMRAM (SMRAM_BASE - sizeof(EFI_SMM_COMMUNICATE_HEADER)).
  2. 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 all the input pointers (including the nested pointers) for SMI handlers are wrapped with sanity checks to make sure they are not pointing into SMRAM.

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

Acknowledgements

Binarly REsearch Team

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