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 the SMM additionally bypasses SMM-based SPI flash protections against modifications, which can help an attacker to install a firmware backdoor/implant into the BIOS. Such a malicious firmware code in the BIOS could persist across operating system re-installs. Additionally, this vulnerability potentially could be used by threat actors to bypass security mechanisms provided by the UEFI firmware (for example, Secure Boot and some types of memory isolation for hypervisors).
Binarly REsearch Team has discovered a SMM memory corruption vulnerability allowing a possible attacker to write fixed or predictable data to SMRAM. Exploiting this issue could lead to escalating privileges to SMM.
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 the SMM additionally bypasses SMM-based SPI flash protections against modifications, which can help an attacker to install a firmware backdoor/implant into the BIOS. Such a malicious firmware code in the BIOS could persist across operating system re-installs. Additionally, this vulnerability potentially could be used by threat actors to bypass security mechanisms provided by the UEFI firmware (for example, Secure Boot and some types of memory isolation for hypervisors).
The vulnerability exists in the Software SMI handler (SwSmiInputValue = 0x47
) located at offset 0x3690
in the module.The pseudocode of the vulnerable handler is shown below:
EFI_STATUS __fastcall SwSmiHandler(
EFI_HANDLE DispatchHandle,
const void *Context,
void *CommBuffer,
UINTN *CommBufferSize)
{
__int64 Ptr;
__int16 Index;
__int16 ResValue;
UINTN Val;
__int64 IhisiParamBufferValue;
if ( ToGetIhisiParamBufferVar(&IhisiParamBufferValue, &Val, CommBuffer) >= EFI_SUCCESS )
{
Ptr = IhisiParamBufferValue;
if ( *(IhisiParamBufferValue + 16) == 'BSI$' )
{
Index = *(*(IhisiParamBufferValue + 0x28) + 6);
if ( (Index & 0xFFF8) == 80 ) // Index: 80, 81, 82, 83, 84, 85, 86, 87
ResValue = (gFuncsTable[Index & 7])(*(IhisiParamBufferValue + 0x28));
else
ResValue = 0x82;
*(Ptr + 8) = ResValue;
}
}
return 0;
}
IhisiParamBufferValue
will contain the NVRAM variable value:* name: IhisiParamBuffer
* GUID: 92e59835-5f42-4e0b-9a84-47c7810ea806
* DataSize: 8
The IhisiParamBuffer
variable contains an address that is not checked (except for the check for signature located at IhisiParamBufferValue + 16
).
As you can see from the pseudocode, a predictable value can be written by address IhisiParamBufferValue + 8
.This can lead to DOS or execution of arbitrary code in SMM.
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