WI

windows-kernel-security

Provides guidance on Windows kernel security, driver development, and analysis of low-level system mechanisms.

Install

mkdir -p .claude/skills/windows-kernel-security && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4184" && unzip -o skill.zip -d .claude/skills/windows-kernel-security && rm skill.zip

Installs to .claude/skills/windows-kernel-security

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guide for Windows kernel internals and security mechanisms used in game protection and low-level research. Use this skill when working with drivers, IRQL-sensitive callbacks, EPROCESS, ETHREAD, MMVAD internals, IOCTL paths, DSE, PatchGuard, HVCI, PiDDBCache, MmUnloadedDrivers, or kernel memory inspection.
306 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Inspect EPROCESS/ETHREAD structures
  • Enumerate system callbacks
  • Walk kernel memory structures via debug symbols
  • Analyze driver object dependencies
  • Resolve symbol offsets for driver research

How it works

Uses symbol servers to map memory address space to Windows kernel data structures and inspects system-level bookkeeping tables.

Inputs & outputs

You give it
Kernel structure name or target driver file
You get back
Memory offset, structure layout, or callback analysis

When to use windows-kernel-security

  • Research Windows kernel internals
  • Analyze system callbacks
  • Study driver security mechanisms
  • Inspect kernel memory structures

About this skill

Windows Kernel Security

Overview

This skill covers Windows kernel internals that matter for game security research: object callbacks, process and image notifications, APC behavior, driver loading, trust enforcement, memory manager structures, and the bookkeeping anti-cheats inspect to detect hostile drivers or hidden executable code.

Treat undocumented structures, offsets, globals, and allocator internals as build-specific. Verify them against symbols and runtime observations for the exact Windows build; use research-rigor before generalizing a PoC or forensic heuristic.

README Coverage

  • Cheat > PatchGuard-related
  • Cheat > Driver Signature enforcement
  • Cheat > Windows Kernel Explorer
  • Cheat > EFI Driver (cross-reference with game-hacking skill)
  • Cheat > Vulnerable Driver
  • Anti Cheat > Detection:Attach
  • Anti Cheat > Detection:Hide
  • Anti Cheat > Detection:Vulnerable Driver
  • Anti Cheat > Detection:Spoof Stack
  • Anti Cheat > Windows Ring3 Callback
  • Anti Cheat > Windows Ring0 Callback
  • Anti Cheat > Information System & Forensics
  • Some Tricks > Windows Ring0
  • Windows Security Features

Core Kernel Concepts

Important Structures

  • EPROCESS / ETHREAD
  • KTHREAD / KAPC / KAPC_STATE
  • MMVAD / VAD tree nodes
  • PEB / TEB
  • DRIVER_OBJECT
  • DEVICE_OBJECT
  • IRP (I/O Request Packet)

Key Tables

  • SSDT (System Service Descriptor Table)
  • IDT (Interrupt Descriptor Table)
  • GDT (Global Descriptor Table)
  • PspCidTable (Process/Thread handle table)
  • PiDDBCacheTable / MmUnloadedDrivers / PoolBigPageTable

User-Mode Kernel Symbol Walking

Methodology

- Load local ntoskrnl image (typically C:\Windows\System32\ntoskrnl.exe)
- Use dbghelp + symbol server path (srv*cache*https://msdl.microsoft.com/download/symbols)
  to resolve exported symbol RVAs and type information
- Build structure-aware field lookup:
  - Query field offset directly (e.g., _EPROCESS.Token)
  - Enumerate all members of a target struct (_TOKEN, _EPROCESS, etc.)
  - Search a field name across all known structs (useful when parent type is unknown)
- Keep symbol path configurable for offline/private symbol repositories

Why It Matters in Game Security

- Reduces hardcoded-offset fragility across Windows builds
- Helps map kernel object layouts used by anti-cheat and drivers
- Supports rapid adaptation when anti-cheat-relevant fields shift
  (EPROCESS, ETHREAD, token/handle/security-related members)

Gadget Scanning Workflow

- Map executable sections of ntoskrnl image in user mode
- Scan for short control-flow gadgets (e.g., pop rcx ; ret, jmp rax)
- Use as a research primitive for:
  - ROP chain feasibility analysis
  - Kernel exploit mitigation evaluation
  - Anti-cheat hardening review against gadget-dependent attack paths

Security Features

PatchGuard (Kernel Patch Protection)

- Protects critical kernel structures
- Periodic verification checks
- BSOD on tampering detection
- Multiple trigger mechanisms

Driver Signature Enforcement (DSE)

- Requires signed drivers
- CI.dll verification
- Test signing mode
- WHQL certification

Virtualization-Based Security (VBS)

Architecture:
- Uses the Windows hypervisor to create an isolated execution environment
- Splits the system into Virtual Trust Levels (VTLs)
  - VTL0: Normal world — standard Windows kernel and user-mode processes
  - VTL1: Secure world — Secure Kernel, security policy enforcement
- VTL1 is designed to remain isolated from a compromised VTL0, assuming the
  hypervisor, secure kernel, hardware, and configuration path remain trustworthy
- Three main buckets:
  - Memory-protection features (HVCI)
  - Virtual Trust Levels (VTL0/VTL1 separation)
  - VBS enclaves (isolated execution for selected workloads)

Hypervisor-Enforced Code Integrity (HVCI)

- Also known as Memory Integrity
- Ensures only trusted, validated code executes in kernel mode
- Combines Windows hypervisor + Secure Kernel (VTL1) for enforcement
- Key mechanism: W→X transition restriction
  - Enforced code pages are not intended to be writable from VTL0
  - Executability is granted only after the configured code-integrity checks
- Enforcement pipeline:
  - Code integrity policy defines what is trusted
  - Hypervisor memory enforcement via second-stage address translation (EPT/SLAT)
  - Once a kernel page is validated, strict execution rules are enforced
- Driver compatibility requirements: drivers must be HVCI-compatible

Secure Boot

- UEFI-based boot verification
- Boot loader chain validation
- Kernel signature checks
- DBX (forbidden signatures)
- Foundation for attestation and DMA-hardening assumptions

Kernel Callbacks

Process Callbacks

PsSetCreateProcessNotifyRoutine
PsSetCreateProcessNotifyRoutineEx
PsSetCreateProcessNotifyRoutineEx2

Thread Callbacks

PsSetCreateThreadNotifyRoutine
PsSetCreateThreadNotifyRoutineEx

Image Load Callbacks

PsSetLoadImageNotifyRoutine
PsSetLoadImageNotifyRoutineEx

Object Callbacks

ObRegisterCallbacks
// OB_OPERATION_HANDLE_CREATE
// OB_OPERATION_HANDLE_DUPLICATE

APC / Execution Context

KeInitializeApc
KeInsertQueueApc
KeStackAttachProcess
RtlWalkFrameChain

Registry Callbacks

CmRegisterCallback
CmRegisterCallbackEx

Minifilter Callbacks

FltRegisterFilter
// IRP_MJ_CREATE, IRP_MJ_READ, etc.

Driver Development

Basic Structure

NTSTATUS DriverEntry(
    PDRIVER_OBJECT DriverObject,
    PUNICODE_STRING RegistryPath
) {
    DriverObject->DriverUnload = DriverUnload;
    DriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchCreate;
    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchIoctl;
    // Create device, symbolic link...
    return STATUS_SUCCESS;
}

Communication Methods

  • IOCTL (DeviceIoControl)
  • Direct I/O
  • Buffered I/O
  • Shared memory

Vulnerable Driver Exploitation

Common Vulnerability Types

  • Arbitrary read/write primitives
  • IOCTL handler vulnerabilities
  • Pool overflow
  • Use-after-free

Notable Vulnerable Drivers

- gdrv.sys (Gigabyte)
- iqvw64e.sys (Intel)
- MsIo64.sys
- Mhyprot2.sys (Genshin Impact)
- dbutil_2_3.sys (Dell)
- RTCore64.sys (MSI)
- Capcom.sys

Exploitation Steps

  1. Load vulnerable signed driver
  2. Trigger vulnerability
  3. Achieve kernel read/write
  4. Disable DSE or load unsigned driver
  5. Execute arbitrary kernel code

PatchGuard Bypass Techniques

Timing-Based

  • Predict PG timer
  • Modify between checks

Context Manipulation

  • Exception handling
  • DPC manipulation
  • Thread context tampering

Hypervisor-Based

  • EPT manipulation
  • Memory virtualization
  • Intercept PG checks

Kernel Hooking

ETW (Event Tracing for Windows)

- InfinityHook technique
- HalPrivateDispatchTable
- System call tracing

ETW Internals

Provider / Consumer Model

Architecture:
- Providers: kernel or user-mode components that emit events
  - Manifest-based providers (registered via wevtutil)
  - TraceLogging providers (self-describing, no manifest)
  - MOF providers (legacy WMI-based)
- Consumers: tools that subscribe to and process events
  - Real-time consumers (ETW sessions)
  - Log file consumers (.etl files)
- Controllers: manage sessions (xperf, tracelog, logman)

Key kernel providers:
  Microsoft-Windows-Kernel-Process (process/thread lifecycle)
  Microsoft-Windows-Kernel-File (file I/O)
  Microsoft-Windows-Kernel-Audit-API-Calls (security-sensitive APIs)

ThreatIntel ETW Provider

- Microsoft-Windows-Threat-Intelligence
- Available to PPL (Protected Process Light) and above
- Events: NtReadVirtualMemory, NtWriteVirtualMemory, NtMapViewOfSection on protected processes
- Used by EDR and anti-cheat for detecting memory access to protected processes
- Attackers target: patch EtwThreatIntProvRegHandle or EtwpEventWriteFull

Common ETW Bypass Patterns

- Patch EtwEventWrite in ntdll.dll (user-mode ETW silencing)
- Patch nt!EtwpEventWriteFull in kernel (kernel-mode ETW silencing)
- NtSetInformationThread(ThreadHideFromDebugger) — hides thread from ETW
- Remove provider registration by walking EtwRegistration list
- EPT-based protection can defend ETW structures from tampering

Kernel Segment Heap Architecture

Timeline

Windows NT ~ 1809   : Legacy NT Pool Manager (ExAllocatePoolWithTag)
Windows 10 19H1     : Kernel Segment Heap introduced (March 2019, build 1903)
                      └─ User-mode Segment Heap ported to the kernel
Windows 10 2004     : ExAllocatePool2 / ExAllocatePool3 added
                      └─ ExAllocatePoolWithTag officially deprecated
Windows 10 20H2~    : Dynamic KDP (Kernel Data Protection) stabilized
Windows 11          : VBS/HVCI enabled by default; Secure Pool usage expanded

Common misconception: Many sources claim "the Segment Heap was introduced
in Windows 10 2004," but the kernel segment heap was actually introduced
in 19H1 (1903). Windows 10 2004 added the new Pool APIs built on top of it.

Legacy NT Pool Structure (_POOL_HEADER, pre-19H1)

_POOL_HEADER (16 bytes, x64):
Offset  Field           Size   Description
0x00    PoolIndex        1 B    Pool descriptor index
0x01    PreviousSize     1 B    Previous chunk size
0x02    PoolType         1 B    Pool type (Paged, NonPaged, etc.)
0x03    BlockSize        1 B    Current chunk size (>> 4)
0x04    PoolTag          4 B    4-byte ASCII tag
0x08    ProcessBilled    8 B    KPROCESS pointer (valid only with PoolQuota)

Memory layout:
[POOL_HEADER 16B][user data ...][POOL_HEADER 16B][user data ...]
      ↑ plaintext, predictable        ↑ adjacent → overwritable

Security weaknesses:
- Pool Walking: traverse chunks linearly via BlockSize
- Pool Overflow: corrupt adjacent header for arbitrary write on free
- PoolIndex Overwrite: OOB dereference into pool descriptor array
- ProcessBilled Overwrit

---

*Content truncated.*

When not to use it

  • General application security auditing
  • Non-Windows environments
  • Tasks involving high-level framework security only

Prerequisites

Windows Kernel Debuggerdbghelp

Limitations

  • High risk of system instability during live analysis
  • Requires deep knowledge of OS internals

How it compares

It provides deep-dive debugging methodology specifically for the Windows kernel, rather than generic vulnerability scanning.

Compared to similar skills

windows-kernel-security side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
windows-kernel-security (this skill)72moNo flagsAdvanced
security-header-generator59moCautionIntermediate
backend-security-coder244moNo flagsIntermediate
api-security-best-practices156moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

reverse-engineering-tools

gmh5225

Guide for reverse engineering tools and techniques used in game security research. Use this skill when working with debuggers, disassemblers, memory analysis tools, binary analysis, or decompilers for game security research.

73204

game-hacking-techniques

gmh5225

Guide for game hacking techniques and cheat development. Use this skill when researching memory manipulation, code injection, ESP/aimbot development, overlay rendering, or game exploitation methodologies.

42128

game-engine-resources

gmh5225

Guide for game engine development resources including engine source code, plugins, and development guides. Use this skill when researching game engines (Unreal, Unity, Godot, custom engines), engine architecture, or game development frameworks.

1485

mobile-security

gmh5225

Guide for mobile game security on Android and iOS platforms. Use this skill when working with Android/iOS reverse engineering, mobile game hacking, APK analysis, root/jailbreak detection bypass, or mobile anti-cheat systems.

1469

anti-cheat-systems

gmh5225

Guide for understanding anti-cheat systems and bypass techniques. Use this skill when researching game protection systems (EAC, BattlEye, Vanguard), anti-cheat architecture, detection methods, or bypass strategies.

813

graphics-api-hooking

gmh5225

Guide for graphics API hooking and rendering techniques for DirectX, OpenGL, and Vulkan. Use this skill when working with graphics hooks, overlay rendering, shader manipulation, or game rendering pipeline analysis.

725

Search skills

Search the agent skills registry