Skip to main content
Be Bitwise

Windows Kernel Security

Kernel Security Mechanisms · Security Fundamentals track

5 min read

In this module

Windows Kernel Defence Architecture

Windows has built up a layered set of kernel defences aimed at rootkits, unsigned drivers, credential theft, and kernel exploitation. Where Linux leans on modular bolt-ons, Windows weaves security straight into the NT architecture and increasingly into hardware virtualisation.

Driver Signature Enforcement

Windows requires every kernel-mode driver to be digitally signed by a certificate Microsoft trusts. On 64-bit Windows (since Vista), the kernel flat-out refuses unsigned drivers. The straightforward path of "drop a malicious driver and gain kernel persistence" is closed.

How the signing chain hangs together: the developer signs their driver with a code-signing certificate from a Certificate Authority. For kernel-mode drivers, they also have to push the driver through Microsoft's Hardware Developer Center for additional signing — attestation signing, or WHQL certification. The Windows kernel verifies both signatures before letting the driver in.

BYOVD (Bring Your Own Vulnerable Driver) attacks step around all of this by loading a legitimately signed but buggy driver, then exploiting it to land kernel code execution. It's now a staple in advanced malware, and it makes the point that code signing keeps out unauthorised code, not vulnerable code.

PatchGuard / Kernel Patch Protection

PatchGuard — formally KPP, Kernel Patch Protection — guards the integrity of critical kernel data structures. It runs periodic audits across:

  • SSDT (System Service Descriptor Table): The table of pointers to system call handlers
  • IDT (Interrupt Descriptor Table): The table of interrupt handler addresses
  • GDT (Global Descriptor Table): Segment descriptors used by the CPU
  • Key kernel functions: Critical routines like KiSystemCall64 and other dispatch functions
  • Processor MSRs: Model-specific registers like LSTAR (which holds the system call entry point)

Catch a modification and PatchGuard fires a CRITICAL_STRUCTURE_CORRUPTION bugcheck — yes, the Blue Screen of Death. The box would rather crash than keep running in a compromised state.

text
PatchGuard monitoring loop (simplified concept):
1. At random intervals (making timing-based evasion difficult):
2. Check hash of SSDT against known-good value
3. Check IDT entries against expected handler addresses
4. Check GDT descriptors
5. Check kernel function prologues
6. If any mismatch: BSOD with 0x109 (CRITICAL_STRUCTURE_CORRUPTION)
PatchGuard Evasion

PatchGuard isn't bulletproof. Researchers and malware authors have repeatedly found ways to fingerprint and silence PatchGuard's monitoring threads before they catch a modification. Each trick gets patched out in a later Windows update, and the cycle starts again. PatchGuard's real win is raising the floor — the era of "just hook the SSDT" rootkits is over.

Credential Guard

Credential Guard uses Virtualisation Based Security (VBS) to wall off credential secrets — NTLM hashes, Kerberos tickets — in a secure virtual container that lives alongside the OS kernel but answers to the hypervisor.

On classic Windows, the LSASS (Local Security Authority Subsystem Service) process kept credential hashes in plain process memory. Mimikatz reads LSASS memory and extracts the hashes, which is how pass-the-hash attacks ate Active Directory environments for breakfast for the better part of a decade.

Credential Guard hoists credential storage into a separate, hypervisor-protected Virtual Trust Level (VTL 1). The Windows kernel and LSASS still run in VTL 0, which can't reach into VTL 1 memory. Even an attacker who lands kernel privileges in VTL 0 can't read the hashes one trust level over.

With Credential Guard on, the secrets move into an isolated LSA process, LsaIso.exe, which runs in VTL 1. Trace the attacker's arrow in the diagram: it still reaches LSASS, but LSASS now only holds encrypted blobs and has to ask VTL 1 to use the real secrets on its behalf.

Virtualisation Based Security (VBS)

VBS is the substrate underneath several Windows security features. It uses the Hyper-V hypervisor to spin up isolated trust levels — even on a box that isn't running any actual virtual machines.

VBS sets up at least two Virtual Trust Levels:

  • VTL 0: the normal Windows kernel and all applications
  • VTL 1: the Secure Kernel, hosting security-critical services

The hypervisor polices memory between them. VTL 1 can read VTL 0 memory; VTL 0 cannot reach into VTL 1. The result is a defence-in-depth layer where even a fully compromised Windows kernel can't tamper with services living in VTL 1.

HVCI: Hypervisor-Protected Code Integrity

HVCI sits on top of VBS and enforces code integrity for kernel-mode code. The hypervisor decides which kernel pages get to be executable:

  • Before any kernel page goes executable, the hypervisor verifies the code on that page is signed
  • The kernel (down in VTL 0) cannot mark a page both writable and executable — W^X is enforced at the VTL level
  • Even with kernel code execution in hand, an attacker can't allocate executable memory for their shellcode or rewrite existing kernel code

That recalibrates the exploitation game. Classic kernel exploits that allocate RWX memory and drop shellcode into it die immediately under HVCI. The remaining options are data-only attacks (corrupt structures, never execute new code) or hunting for an HVCI bypass.

The Layered Defence Model

Windows kernel security stacks like this:

  1. Driver Signature Enforcement: keeps unsigned kernel code from loading
  2. PatchGuard: detects runtime modification of kernel structures
  3. VBS/HVCI: hypervisor-enforced code integrity blocks kernel code injection
  4. Credential Guard: hypervisor-isolated credential storage blocks hash theft
  5. Secure Boot: verifies the boot chain from firmware up to the kernel

Each layer absorbs a different threat. An attacker who bypasses driver signing via BYOVD still has to deal with PatchGuard. An attacker who bypasses PatchGuard still has HVCI ahead. Even kernel execution despite HVCI doesn't open the door to Credential Guard sitting in VTL 1.

Hardware Requirements

VBS and the features that depend on it (HVCI, Credential Guard) need hardware virtualisation (Intel VT-x or AMD-V), SLAT (Second Level Address Translation), and UEFI Secure Boot. Windows 11 demands all of that by default, so VBS-backed security is everywhere on modern hardware. Older boxes that lack these features can't run the strongest kernel defences.