agentleFS
buzzer-rebuzzer-re/Rikugan/skills/driver-analysis/SKILL.md

driver-analysis

Skill715 starsChanged 5 days agoMITView on GitHub

Windows kernel driver analysis — DriverEntry, dispatch table, IOCTL handlers, vulnerability audit

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use decompile_function on the entry point

    line 11
  2. Very specific:

    Use create_struct and set_type early — these appear in virtually every driver:

    line 20
  3. Distinctive:

    Check for dangerous patterns:

    line 36
  4. Distinctive:

    Missing ProbeForRead/ProbeForWrite: before kernel-mode buffer copy

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Task: Windows Kernel Driver Analysis. You are analyzing a kernel-mode driver binary.

Mandatory First Steps

  1. Find DriverEntry — usually the binary entry point
    • Signature: NTSTATUS DriverEntry(DRIVER_OBJECT*, UNICODE_STRING*)
    • Use decompile_function on the entry point
  2. From DriverEntry, extract:
    • MajorFunction dispatch table assignments
    • DriverUnload pointer
    • DeviceName and SymbolicLinkName
  3. Identify IOCTL handlers — look for IRP_MJ_DEVICE_CONTROL dispatch entry

Key Data Structures

Use create_struct and set_type early — these appear in virtually every driver:

  • DRIVER_OBJECT, DEVICE_OBJECT
  • IRP, IO_STACK_LOCATION
  • UNICODE_STRING

Apply types with set_function_prototype and apply_type_to_variable to make decompiled code readable immediately.

IOCTL Analysis

For each IRP_MJ_DEVICE_CONTROL handler:

  1. decompile_function on the dispatch function
  2. Find the switch statement on IoControlCode
  3. For each IOCTL code, document:
    • IOCTL value and decoded method/access
    • Expected input/output buffer sizes
    • Operation performed
  4. Check for dangerous patterns:
    • Kernel memory read/write gadgets
    • Process token manipulation
    • Arbitrary code execution paths

Common Vulnerabilities to Flag

  • KeSetEvent with user-controlled address — kernel write primitive
  • Missing ProbeForRead/ProbeForWrite before kernel-mode buffer copy
  • Unchecked buffer sizes in METHOD_NEITHER IOCTLs — pool overflow
  • MmMapIoSpace with user-supplied physical address — arbitrary physical memory access
  • Direct stack buffer reads without size validation — kernel stack overflow
  • ObReferenceObjectByHandle without proper access checks

Analysis Workflow

  1. Map the dispatch table → understand all supported IRPs
  2. Deep-dive each IOCTL handler → document input/output
  3. Trace data flow from usermode input to kernel operations
  4. Flag every path where user-controlled data reaches a sensitive kernel API
  5. Rename functions as you understand them: DispatchDeviceControl, HandleIoctlReadPhysMem, etc.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.