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 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 UEFI firmware (for example, Secure Boot and some types of memory isolation for hypervisors).
Binarly REsearch Team has discovered a SMM memory corruption vulnerability in Fujitsu devices allowing a possible attacker to write 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 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 UEFI firmware (for example, Secure Boot and some types of memory isolation for hypervisors).
In the function at offset 0x83EC
(image sha256: 5c4e7948a36e140de59cfff4697cb58220e90a8a1a7be5121a1cbf8463cb73fb
), the child software System Management Interrupt (SWSMI) handler with GUID 2bcf654b-7164-4aec-8bf8-ff830b756799
is registered:
__int64 sub_800083EC()
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
Handle = 0;
Status = gSmst_D780->SmiHandlerRegister(SmiHandler_82C4, &gSmiHandlerGuid, &DispatchHandle);
if ( Status >= 0 )
return gEfiBootServices->InstallProtocolInterface(&Handle, &ProprietaryProtocol_D288, EFI_NATIVE_INTERFACE, 0);
return Status;
}
Find below the decompiled SWSMI handler code:
EFI_STATUS __fastcall SmiHandler_82C4(
EFI_HANDLE DispatchHandle,
const void *Context,
CommBufferStruct *CommBuffer,
UINTN *CommBufferSize)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
Status = EFI_SUCCESS;
if ( !CommBuffer )
Status = EFI_DEVICE_ERROR;
if ( !CommBufferSize )
Status = EFI_DEVICE_ERROR;
CommBuffer1 = CommBuffer->byte0;
if ( CommBuffer1 != 1 )
return EFI_INVALID_PARAMETER;
dword19 = CommBuffer->dword19;
Result = sub_80009CB0(
CommBuffer->qword9,
CommBuffer->qword11,
&dword19,
CommBuffer->qword1D,
CommBuffer->dword25,
&v5,
&v5 + 2);
CommBuffer->dword1 = Result;
CommBuffer->word7 = v5;
CommBuffer->word5 = WORD2(v5);
CommBuffer->dword19 = dword19;
return 0;
}
This shows that if first QWORD from CommBuffer
is 0x01
then following content from the CommBuffer
can be overwritten:
There is no pointer validation carried out (to ensure CommBuffer
and any other Communication Buffer nested contents are not pointing to SMRAM contents). Thus, a potential attacker can write fixed data to SMRAM to corrupt some data inside this memory (for example, change SMI handler's code or modify Smram Map structures to break input pointer validation for other SMI handlers, hence to completely make this mitigation inefficient). This could lead to gaining arbitrary code execution in SMM.
To fix this vulnerability, it is essential to wrap all the input pointers (including the nested pointers) for SMI handlers with sanity checks to make sure they are not pointing into SMRAM.
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