Bundled with Unleash skills pack. Upstream: local:C:\Users\Admin.claude\skills
Kernel development workflow
Activation
Use when the task involves kernel-mode driver development, kernel shellcode,
manual mapping, injection, rootkit techniques, or any ring-0 code.
Project scaffolding
Default stack: C with WDK (Windows Driver Kit). Use WDM for maximum control,
KMDF only when the task benefits from the framework.
<project>/
├── src/
│ ├── driver.c # DriverEntry, dispatch routines
│ ├── imports.c # Dynamic import resolution
│ ├── hooks.c # SSDT, IRP, callback hooks
│ ├── inject.c # APC / thread hijack / shellcode injection
│ ├── stealth.c # VAD spoofing, DKOM, PiDDBCache cleanup
│ └── util.c # Helpers: memory, strings, PE parsing
├── include/
│ ├── driver.h
│ ├── imports.h
│ ├── hooks.h
│ ├── inject.h
│ ├── stealth.h
│ └── util.h
├── <project>.vcxproj # VS project targeting WDK
└── README.md
Coding conventions
- Resolve all imports dynamically at runtime (no static IAT entries for
sensitive APIs). Walk
ntoskrnl.exe / hal.dll export tables or use
pattern scanning for unexported functions.
- Use
POOL_TAG constants that blend in (e.g., reuse tags from legitimate
drivers).
- Avoid
DbgPrint in release builds. Use a custom debug channel or compile
out entirely.
- Prefer
ExAllocatePool2 (Win10 2004+) with POOL_FLAG_NON_PAGED over
deprecated ExAllocatePoolWithTag.
- All IRQL-sensitive code must be annotated with
_IRQL_requires_max_().
- Clean up all hooks, allocations, and handles on
DriverUnload.
Key techniques reference
Dynamic import resolution
PVOID GetKernelExport(PCWSTR moduleName, PCSTR exportName);
PVOID PatternScan(PVOID base, SIZE_T size, PCSTR pattern, PCSTR mask);
APC injection (kernel-mode)
- Locate target thread via
PsLookupThreadByThreadId or thread list walk.
- Allocate RWX memory in target process (
MmAllocateContiguousMemory or
ZwAllocateVirtualMemory with attached process).
- Write shellcode / payload.
- Queue APC via
KeInsertQueueApc targeting KernelApcRoutine or
NormalRoutine depending on context.
- For user-mode APC: set
NormalRoutine to payload, NormalContext to arg.
Thread hijacking
- Suspend target thread (
PsSuspendThread).
- Get context (
PsGetContextThread).
- Save original RIP, set RIP to payload, set RCX to argument.
- Resume thread (
PsResumeThread).
- Payload must restore original RIP on completion (trampoline or ret-gadget).
VAD manipulation / spoofing
- Locate
EPROCESS->VadRoot (AVL tree).
- Find or create
MMVAD node for target region.
- Modify
VadFlags (Protection, PrivateMemory, NoChange) to spoof the
region as PAGE_READONLY / MEM_IMAGE / backed-by-file.
- Optionally unlink the node entirely for full invisibility.
Callback removal / unhooking
PsSetCreateProcessNotifyRoutine callbacks: walk
PspCreateProcessNotifyRoutine array, clear entries.
PsSetCreateThreadNotifyRoutine: same pattern for
PspCreateThreadNotifyRoutine.
PsSetLoadImageNotifyRoutine: PspLoadImageNotifyRoutine.
CmRegisterCallbackEx: walk CallbackListHead in CmpCallBackVector.
ObRegisterCallbacks: patch ObjectType->TypeInfo callback arrays.
- MiniFilter:
FltUnregisterFilter or unlink from FltGlobals.
DKOM (Direct Kernel Object Manipulation)
- Process hiding: unlink
EPROCESS from ActiveProcessLinks doubly-linked
list. Patch HandleTableList for handle-table invisibility.
- Token stealing: copy
TOKEN from SYSTEM process, replace target's
EPROCESS->Token.
- Thread hiding: unlink from
ETHREAD->ThreadListEntry.
SSDT hooking
- Locate
KeServiceDescriptorTable (pattern scan or MSR LSTAR for x64).
- Disable write protection (
CR0.WP or MSR EFER.NXE + remap).
- Replace target service pointer with hook.
- Restore write protection.
- On x64 with PatchGuard: use EPT-based hooks or inline hooks instead.
Build & test
- Build:
msbuild /p:Configuration=Release /p:Platform=x64
- Sign: test-sign with
makecert + signtool or use bcdedit /set testsigning on.
- Deploy:
sc create + sc start, or manual map via existing loader.
- Debug: WinDbg with kernel debugging enabled (
bcdedit /debug on).
Verification checklist
1---2name: kernel-dev-23description: Kernel-level development workflow for stealthy drivers, manual mappers, injectors, and rootkits. Covers WDM/KMDF drivers, shellcode, APC injection, thread hijacking, VAD manipulation, callback unhooking, and DKOM. Invoke with /kernel-dev or when the task involves kernel-mode code.4license: MIT5---67> Bundled with Unleash skills pack. Upstream: local:C:\Users\Admin\.claude\skills89# Kernel development workflow1011## Activation1213Use when the task involves kernel-mode driver development, kernel shellcode,14manual mapping, injection, rootkit techniques, or any ring-0 code.1516## Project scaffolding1718Default stack: C with WDK (Windows Driver Kit). Use WDM for maximum control,19KMDF only when the task benefits from the framework.2021```22<project>/23├── src/24│ ├── driver.c # DriverEntry, dispatch routines25│ ├── imports.c # Dynamic import resolution26│ ├── hooks.c # SSDT, IRP, callback hooks27│ ├── inject.c # APC / thread hijack / shellcode injection28│ ├── stealth.c # VAD spoofing, DKOM, PiDDBCache cleanup29│ └── util.c # Helpers: memory, strings, PE parsing30├── include/31│ ├── driver.h32│ ├── imports.h33│ ├── hooks.h34│ ├── inject.h35│ ├── stealth.h36│ └── util.h37├── <project>.vcxproj # VS project targeting WDK38└── README.md39```4041## Coding conventions4243- Resolve all imports dynamically at runtime (no static IAT entries for44 sensitive APIs). Walk `ntoskrnl.exe` / `hal.dll` export tables or use45 pattern scanning for unexported functions.46- Use `POOL_TAG` constants that blend in (e.g., reuse tags from legitimate47 drivers).48- Avoid `DbgPrint` in release builds. Use a custom debug channel or compile49 out entirely.50- Prefer `ExAllocatePool2` (Win10 2004+) with `POOL_FLAG_NON_PAGED` over51 deprecated `ExAllocatePoolWithTag`.52- All IRQL-sensitive code must be annotated with `_IRQL_requires_max_()`.53- Clean up all hooks, allocations, and handles on `DriverUnload`.5455## Key techniques reference5657### Dynamic import resolution5859```c60PVOID GetKernelExport(PCWSTR moduleName, PCSTR exportName);61PVOID PatternScan(PVOID base, SIZE_T size, PCSTR pattern, PCSTR mask);62```6364### APC injection (kernel-mode)65661. Locate target thread via `PsLookupThreadByThreadId` or thread list walk.672. Allocate RWX memory in target process (`MmAllocateContiguousMemory` or68 `ZwAllocateVirtualMemory` with attached process).693. Write shellcode / payload.704. Queue APC via `KeInsertQueueApc` targeting `KernelApcRoutine` or71 `NormalRoutine` depending on context.725. For user-mode APC: set `NormalRoutine` to payload, `NormalContext` to arg.7374### Thread hijacking75761. Suspend target thread (`PsSuspendThread`).772. Get context (`PsGetContextThread`).783. Save original RIP, set RIP to payload, set RCX to argument.794. Resume thread (`PsResumeThread`).805. Payload must restore original RIP on completion (trampoline or ret-gadget).8182### VAD manipulation / spoofing83841. Locate `EPROCESS->VadRoot` (AVL tree).852. Find or create `MMVAD` node for target region.863. Modify `VadFlags` (Protection, PrivateMemory, NoChange) to spoof the87 region as `PAGE_READONLY` / `MEM_IMAGE` / backed-by-file.884. Optionally unlink the node entirely for full invisibility.8990### Callback removal / unhooking9192- `PsSetCreateProcessNotifyRoutine` callbacks: walk93 `PspCreateProcessNotifyRoutine` array, clear entries.94- `PsSetCreateThreadNotifyRoutine`: same pattern for95 `PspCreateThreadNotifyRoutine`.96- `PsSetLoadImageNotifyRoutine`: `PspLoadImageNotifyRoutine`.97- `CmRegisterCallbackEx`: walk `CallbackListHead` in `CmpCallBackVector`.98- `ObRegisterCallbacks`: patch `ObjectType->TypeInfo` callback arrays.99- MiniFilter: `FltUnregisterFilter` or unlink from `FltGlobals`.100101### DKOM (Direct Kernel Object Manipulation)102103- Process hiding: unlink `EPROCESS` from `ActiveProcessLinks` doubly-linked104 list. Patch `HandleTableList` for handle-table invisibility.105- Token stealing: copy `TOKEN` from SYSTEM process, replace target's106 `EPROCESS->Token`.107- Thread hiding: unlink from `ETHREAD->ThreadListEntry`.108109### SSDT hooking1101111. Locate `KeServiceDescriptorTable` (pattern scan or `MSR LSTAR` for x64).1122. Disable write protection (`CR0.WP` or `MSR EFER.NXE` + remap).1133. Replace target service pointer with hook.1144. Restore write protection.1155. On x64 with PatchGuard: use EPT-based hooks or inline hooks instead.116117## Build & test118119- Build: `msbuild /p:Configuration=Release /p:Platform=x64`120- Sign: test-sign with `makecert` + `signtool` or use `bcdedit /set121 testsigning on`.122- Deploy: `sc create` + `sc start`, or manual map via existing loader.123- Debug: WinDbg with kernel debugging enabled (`bcdedit /debug on`).124125## Verification checklist126127- [ ] All imports resolved dynamically128- [ ] No static strings for sensitive paths/names (hash or encrypt)129- [ ] Pool allocations use blended tags130- [ ] IRQL constraints verified for all code paths131- [ ] DriverUnload cleans up all hooks, allocations, handles132- [ ] No DbgPrint in release configuration133- [ ] Compiles clean with `/W4 /WX`