[BRLY-2022-158] Memory contents leak / information disclosure vulnerability in DXE driver on Dell platform.
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-158
- Dell PSIRT assigned CVE identifier: CVE-2023-28059
- DSA identifier: DSA-2023-099
- 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 3020 | 0.1.0.0 | Intel | LaunchPad3Drv | 1c675c27-6fb1-4170-94e7-3dffe8beadba | 9f5a54f9d0c27666478c65e18a16f306190cf3dee18c3d4f98b528722f330601 |
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 3020's firmware (version: 0.1.0.0, module sha256: 9f5a54f9d0c27666478c65e18a16f306190cf3dee18c3d4f98b528722f330601) as an example.
The following code in the module actually allows leaking memory:
- a call to a
gRT->GetVariable()
offset:0x1413
- a call to a
gRT->SetVariable()
offset:0x1442
__int64 __fastcall sub_13D4()
{
signed __int64 v0; // rbx
EFI_EVENT Event; // [rsp+40h] [rbp+10h] BYREF
UINTN DataSize; // [rsp+48h] [rbp+18h] BYREF
Event = 0i64;
DataSize = 8i64;
gRT->GetVariable( // <= first call (we can rewrite DataSize here)
(CHAR16 *)L"BIQ_BOOT_INTERRUPTION",
&VendorGuid,
0i64,
&DataSize,
&Event);
Event = (char *)Event + 1;
gRT->SetVariable( // <= second call
(CHAR16 *)L"BIQ_BOOT_INTERRUPTION",
&VendorGuid,
3u,
DataSize,
&Event);
v0 = sub_14D4();
if ( v0 >= 0 )
{
if ( byte_155A0 )
{
return sub_3F04();
}
else
{
Event = 0i64;
v0 = gBS->CreateEventEx(0x200u, 8ui64, nullsub_1, 0i64, &VariableGuid, &Event);
if ( v0 >= 0 )
{
v0 = gBS->SignalEvent(Event);
gBS->CloseEvent(Event);
}
}
}
return v0;
}
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 BIQ_BOOT_INTERRUPTION
NVRAM variable is greater than 8
.
Thus, a potential attacker can dump X - 8
bytes from the stack (or global memory) into BIQ_BOOT_INTERRUPTION NVRAM variable by setting BIQ_BOOT_INTERRUPTION
NVRAM variable's size to X > 8
.
To fix this vulnerability the DataSize
must be re-initialized with the size of BIQ_BOOT_INTERRUPTION
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 efiXplorer team