A rootkit hides by redirecting a table the OS trusts — an import table, an interrupt vector, the syscall dispatcher. This lab doesn't build that. It teaches the invariant a defender checks: every entry in those tables should point into known, signed code — and a hook is a pointer that no longer does.
Each of these is a table of pointers the OS follows to reach code. Legitimately, every pointer lands in a specific, known place. A hook swaps one pointer for its own — so the shape of the table is what gives it away.
ntoskrnl's code range.The defender's move is the same for all four: know where each pointer should land, then check that it still does.
# resolved, not raw — KASLR moves addresses NtCreateFile → ntoskrnl.exe + .text ok IDT[0x2e] → ntoskrnl.exe + .text ok NtEnumerateKey → 0x???? (no owning module) critical IDT[0x1f] → unknown.sys (not core) investigate
An illustrative table of handlers (sample data — on a real host this comes from idtscan). Run the scan: each entry is resolved to its owning module and classified. Watch which ones a defender would chase.
Your read-only IDT/GDT scanner already does the IDT/GDT half: it reads the real table, resolves each gate, and flags a handler outside kernel text, inside a module, a wrong code segment, or a ring-3 gate that shouldn't exist.
sudo python3 idtscan/linux/idtscan_linux.py --out scan.jsonl python3 idtscan/probe_1f.py scan.jsonl --baseline known-good.jsonl # exit 3 = high/critical · 1 = gap · 0 = clean
IDTR at a shadow table isn't caught by reading the real one — a known gap, recorded as such.lockdown=confidentiality blocks /proc/kcore — that's a scan gap, never a "clean" pass.A confirmed finding becomes a Vertical case: preserve the scan line, resolve the module, record the verdict with its basis. Same discipline as Lab 1 — detect, record, don't auto-convict.
EDR and anti-virus legitimately hook — that's the noise you tune against. The skill isn't spotting a hook; it's telling a security product's hook from an unknown module's, and an unknown module's from a handler that belongs to no module at all. The last one is the one that matters, and it's the one a defender can state with confidence.
Next: Lab 3 — cross-view detection (catching what a rootkit hides by comparing a high-level list against a low-level one), built on the detection lab.