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.zipInstalls 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.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
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-relatedCheat > Driver Signature enforcementCheat > Windows Kernel ExplorerCheat > EFI Driver(cross-reference with game-hacking skill)Cheat > Vulnerable DriverAnti Cheat > Detection:AttachAnti Cheat > Detection:HideAnti Cheat > Detection:Vulnerable DriverAnti Cheat > Detection:Spoof StackAnti Cheat > Windows Ring3 CallbackAnti Cheat > Windows Ring0 CallbackAnti Cheat > Information System & ForensicsSome Tricks > Windows Ring0Windows 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
- Load vulnerable signed driver
- Trigger vulnerability
- Achieve kernel read/write
- Disable DSE or load unsigned driver
- 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
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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| windows-kernel-security (this skill) | 7 | 2mo | No flags | Advanced |
| security-header-generator | 5 | 9mo | Caution | Intermediate |
| backend-security-coder | 24 | 4mo | No flags | Intermediate |
| api-security-best-practices | 15 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by gmh5225
View all by gmh5225 →You might also like
security-header-generator
Dexploarer
Generates security HTTP headers (CSP, HSTS, CORS, etc.) for web applications to prevent common attacks. Use when user asks to "add security headers", "setup CSP", "configure CORS", "secure headers", or "HSTS setup".
backend-security-coder
sickn33
Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.
api-security-best-practices
davila7
Implement secure API design patterns including authentication, authorization, input validation, rate limiting, and protection against common API vulnerabilities
springboot-security
affaan-m
Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.
django-security
affaan-m
Django security best practices, authentication, authorization, CSRF protection, SQL injection prevention, XSS prevention, and secure deployment configurations.
xss-testing
Ed1s0nZ
XSS跨站脚本攻击测试的专业技能