Header bannerHeader banner
Advisory ID:
BRLY-2022-023

[BRLY-2022-023] SMM memory corruption vulnerability in Software SMI handler

September 21, 2022
Severity:
High
CVSS Score
8.2
Public Disclosure Date:
September 21, 2022

Summary

Binarly REsearch Team has discovered a SMM memory corruption vulnerability 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

Framework
Insyde
Affected Products icon

Affected Products

No items found.

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

Summary

Binarly REsearch Team has discovered a SMM memory corruption vulnerability 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-2022-023
  • Insyde PSIRT assigned CVE identifier: CVE-2022-36448
  • FwHunt rule: BRLY-2022-023
  • CVSS v3.1 8.2 High AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H

Affected firmwares with confirmed impact by Binarly REsearch Team

Fimware Module name Module SHA256 File GUID
Framework_Laptop_12th_Gen_Intel_Core_capsule_EFI_signed_allsku_3.01.bin PnpSmm 26939c77c4803ba2589975403d41fc1ddc8d1ecf23e207a4dadba3038b6c6664 cc1baa36-11eb-45cc-9adc-7565e273ac70

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 Software SMI handler (SwSmiInputValue = 0x47) located at offset 0x3690 in the module.The pseudocode of the vulnerable handler is shown below:

EFI_STATUS __fastcall SwSmiHandler(
        EFI_HANDLE DispatchHandle,
        const void *Context,
        void *CommBuffer,
        UINTN *CommBufferSize)
{
  __int64 Ptr;
  __int16 Index;
  __int16 ResValue;
  UINTN Val;
  __int64 IhisiParamBufferValue;

  if ( ToGetIhisiParamBufferVar(&IhisiParamBufferValue, &Val, CommBuffer) >= EFI_SUCCESS )
  {
    Ptr = IhisiParamBufferValue;
    if ( *(IhisiParamBufferValue + 16) == 'BSI$' )
    {
      Index = *(*(IhisiParamBufferValue + 0x28) + 6);
      if ( (Index & 0xFFF8) == 80 )             // Index: 80, 81, 82, 83, 84, 85, 86, 87
        ResValue = (gFuncsTable[Index & 7])(*(IhisiParamBufferValue + 0x28));
      else
        ResValue = 0x82;
      *(Ptr + 8) = ResValue;
    }
  }
  return 0;
}

IhisiParamBufferValue will contain the NVRAM variable value:* name: IhisiParamBuffer* GUID: 92e59835-5f42-4e0b-9a84-47c7810ea806* DataSize: 8

The IhisiParamBuffer variable contains an address that is not checked (except for the check for signature located at IhisiParamBufferValue + 16).

As you can see from the pseudocode, a predictable value can be written by address IhisiParamBufferValue + 8.This can lead to DOS or execution of arbitrary code in SMM.

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
Framework PSIRT is notified 2022-06-27
Insyde PSIRT confirmed reported issue 2022-07-19
Insyde PSIRT assigned CVE number 2022-07-25
BINARLY public disclosure date 2022-09-21

Acknowledgements

Binarly REsearch Team

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