Header bannerHeader banner
Advisory ID:
BRLY-2022-125

[BRLY-2022-125] 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

Latitude 3120

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.

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-125
  • Dell PSIRT assigned CVE identifier: CVE-2023-28028
  • 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
Latitude 3120 0.1.13.1 AMD 899407D7-99FE-43D8-9A21-79EC328CAC21 899407d7-99fe-43d8-9a21-79ec328cac21 53c72f110491b5bee302e898da8f9497d8e15ad037590c31fa4d709169158773
Edge Gateway 3200 103 Intel Setup 899407d7-99fe-43d8-9a21-79ec328cac21 99e00b3febba1763a7ff3f1eb043872506a00032ea2166b3611c041f8e56a3bb
OptiPlex 7080 0.1.16.0 Intel 899407D7-99FE-43D8-9A21-79EC328CAC21 899407d7-99fe-43d8-9a21-79ec328cac21 b41bc6da0050201e654c226c08eb6eccbdc5c3a2595093a06b085bd777883a64

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 Latitude 3120's firmware (version: 0.1.13.1, module sha256: 53c72f110491b5bee302e898da8f9497d8e15ad037590c31fa4d709169158773) as an example.

The following code in the module actually allows leaking memory:

  • a call to a gRT->GetVariable() offset: 0xfb2a
  • a call to a gRT->SetVariable() offset: 0xfb55
__int64 __fastcall sub_F9AC()
{
  char v1[304]; // [rsp+30h] [rbp-D0h] BYREF
  char v2[672]; // [rsp+160h] [rbp+60h] BYREF
  char v3[1024]; // [rsp+400h] [rbp+300h] BYREF
  char v4[1920]; // [rsp+800h] [rbp+700h] BYREF
  char Data[3600]; // [rsp+F80h] [rbp+E80h] BYREF
  char v6; // [rsp+1DA0h] [rbp+1CA0h] BYREF
  char v7; // [rsp+1DA8h] [rbp+1CA8h] BYREF
  UINTN DataSize; // [rsp+1DB0h] [rbp+1CB0h] BYREF

  DataSize = 3600i64;
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, UINTN *, char *))gRT_0->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"Setup",
    &EFI_SETUP_VARIABLE_GUID,
    0i64,
    &DataSize,
    Data);
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, UINTN, char *))gRT_0->SetVariable)(// <= second call
    L"ColdReset",
    &EFI_SETUP_VARIABLE_GUID,
    2i64,
    DataSize,
    Data);
  DataSize = 1018i64;
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, UINTN *, char *))gRT_0->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"SaSetup",
    &SA_SETUP_VARIABLE_GUID,
    0i64,
    &DataSize,
    v3);
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, UINTN, char *))gRT_0->SetVariable)(// <= second call
    L"SaColdReset",
    &SA_SETUP_VARIABLE_GUID,
    2i64,
    DataSize,
    v3);
  DataSize = 297i64;
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, UINTN *, char *))gRT_0->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"MeSetup",
    &ME_SETUP_VARIABLE_GUID,
    0i64,
    &DataSize,
    v1);
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, UINTN, char *))gRT_0->SetVariable)(// <= second call
    L"MeColdReset",
    &ME_SETUP_VARIABLE_GUID,
    2i64,
    DataSize,
    v1);
  DataSize = 667i64;
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, UINTN *, char *))gRT_0->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"CpuSetup",
    &CPU_SETUP_VARIABLE_GUID,
    0i64,
    &DataSize,
    v2);
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, UINTN, char *))gRT_0->SetVariable)(// <= second call
    L"CpuColdReset",
    &CPU_SETUP_VARIABLE_GUID,
    2i64,
    DataSize,
    v2);
  DataSize = 1919i64;
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, UINTN *, char *))gRT_0->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"PchSetup",
    &PCH_SETUP_VARIABLE_GUID,
    0i64,
    &DataSize,
    v4);
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, UINTN, char *))gRT_0->SetVariable)(// <= second call
    L"PchColdReset",
    &PCH_SETUP_VARIABLE_GUID,
    2i64,
    DataSize,
    v4);
  DataSize = 7i64;
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, UINTN *, char *))gRT_0->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"SiSetup",
    &SI_SETUP_VARIABLE_GUID,
    0i64,
    &DataSize,
    &v7);
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, __int64, UINTN, char *))gRT_0->SetVariable)(// <= second call
    L"SiColdReset",
    &SI_SETUP_VARIABLE_GUID,
    2i64,
    DataSize,
    &v7);
  DataSize = 4i64;
  ((void (__fastcall *)(const __int16 *, EFI_GUID *, _QWORD, UINTN *, char *))gRT_0->GetVariable)(// <= first call (we can rewrite DataSize here)
    L"AmiWrapperSetup",
    &stru_22D78,
    0i64,
    &DataSize,
    &v6);
  return ((__int64 (__fastcall *)(const __int16 *, EFI_GUID *, __int64, UINTN, char *))gRT_0->SetVariable)(
           L"AmiWrapperColdReset",
           &stru_22D78,
           2i64,
           DataSize,
           &v6);
}

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 CpuSetup NVRAM variable is greater than 667.

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

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