Header bannerHeader banner
Advisory ID:
BRLY-2022-131

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

June 22, 2023
Severity:
Medium
CVSS Score
6
Public Disclosure Date:
June 21, 2023

Summary

Binarly REsearch 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.
Vendors Affected Icon

Vendors Affected

Dell
Affected Products icon

Affected Products

Precision 3240 Compact

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

Summary

Binarly REsearch 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-131
  • Dell PSIRT assigned CVE identifier: CVE-2023-28042
  • DSA identifier: DSA-2023-099
  • 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 REsearch Team

Product Firmware version CPU Module name Module GUID Module SHA256
Precision 3240 Compact 0.1.15.0 Intel 534DB6EE-FEBD-4F63-9C1F-8425CA82C6E1 534db6ee-febd-4f63-9c1f-8425ca82c6e1 59f51092b44581ea5525d187d17b176c700057900475cbc552f68e1999f5eaf4

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 Precision 3240 Compact's firmware (version: 0.1.15.0, module sha256: 59f51092b44581ea5525d187d17b176c700057900475cbc552f68e1999f5eaf4) as an example.

The following code in the module actually allows leaking memory:

  • a call to a gRT->GetVariable() offset: 0x716
  • a call to a gRT->SetVariable() offset: 0x760
char __fastcall sub_6B8(unsigned int a1)
{
  unsigned int v2; // ebx
  char result; // al
  EFI_GUID VendorGuid; // [rsp+30h] [rbp-10h] BYREF
  bool Data; // [rsp+58h] [rbp+18h] BYREF
  UINTN DataSize; // [rsp+60h] [rbp+20h] BYREF

  VendorGuid.Data1 = -1954858115;
  *&VendorGuid.Data2 = 1210466085;
  *VendorGuid.Data4 = 365057174;
  *&VendorGuid.Data4[4] = 845990413;
  Data = 0;
  DataSize = 1i64;
  if ( (gRT->GetVariable(L"EfiExternalGfxState", &VendorGuid, 0i64, &DataSize, &Data) & 0x8000000000000000ui64) != 0i64 )
  {
    if ( sub_630() )
    {
      Data = 1;
      v2 = 240;
    }
    else
    {
      Data = 0;
      v2 = 180;
    }
    gRT->SetVariable(                           // <= second call
      L"EfiExternalGfxState",
      &VendorGuid,
      7u,
      DataSize,
      &Data);
    if ( a1 < v2 )
      __outbyte(0xCF9u, 6u);
  }
  result = sub_630();
  if ( Data != (result != 0) )
  {
    Data = result != 0;
    (gRT->SetVariable)(L"EfiExternalGfxState", &VendorGuid, 7i64, DataSize, &Data);
    result = 6;
    __outbyte(0xCF9u, 6u);
  }
  return result;
}

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 EfiExternalGfxState NVRAM variable is greater than 1.

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

To fix this vulnerability the DataSize must be re-initialized with the size of EfiExternalGfxState 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
Dell PSIRT confirmed reported issue 2023-03-16
Dell PSIRT assigned CVE number 2023-06-15
Dell PSIRT provide patch release 2023-06-15
BINARLY public disclosure date 2023-06-21

Acknowledgements

Binarly REsearch Team

Tags
No items found.
FWHunt
See if you are impacted now with our Firmware Vulnerability Scanner