n/a
An attacker can exploit this vulnerability to elevate privileges from ring 0 to ring -2, execute arbitrary code in System Management Mode - an environment more privileged than operating system (OS) and completely isolated from it. Running arbitrary code in SMM additionally bypasses SMM-based SPI flash protections against modifications, which can help an attacker to install a firmware backdoor/implant into BIOS. Such a malicious firmware code in BIOS could persist across operating system re-installs. Additionally, this vulnerability potentially could be used by malicious actors to bypass security mechanisms provided by UEFI firmware (for example, Secure Boot and some types of memory isolation for hypervisors).
This vulnerability was detected by the Deep Vulnerability Analysis (DVA) component from Binarly Platform
Let's consider the vulnerability on the example of a module with SHA256 cdb48f86112ff4b6b8cda61212a19a606cc88f52b91fd799755e1133e1296505
. The pseudocode of the vulnerable function is presented below:
unsigned __int8 __fastcall sub_742C(_DWORD *a1)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS NUMPAD "+" TO EXPAND]
Guid.Data2 = 0x5A0;
Guid.Data1 = 0xA602C5B;
Guid.Data4[0] = 0x91;
Guid.Data4[1] = 0x81;
Guid.Data4[2] = 0xED;
Guid.Data3 = 0x40C4;
Guid.Data4[3] = 0xCD;
Guid.Data4[4] = 0x89;
Guid.Data4[5] = 0x1D;
Guid.Data4[6] = 0;
Guid.Data4[7] = 3;
if ( !gDellGnvsPtr )
{
DataSize = 4;
gRT_0->GetVariable(L"DELL_GNVS_PTR", &Guid, 0, &DataSize, &gDellGnvsPtr);
}
a1[6] = 0;
a1[8] = 0;
sub_5F58();
__outbyte(0x380, 0x83);
v3 = 897LL;
v4 = __inbyte(0x381);
if ( (v4 & 2) != 0 )
{
// ...
*(gDellGnvsPtr + 4144) = 2; // unchecked write (SMRAM corruption)
}
else
{
sub_7334(a1);
*(gDellGnvsPtr + 4144) = 1; // unchecked write (SMRAM corruption)
}
sub_5F58();
__outbyte(0x380, 0x83);
v8 = __inbyte(0x381);
v9 = 65;
if ( (v8 & 3) == 0 )
v9 = 45;
*(gDellGnvsPtr + 4146) = v9; // unchecked write (SMRAM corruption)
sub_5F58();
__outbyte(0x380, 0x83);
v10 = 897;
v11 = __inbyte(0x381);
result = v11 & 3;
if ( result )
v13 = (result - 1) <= 2;
else
v13 = 0;
v14 = gDellGnvsPtr;
*(gDellGnvsPtr + 4145) = v13; // unchecked write (SMRAM corruption)
v15 = (gDellGnvsPtr + 4144);
if ( gDellGnvsPtr != -4144 )
{
LOBYTE(v10) = 2;
LOBYTE(v14) = -82;
sub_5F94(v14, v10);
__outbyte(0x380, 0x83);
result = __inbyte(0x381);
if ( result == 1 )
{
*v15 = 1;
}
else if ( result == 2 )
{
*v15 = 2;
}
}
a1[5] = 0;
return result;
}
The GetVariable
call initializes gDellGnvsPtr
with the value stored in the DELL_GNVS_PTR
NVRAM variable. Since the DELL_GNVS_PTR
NVRAM variable is controlled by an attacker, they can perform multiple arbitrary write operations.
In order to fix this vulnerability, all user-controllable offsets and pointers should be checked with SmmIsBufferOutsideSmmValid()
or analogues before any write attempt.
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