[BRLY-2022-126] Memory contents leak / information disclosure vulnerability in DXE driver on Dell platform.
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-126
- AMI PSIRT assigned CVE identifier: CVE-2023-34469
- 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 |
---|---|---|---|---|---|
Latitude 3120 | 0.1.13.1 | AMD | 899407D7-99FE-43D8-9A21-79EC328CAC21 | 899407d7-99fe-43d8-9a21-79ec328cac21 | 53c72f110491b5bee302e898da8f9497d8e15ad037590c31fa4d709169158773 |
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:0xfc5c
- a call to a
gRT->SetVariable()
offset:0xfc8a
__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 AmiWrapperSetup
NVRAM variable is greater than 4
.
Thus, a potential attacker can dump X - 4
bytes from the stack (or global memory) into AmiWrapperColdReset NVRAM variable by setting AmiWrapperSetup
NVRAM variable's size to X > 4
.
To fix this vulnerability the DataSize
must be re-initialized with the size of AmiWrapperColdReset
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 |
AMI PSIRT assigned CVE number | 2023-08-14 |
AMI PSIRT provide patch release | 2023-09-12 |
BINARLY public disclosure date | 2023-09-21 |
Acknowledgements
BINARLY efiXplorer team