An attacker with local privileged access can exploit this vulnerability to read the contents of the stack and use this information to exploit other vulnerabilities in DXE. A malicious code installed as a result of the vulnerability exploitation in a DXE driver could survive across an operating system (OS) boot process and runtime or modify NVRAM area on SPI flash storage (to gain persistence on target platform).Additionally, this vulnerability potentially could be used by threat actors to bypass OS security mechanisms (modify privileged memory or runtime variables), influence on the OS boot process, and in some cases would allow an attacker to hook or modify EFI Runtime services.
Binarly REsearch Team has discovered a stack memory leak vulnerability that allows a potential attacker to write stack memory to NVRAM variable.
An attacker with local privileged access can exploit this vulnerability to read the contents of the stack and use this information to exploit other vulnerabilities in DXE. A malicious code installed as a result of the vulnerability exploitation in a DXE driver could survive across an operating system (OS) boot process and runtime or modify NVRAM area on SPI flash storage (to gain persistence on target platform).Additionally, this vulnerability potentially could be used by threat actors to bypass OS security mechanisms (modify privileged memory or runtime variables), influence on the OS boot process, and in some cases would allow an attacker to hook or modify EFI Runtime services.
The pseudocode of the vulnerable function is shown below:
__int64 sub_2B80()
{
// starting at basic block 0x3418
// ...
GetVariable = gRT->GetVariable;
DataSize = 49;
GetVariable(L"LenovoFunctionConfig", &gVariableGuid, &v24, &DataSize, Value);
Value[0] = 0;
result = (gRT->SetVariable)(L"LenovoFunctionConfig", &gVariableGuid, v24, DataSize, Value);
// ...
}
As we can see from the pseudocode, the gRT->SetVariable()
service is called with the DataSize
value, which can be overwritten inside the gRT->GetVariable()
service.
Thus, a potential attacker can write X - 49
bytes from the stack to NVRAM if writes any buffer of length X > 49
to the LenovoFunctionConfig
NVRAM variable.
In order to fix this vulnerability, the DataSize
variable must be initialized before gRT->SetVariable()
:
// ...
GetVariable = gRT->GetVariable;
DataSize = 49;
GetVariable(L"LenovoFunctionConfig", &gVariableGuid, &v24, &DataSize, Value);
Value[0] = 0;
DataSize = 49; // <--- added
result = (gRT->SetVariable)(L"LenovoFunctionConfig", &gVariableGuid, v24, DataSize, Value);
// ...
This vulnerability is subject to a 90 day disclosure deadline. After 90 days elapsed or a patch has been made broadly available (whichever is earlier), the vulnerability report will become visible to the public.
Binarly REsearch Team