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.
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: fd8ddad069d3583eef335a4deed2906bf3b24fce19a7c8d51dc1606b326b5411) as an example.
The following code in the module actually allows leaking memory:
gRT->GetVariable()
offset: 0x2827
gRT->SetVariable()
offset: 0x285f
void sub_27C0()
{
int v0; // eax
__int64 v1; // rax
int v2[4]; // [rsp+30h] [rbp-10h] BYREF
char v3; // [rsp+50h] [rbp+10h] BYREF
char v4; // [rsp+58h] [rbp+18h] BYREF
__int64 v5; // [rsp+60h] [rbp+20h] BYREF
sub_4C6C(1024i64, " CcxCheckDownCoreStatus Entry\n");
v2[0] = 41014;
v0 = sub_5974(v2);
v3 = 0;
v5 = 1i64;
v4 = v0 == 0;
v1 = (gRT->GetVariable)( // <= first call (we can rewrite DataSize here)
L"DownCoreStatus",
&VendorGuid,
0i64,
&v5,
&v3);
if ( v4 != v3 || v1 )
{
(gRT->SetVariable)( // <= second call
L"DownCoreStatus",
&VendorGuid,
7i64,
v5,
&v4);
if ( v3 && !v4 )
{
sub_4C6C(1024i64, aDowncoredAutoI);
(gRT->ResetSystem)(0i64, 0i64, 0i64, 0i64);
}
}
sub_4C6C(1024i64, aCcxcheckdownco_0);
}
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 DownCoreStatus
NVRAM variable is greater than 1
.
Thus, a potential attacker can dump X - 1
bytes from the stack (or global memory) into DownCoreStatus NVRAM variable by setting DownCoreStatus
NVRAM variable's size to X > 1
.
To fix this vulnerability the DataSize
must be re-initialized with the size of DownCoreStatus
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