Header bannerHeader banner

[BRLY-2022-118] 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-118
  • AMD PSIRT assigned CVE identifier: CVE-2023-20594
  • CVSS v3.1: 4.9 Medium AV:P/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
Inspiron 15 3525,Vostro 3525,Vostro 3425 0.1.3.0 AMD A8DAFB9B-3529-4E87-8584-ECDB6A5B78B6 a8dafb9b-3529-4e87-8584-ecdb6a5b78b6 46244ee2b5fdc63a0dd05c021a6ea8c168815128fd29bb3c675e83702d5b8917
Inspiron 3585 3785 0.1.16.0 AMD A8DAFB9B-3529-4E87-8584-ECDB6A5B78B6 a8dafb9b-3529-4e87-8584-ecdb6a5b78b6 e941ec7b857c6b4581223a916375425bd306a60094f322501cc57756ad540100

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 Inspiron 15 3525,Vostro 3525,Vostro 3425's firmware (version: 0.1.3.0, module sha256: 46244ee2b5fdc63a0dd05c021a6ea8c168815128fd29bb3c675e83702d5b8917) as an example.

The following code in the module actually allows leaking memory:

  • a call to a gRT->GetVariable() offset: 0x6f4c
  • a call to a gRT->SetVariable() offset: 0x6f91
__int64 __fastcall sub_6EB8(__int64 a1, char a2)
{
  __int64 v5; // [rsp+30h] [rbp-28h] BYREF
  __int16 v6; // [rsp+38h] [rbp-20h]
  int v7; // [rsp+40h] [rbp-18h] BYREF
  __int16 v8; // [rsp+44h] [rbp-14h]
  __int16 v9; // [rsp+46h] [rbp-12h]
  char v10; // [rsp+48h] [rbp-10h]
  char v11; // [rsp+49h] [rbp-Fh]
  char v12; // [rsp+4Ah] [rbp-Eh]
  char v13; // [rsp+4Bh] [rbp-Dh]
  char v14; // [rsp+4Ch] [rbp-Ch]
  char v15; // [rsp+4Dh] [rbp-Bh]
  char v16; // [rsp+4Eh] [rbp-Ah]
  char v17; // [rsp+4Fh] [rbp-9h]
  __int64 v18; // [rsp+60h] [rbp+8h] BYREF
  unsigned int v19; // [rsp+68h] [rbp+10h] BYREF

  v5 = 0i64;
  v6 = 0;
  v8 = -4810;
  v9 = 18896;
  v7 = 2039750349;
  v10 = -127;
  v11 = 36;
  v12 = -28;
  v13 = -61;
  v14 = 26;
  v15 = -57;
  v16 = 92;
  v17 = -44;
  v18 = 10i64;
  v19 = 6;
  ((void (__fastcall *)(const __int16 *, int *, unsigned int *, __int64 *, __int64 *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"AmdAcpiVar",
    &v7,
    &v19,
    &v18,
    &v5);
  v5 = a1;
  if ( a2 )
    v6 = 1;
  else
    ++v6;
  return ((__int64 (__fastcall *)(const __int16 *, int *, _QWORD, __int64, __int64 *))gRT->SetVariable)(
           L"AmdAcpiVar",
           &v7,
           v19,
           v18,
           &v5);
}

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 AmdAcpiVar NVRAM variable is greater than 10.

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

To fix this vulnerability the DataSize must be re-initialized with the size of AmdAcpiVar 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
AMD PSIRT assigned CVE number 2023-06-06
AMD PSIRT provide patch release 2023-09-20
BINARLY public disclosure date 2023-09-21

Acknowledgements

BINARLY efiXplorer team

Tags
No items found.