Header bannerHeader banner
Advisory ID:
BRLY-2022-144

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

June 22, 2023
Severity:
Medium
CVSS Score
4.9
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
Intel
Affected Products icon

Affected Products

Inspiron 15 3511
Vostro 15 3510

Potential Impact

An attacker with high physical access can exploit this vulnerability to read the contents of stack memory or global memory. This information could help with exploration 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-144
  • Dell PSIRT assigned CVE identifier: CVE-2023-28044/CVE-2023-28035/CVE-2023-28058
  • DSA identifier: DSA-2023-099/DSA-2023-204
  • 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 REsearch Team

Product Firmware version CPU Module name Module GUID Module SHA256
Inspiron 15 3511, Vostro 15 3510 0.1.18.2 Intel Setup e6a7a1ce-5881-4b49-80be-69c91811685c 85d1e1cf6f5175d22ab262bc5034720287bfaf54e5a1b9074e624b106f627808
XPS 13 9365 0.2.24.0 Intel Setup e6a7a1ce-5881-4b49-80be-69c91811685c befd809dc391328ad5553f72f6528c74c152fb51aef52738f2c7f5e10dcda3c4
Inspiron 3910-China HDD Protection 0.1.7.3 Intel Setup e6a7a1ce-5881-4b49-80be-69c91811685c dccccb8c891fdfb772ce9ed8130b65897bff4ab6bc0f2e91055d169f528df4d1
Latitude 3301 0.1.17.0 Intel Setup e6a7a1ce-5881-4b49-80be-69c91811685c e4f86398668c72865f121e2ff10136da190c9fc18b4835ff0426d8ccb504cb25

Potential impact

An attacker with high physical 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 3511, Vostro 15 3510's firmware (version: 0.1.18.2, module sha256: 85d1e1cf6f5175d22ab262bc5034720287bfaf54e5a1b9074e624b106f627808) as an example.

The following code in the module actually allows leaking memory:

  • a call to a gRT->GetVariable() offset: 0xcb0
  • a call to a gRT->SetVariable() offset: 0xcde
__int64 __fastcall sub_BC8(EFI_CAPSULE_HEADER **a1)
{
  __int64 result; // rax
  __int64 v3; // [rsp+30h] [rbp-D0h] BYREF
  _BYTE v4[144]; // [rsp+40h] [rbp-C0h] BYREF
  _BYTE v5[688]; // [rsp+D0h] [rbp-30h] BYREF
  _BYTE v6[1072]; // [rsp+380h] [rbp+280h] BYREF
  _BYTE v7[1952]; // [rsp+7B0h] [rbp+6B0h] BYREF
  _BYTE v8[2096]; // [rsp+F50h] [rbp+E50h] BYREF
  __int64 v9; // [rsp+17A0h] [rbp+16A0h] BYREF
  __int64 v10; // [rsp+17A8h] [rbp+16A8h] BYREF

  result = ((__int64 (__fastcall *)(EFI_GUID *, _QWORD, __int64 *))gBS->LocateProtocol)(
             &AMI_TSE_SETUP_ENTER_PROTOCOL_GUID,
             0i64,
             &v3);
  if ( result >= 0 )
  {
    sub_11D84();
    v10 = 1943i64;
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, __int64 *, _BYTE *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
      L"Setup",
      &EFI_SETUP_VARIABLE_GUID,
      0i64,
      &v10,
      v7);
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, __int64, _BYTE *))gRT->SetVariable)(// <= second call
      L"ColdReset",
      &EFI_SETUP_VARIABLE_GUID,
      2i64,
      v10,
      v7);
    v10 = 1057i64;
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, __int64 *, _BYTE *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
      L"SaSetup",
      &SA_SETUP_VARIABLE_GUID,
      0i64,
      &v10,
      v6);
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, __int64, _BYTE *))gRT->SetVariable)(// <= second call
      L"SaColdReset",
      &SA_SETUP_VARIABLE_GUID,
      2i64,
      v10,
      v6);
    v10 = 143i64;
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, __int64 *, _BYTE *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
      L"MeSetup",
      &ME_SETUP_VARIABLE_GUID,
      0i64,
      &v10,
      v4);
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, __int64, _BYTE *))gRT->SetVariable)(// <= second call
      L"MeColdReset",
      &ME_SETUP_VARIABLE_GUID,
      2i64,
      v10,
      v4);
    v10 = 678i64;
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, __int64 *, _BYTE *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
      L"CpuSetup",
      &CPU_SETUP_VARIABLE_GUID,
      0i64,
      &v10,
      v5);
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, __int64, _BYTE *))gRT->SetVariable)(// <= second call
      L"CpuColdReset",
      &CPU_SETUP_VARIABLE_GUID,
      2i64,
      v10,
      v5);
    v10 = 2083i64;
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, __int64 *, _BYTE *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
      L"PchSetup",
      &PCH_SETUP_VARIABLE_GUID,
      0i64,
      &v10,
      v8);
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, __int64, _BYTE *))gRT->SetVariable)(// <= second call
      L"PchColdReset",
      &PCH_SETUP_VARIABLE_GUID,
      2i64,
      v10,
      v8);
    v10 = 2i64;
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, __int64 *, __int64 *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
      L"SiSetup",
      &SI_SETUP_VARIABLE_GUID,
      0i64,
      &v10,
      &v9);
    ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, __int64, __int64 *))gRT->SetVariable)(// <= second call
      L"SiColdReset",
      &SI_SETUP_VARIABLE_GUID,
      2i64,
      v10,
      &v9);
    return ((__int64 (__fastcall *)(EFI_CAPSULE_HEADER **))gBS->CloseEvent)(a1);
  }
  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 SaSetup NVRAM variable is greater than 1057.

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

To fix this vulnerability the DataSize must be re-initialized with the size of SaColdReset 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