An attacker with high local 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.
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.
An attacker with high local 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.
Let's take Inspiron 15 3525,Vostro 3525,Vostro 3425's firmware (version: 0.1.3.0, module sha256: 46244ee2b5fdc63a0dd05c021a6ea8c168815128fd29bb3c675e83702d5b8917) as an example.
The following code in the module actually allows leaking memory:
gRT->GetVariable()
offset: 0x6f4c
gRT->SetVariable()
offset: 0x6f91
__int64 __fastcall sub_6EB8(__int64 a1, char a2)
{
__int64 v5; // [rsp+30h] [rbp-28h] BYREF
__int16 v6; // [rsp+38h] [rbp-20h]
int v7; // [rsp+40h] [rbp-18h] BYREF
__int16 v8; // [rsp+44h] [rbp-14h]
__int16 v9; // [rsp+46h] [rbp-12h]
char v10; // [rsp+48h] [rbp-10h]
char v11; // [rsp+49h] [rbp-Fh]
char v12; // [rsp+4Ah] [rbp-Eh]
char v13; // [rsp+4Bh] [rbp-Dh]
char v14; // [rsp+4Ch] [rbp-Ch]
char v15; // [rsp+4Dh] [rbp-Bh]
char v16; // [rsp+4Eh] [rbp-Ah]
char v17; // [rsp+4Fh] [rbp-9h]
__int64 v18; // [rsp+60h] [rbp+8h] BYREF
unsigned int v19; // [rsp+68h] [rbp+10h] BYREF
v5 = 0i64;
v6 = 0;
v8 = -4810;
v9 = 18896;
v7 = 2039750349;
v10 = -127;
v11 = 36;
v12 = -28;
v13 = -61;
v14 = 26;
v15 = -57;
v16 = 92;
v17 = -44;
v18 = 10i64;
v19 = 6;
((void (__fastcall *)(const __int16 *, int *, unsigned int *, __int64 *, __int64 *))gRT->GetVariable)(// <= first call (we can rewrite DataSize here)
L"AmdAcpiVar",
&v7,
&v19,
&v18,
&v5);
v5 = a1;
if ( a2 )
v6 = 1;
else
++v6;
return ((__int64 (__fastcall *)(const __int16 *, int *, _QWORD, __int64, __int64 *))gRT->SetVariable)(
L"AmdAcpiVar",
&v7,
v19,
v18,
&v5);
}
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 AmdAcpiVar
NVRAM variable is greater than 10
.
Thus, a potential attacker can dump X - 10
bytes from the stack (or global memory) into AmdAcpiVar NVRAM variable by setting AmdAcpiVar
NVRAM variable's size to X > 10
.
To fix this vulnerability the DataSize
must be re-initialized with the size of AmdAcpiVar
before calling gRT->SetVariable()
.
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.
Binarly REsearch Team