[BRLY-2021-014]
SMM memory corruption vulnerability in SMM driver on Fujitsu device (SMRAM write).
BINARLY efiXplorer team

Summary

BINARLY efiXplorer team has discovered a SMM memory corruption vulnerability in Fujitsu devices allowing a possible attacker to write data to SMRAM. Exploiting this issue could lead to escalating privileges to SMM.

Vulnerability Information

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

Affected Fujitsu firmwares with confirmed impact by BINARLY team

Device name Driver name Driver SHA256 File GUID
Fujitsu LIFEBOOK A3510 FjGabiFlashCoreAbstractionSmm 5c4e7948a36e140de59cfff4697cb58220e90a8a1a7be5121a1cbf8463cb73fb B0A6DB04-8A0F-4F4F-9C45-C3344515A583
Fujitsu LIFEBOOK U9310 FjGabiFlashCoreAbstractionSmm 56791211b90fafd4509ad906575d89809f42cdf5a29b2eab35686db823062d19 B0A6DB04-8A0F-4F4F-9C45-C3344515A583
Fujitsu LIFEBOOK U7511/U7411/U7311 FjGabiFlashCoreAbstractionSmm 17e5bce466af9b91894e7b349b17db67ff37b320e3c8edbb1ae185f0c4c95a8e B0A6DB04-8A0F-4F4F-9C45-C3344515A583
Fujitsu LIFEBOOK U9311 FjGabiFlashCoreAbstractionSmm ebe5fc84f58db0e8f577b4611e0d366dc8d5821b03c6844d62a2936e8c82519d B0A6DB04-8A0F-4F4F-9C45-C3344515A583
Fujitsu LIFEBOOK E5510/E5410 FjGabiFlashCoreAbstractionSmm 7c90785bdf3db6584745df4dcabd182ca7a01900b44813eda88ecb1dd75b2586 B0A6DB04-8A0F-4F4F-9C45-C3344515A583
Fujitsu LIFEBOOK U7510/U7410/U7310 FjGabiFlashCoreAbstractionSmm 56791211b90fafd4509ad906575d89809f42cdf5a29b2eab35686db823062d19 B0A6DB04-8A0F-4F4F-9C45-C3344515A583
Fujitsu LIFEBOOK E459/E449 FjGabiFlashCoreAbstractionSmm 9db39ad4d6d8bc6196aba9c1d4d04c13aa452210e034ac3a72c42f2b23f53c03 B0A6DB04-8A0F-4F4F-9C45-C3344515A583

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

Vulnerability description

In the function at offset 0x83EC (image sha256: 5c4e7948a36e140de59cfff4697cb58220e90a8a1a7be5121a1cbf8463cb73fb), the child software System Management Interrupt (SWSMI) handler with GUID 2bcf654b-7164-4aec-8bf8-ff830b756799 is registered:

__int64 sub_800083EC()
{
  // [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]

  Handle = 0;
  Status = gSmst_D780->SmiHandlerRegister(SmiHandler_82C4, &gSmiHandlerGuid, &DispatchHandle);
  if ( Status >= 0 )
    return gEfiBootServices->InstallProtocolInterface(&Handle, &ProprietaryProtocol_D288, EFI_NATIVE_INTERFACE, 0);
  return Status;
}

Find below the decompiled SWSMI handler code:

EFI_STATUS __fastcall SmiHandler_82C4(
        EFI_HANDLE DispatchHandle,
        const void *Context,
        CommBufferStruct *CommBuffer,
        UINTN *CommBufferSize)
{
  // [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]

  Status = EFI_SUCCESS;
  if ( !CommBuffer )
    Status = EFI_DEVICE_ERROR;
  if ( !CommBufferSize )
    Status = EFI_DEVICE_ERROR;
  CommBuffer1 = CommBuffer->byte0;
  if ( CommBuffer1 != 1 )
    return EFI_INVALID_PARAMETER;
  dword19 = CommBuffer->dword19;
  Result = sub_80009CB0(
             CommBuffer->qword9,
             CommBuffer->qword11,
             &dword19,
             CommBuffer->qword1D,
             CommBuffer->dword25,
             &v5,
             &v5 + 2);
  CommBuffer->dword1 = Result;
  CommBuffer->word7 = v5;
  CommBuffer->word5 = WORD2(v5);
  CommBuffer->dword19 = dword19;
  return 0;
}

This shows that if first QWORD from CommBuffer is 0x01 then following content from the CommBuffer can be overwritten:

  • 4 bytes at offset 1
  • 2 bytes at offset 5
  • 2 bytes at affset 7
  • 4 bytes at offset 25

There is no pointer validation carried out (to ensure CommBuffer and any other Communication Buffer nested contents are not pointing to SMRAM contents). Thus, a potential attacker can write fixed data to SMRAM to corrupt some data inside this memory (for example, change SMI handler's code or modify Smram Map structures to break input pointer validation for other SMI handlers, hence to completely make this mitigation inefficient). This could lead to gaining arbitrary code execution in SMM.

To fix this vulnerability, it is essential to wrap all the input pointers (including the nested pointers) for SMI handlers 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
Fujitsu PSIRT is notified 2021-09-10
Fujitsu PSIRT confirmed reported issue 2021-09-14
Fujitsu PSIRT assigned CVE number 2022-04-08
Fujitsu PSIRT provide patch release 2022-05-06
BINARLY public disclosure date 2022-05-10

Acknowledgements

BINARLY efiXplorer team