Header bannerHeader banner

[BRLY-2022-173] Memory contents leak / information disclosure vulnerability in DXE driver on Dell platform.

September 21, 2023

Summary

BINARLY efiXplorer team has discovered a memory contents leak / information disclosure vulnerability that allows a potential attacker to dump stack memory or global memory into an NVRAM variable. This in turn could help building a successful attack vector based on exploiting a memory corruption vulnerability.

Vulnerability Information

  • BINARLY internal vulnerability identifier: BRLY-2022-173
  • AMI PSIRT assigned CVE identifier: CVE-2023-34470
  • CVSS v3.1: 6.0 Medium AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N

Affected Dell firmware with confirmed impact by Binarly team

Product Firmware version CPU Module name Module GUID Module SHA256
OptiPlex 7080 0.1.16.0 Intel 0A1C30D2-7821-4FD2-B3C1-D24FA4C84B6A 0a1c30d2-7821-4fd2-b3c1-d24fa4c84b6a f8d98000b805e8f2bae1fb8d9377020ff0beff3fbb237c972079e0be439ef60e

Potential impact

An attacker with high local access can exploit this vulnerability to read the contents of stack memory or global memory. This information could help with explotation of other vulnerabilities in DXE to elevate privileges from ring 3 or ring 0 (depends on the operating system) to a DXE driver and execute arbitrary code. Malicious code installed as a result of this exploitation could survive operating system (OS) boot process and runtime, or modify NVRAM area on the SPI flash storage (to gain persistence). Additionally, threat actors could use this vulnerability to bypass OS security mechanisms (modify privileged memory or runtime variables), influence OS boot process, and in some cases allow an attacker to hook or modify EFI Runtime services.

Vulnerability description

Let's take OptiPlex 7080's firmware (version: 0.1.16.0, module sha256: f8d98000b805e8f2bae1fb8d9377020ff0beff3fbb237c972079e0be439ef60e) as an example.

The following code in the module actually allows leaking memory:

  • a call to a gRT->GetVariable() offset: 0x880
  • a call to a gRT->SetVariable() offset: 0x8bf
__int64 __fastcall sub_7CC(__int64 a1, EFI_SYSTEM_TABLE *SystemTable)
{
  __int64 v2; // rbx
  __int64 v3; // r8
  __int64 v5; // [rsp+30h] [rbp-20h] BYREF
  _DWORD v6[6]; // [rsp+38h] [rbp-18h] BYREF
  __int64 v7; // [rsp+60h] [rbp+10h] BYREF
  unsigned int v8; // [rsp+70h] [rbp+20h] BYREF
  __int64 v9; // [rsp+78h] [rbp+28h] BYREF

  v7 = a1;
  v2 = 0i64;
  v6[0] = -2117640072;
  v9 = 0i64;
  v6[1] = 1130938334;
  v6[2] = 156733591;
  v6[3] = 1696251924;
  if ( !gST_0 )
  {
    gST_0 = SystemTable;
    gBS_0 = SystemTable->BootServices;
    gRT = SystemTable->RuntimeServices;
  }
  if ( sub_8D4(a1) )
  {
    v9 = 0i64;
    (gBS_0->InstallProtocolInterface)(&v9, &AMI_SETUP_NVRAM_UPDATE_GUID, 0i64, 0i64);
    v5 = 4i64;
    if ( (gRT->GetVariable)(L"AmiHardwareSignatureSetupUpdateCountVar", v6, &v8, &v5, &v7) >= 0 )
    {
      LODWORD(v2) = v7;
      v3 = v8;
    }
    else
    {
      v3 = 7i64;
      v8 = 7;
    }
    LODWORD(v7) = v2 + 1;
    return (gRT->SetVariable)(L"AmiHardwareSignatureSetupUpdateCountVar", v6, v3, v5, &v7);
  }
  return v2;
}

The gRT->SetVariable() service is called with the DataSize as an argument, which will be overwritten inside the gRT->GetVariable() service if the length of AmiHardwareSignatureSetupUpdateCountVar NVRAM variable is greater than 4.

Thus, a potential attacker can dump X - 4 bytes from the stack (or global memory) into AmiHardwareSignatureSetupUpdateCountVar NVRAM variable by setting AmiHardwareSignatureSetupUpdateCountVar NVRAM variable's size to X > 4.

To fix this vulnerability the DataSize must be re-initialized with the size of AmiHardwareSignatureSetupUpdateCountVar before calling gRT->SetVariable().

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 (YYYY-mm-dd)
Dell PSIRT is notified 2022-12-29
AMI PSIRT assigned CVE number 2023-08-14
AMI PSIRT provide patch release 2023-09-12
BINARLY public disclosure date 2023-09-21

Acknowledgements

BINARLY efiXplorer team

Tags
No items found.