Header bannerHeader banner
Advisory ID:
BRLY-2022-159

[BRLY-2022-159] 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
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 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-159
  • Dell PSIRT assigned CVE identifier: CVE-2023-28060
  • 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 9BCEDB6D-13CA-473E-B605-8A47688729FA 9bcedb6d-13ca-473e-b605-8a47688729fa adc756cd7143c8c1ec9e1f776aa1c7cee49da09f6e02b5bc609bc6969d977dcb

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: adc756cd7143c8c1ec9e1f776aa1c7cee49da09f6e02b5bc609bc6969d977dcb) as an example.

The following code in the module actually allows leaking memory:

  • a call to a gRT->GetVariable() offset: 0xa65
  • a call to a gRT->SetVariable() offset: 0xa9c
EFI_STATUS __fastcall sub_8AC()
{
  EFI_GUID VendorGuid; // [rsp+30h] [rbp-D0h] BYREF
  EFI_GUID v2; // [rsp+40h] [rbp-C0h] BYREF
  EFI_GUID v3; // [rsp+50h] [rbp-B0h] BYREF
  char Data[226]; // [rsp+60h] [rbp-A0h] BYREF
  __int16 v5; // [rsp+142h] [rbp+42h]
  int v6[2]; // [rsp+300h] [rbp+200h] BYREF
  char v7; // [rsp+30Ah] [rbp+20Ah]
  char v8; // [rsp+930h] [rbp+830h]
  UINT32 Attributes; // [rsp+A90h] [rbp+990h] BYREF
  char v10; // [rsp+A98h] [rbp+998h] BYREF
  int v11; // [rsp+A99h] [rbp+999h]
  __int16 v12; // [rsp+A9Dh] [rbp+99Dh]
  UINTN DataSize; // [rsp+AA0h] [rbp+9A0h] BYREF

  VendorGuid.Data1 = -1332766721;
  *&VendorGuid.Data2 = 1100211944;
  *VendorGuid.Data4 = -1637967959;
  *&VendorGuid.Data4[4] = 853215899;
  v2.Data1 = 1165015025;
  *&v2.Data2 = 1229172200;
  *v2.Data4 = 1681965965;
  *&v2.Data4[4] = -2078047118;
  v3.Data1 = -1426528487;
  *&v3.Data2 = 1083787512;
  *v3.Data4 = 1600452518;
  *&v3.Data4[4] = 1028417981;
  sub_1130(v6, 0, 0x77Fui64);
  v10 = 0;
  v11 = 0;
  v12 = 0;
  DataSize = 667i64;
  gRT->GetVariable(L"CpuSetup", &VendorGuid, &Attributes, &DataSize, Data);
  v5 = 256;
  gRT->SetVariable(L"CpuSetup", &VendorGuid, Attributes, DataSize, Data);
  DataSize = 1919i64;
  gRT->GetVariable(L"PchSetup", &v2, &Attributes, &DataSize, v6);
  v8 = 0;
  v7 = 0;
  gRT->SetVariable(L"PchSetup", &v2, Attributes, DataSize, v6);
  DataSize = 7i64;
  gRT->GetVariable(L"SiSetup", &v3, &Attributes, &DataSize, &v10);
  LOBYTE(v11) = 0;
  return gRT->SetVariable(L"SiSetup", &v3, Attributes, DataSize, &v10);
}

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

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

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