Skip to content

jsacco/NTKernelWalkerLib

Repository files navigation

NTOSKRNL Walker Lib by Juan Sacco support@exploitpack.com https://exploitpack.com

NTKernelWalkerLib is a self contained library for resolving kernel offsets. It uses dbghelp to fetch RVAs of exported symbols from ntoskrnl.exe and uses and image mapper that can scan executable sections to find ROP gadgets such as “pop rcx ; ret” or “jmp rax”.

Examples of usage obtaining Token offset from the EPROCESS structure:

#include "NtoskrnlStructs.hpp"
int main() {
    ntstructs::NtoskrnlStructWalker w;
    if (!w.Initialize()) return 1; // loads C:\Windows\System32\ntoskrnl.exe + symbols
    auto tok = w.GetField("_EPROCESS", "Token");
    if (tok) std::printf("EPROCESS.Token offset = 0x%lx\n", tok->offset);
}

Listing all members of a struct:

auto members = w.GetStructMembers("_TOKEN");
for (auto& m : members.value_or(std::vector<ntstructs::StructMember>{})) {
    std::printf("%s @ 0x%lx (%s)%s\n",
                m.name.c_str(), m.offset, m.typeName.c_str(),
                m.isBitField ? " [bitfield]" : "");
}

Finding a field without knowing the parent struct:

auto any = w.FindFieldAcrossStructs("GrantedAccess");
if (any) std::printf("Found %s.%s at 0x%lx\n",
                     any->typeName.c_str(), any->name.c_str(), any->offset);

Symbol path control: pass explicit paths if offline or using a private server:

w.Initialize(L"C:\\Windows\\System32\\ntoskrnl.exe",
             L"srv*C:\\symcache*https://msdl.microsoft.com/download/symbols");

There is also a standalone version of this library here: https://github.com/jsacco/ntoskrnlwalker

About

NTKernelWalkerLib is a self contained library for resolving kernel offsets from user mode. It wraps dbghelp to fetch RVAs of exported symbols from ntoskrnl.exe and adds a lightweight image mapper that can scan executable sections to find short ROP gadgets such as “pop rcx ; ret” or “jmp rax”. The library exposes two main groups of functions:

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages