Header bannerHeader banner

[BRLY-2021-042] SMM memory corruption vulnerability in SMM driver on multiple HP devices.

March 8, 2022


BINARLY efiXplorer team has discovered a SMM memory corruption vulnerability on multiple HP devices allowing a possible attacker to write fixed or predictable data to SMRAM. Exploiting this issue could lead to escalating privileges to SMM.

Vulnerability Information

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

Affected HP firmwares with confirmed impact by Binarly team

Device/Firmware File Name SHA256 (File PE32 section) File GUID
Device / firmware version: 02.05.01 Rev.A 0216 af877a766e3364252ce75dfb8288b2e3e3df33fe0fa9b090f5fcc9ce8c57b6fe 6C9A8087-B68E-4F3D-B87D-A76C829C7D3E

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 the 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 potentially could 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 GUID 3894c800-a50a-4cb2-afbc-9f0118377412 and located at offset 0x1988 in the driver.

The pseudocode for this handler is shown below:

EFI_STATUS __fastcall SmiHandler_1988(
        EFI_HANDLE DispatchHandle,
        const void *Context,
        void *CommBuffer,
        UINTN *CommBufferSize)

  if ( CommBuffer )
    if ( CommBufferSize )
      if ( *(_DWORD *)CommBuffer == 'DFCH'
        && !gBS->AllocatePool(EfiBootServicesData, 175 * BlocksNum, (void **)CommBuffer + 2) )
        DstBuffer = *((_QWORD *)CommBuffer + 2);
        Size = 175 * BlocksNum;
        *((_QWORD *)CommBuffer + 1) = BlocksNum;
        if ( DstBuffer )
          if ( Size && gSrcBuffer && DstBuffer != gSrcBuffer )
            CopyMem(DstBuffer, gSrcBuffer, Size);
  return 0;

As we can see 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 the SMRAM contents. This leads to rewriting pointed area with a fixed or predictable data (CopyMem(DstBuffer, gSrcBuffer, Size)). 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 input pointers (including nested pointers) for SMI handlers are wrapped with sanity checks to make sure they are not pointing into the 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
HP PSIRT is notified 2021-07-12
HP PSIRT confirmed reported issue 2021-08-09
HP PSIRT assigned CVE number 2021-08-19
CERT/CC created a case 2021-11-16
HP PSIRT provide patch release 2022-03-08
BINARLY public disclosure date 2022-03-08


BINARLY efiXplorer team