KDU Kernel Driver Utility

repository·master·Indexed 25 days ago

https://github.com/hfiref0x/kdu

A kernel driver utility for exploring and manipulating the Windows kernel. KDU provides capabilities for bypassing Driver Signature Enforcement (DSE), hijacking protected processes (PPL), and loading drivers via vulnerable third-party providers. It includes a command-line interface to map drivers, dump virtual memory, and manage process protections on x64 Windows 7 through 11.

Tokens
3.8K
Snippets
1
Records
20
Agent score
82%

What's inside KDU

  1. Overview of KDU Kernel Driver Utility

    master

    KDU is a kernel driver utility designed to explore Windows kernel components without requiring a local debugger. It provides capabilities for protected process hijacking, bypassing Driver Signature Enforcement (DSE), and loading drivers via vulnerable third-party providers.

    System Requirements:

    • x64 Windows 7/8/8.1/10/11
    • Administrative privileges

    Warning: Using this tool may cause a Blue Screen of Death (BSOD). It is highly recommended to use KDU only within virtual machines.

  2. Select a KDU provider using the -prv command

    master
    KDU allows you to specify a specific driver provider to use for its operations. You can select a provider by its unique ID using the -prv command-line flag. If no -prv flag is specified, KDU defaults to the provider with Id 0 (Intel IQVM64/Nal).
  3. Build KDU from source

    master

    To build KDU from the provided source code, you require the following environment:

    • IDE: Microsoft Visual Studio 2019 or later.
    • Driver Development: Microsoft Windows Driver Kit (WDK) 10 or above.

    Deployment Note: When running the compiled binaries, kdu.exe and drv64.dll (the drivers database) must reside in the same directory and have read/write access enabled. All binaries MUST be unblocked from the system zone.

  4. Generate the AsIO2 unlocking resource with GenAsIo2Unlock

    master

    To enable support for the AsIO2 driver (provider #13) in KDU, you must generate the required 'unlocking' resource. This is done using the GenAsIo2Unlock utility.

    If you are building KDU from source, this utility is configured to run automatically as a post-build event for both Debug and Release configurations. If you are manually managing the build, ensure you do not remove this post-build event, otherwise the newly compiled KDU will not be able to use the AsIO2 driver.

  5. Run Taigei in Executable Mode

    master

    When running as an executable, Taigei can be configured to target specific devices by passing a numeric key as the first command-line argument. This is used to open a handle to a specific driver device and send that handle to the server via IpcSendHandleToServer.

    Available target device keys:

    • 0 (default): Targets \Device\KObjExp
    • 1: Targets \Device\KRegExp
  6. Use KDU CLI to manage kernel drivers and process protections

    master

    KDU (Kernel Driver Utility) is a command-line tool used to map drivers to the kernel, bypass Driver Signature Enforcement (DSE), and manipulate process protections (PPL, Mitigations, etc.).

    General Usage Pattern: kdu [Provider][Command]

    Common Commands:

    • -list: List available providers.
    • -listcsv [file]: List available providers in CSV format (optionally writes to [file]).
    • -diag: Run system diagnostics for troubleshooting.
    • -prv id: (Optional) Sets the provider ID to be used with subsequent commands (default is 0).
    • -map filename: Maps a driver to the kernel and executes its entry point.
    • -dse value: Writes a user-defined value to the system DSE state flags.
    • -ps pid: Disables ProtectedProcess for the specified PID.
    • -pm pid: Overwrites Process MitigationsFlags1 and 2 with 0x0 for the specified PID.
    • -pho pid: Opens a process handle to the PID with full access, patches it, and starts a child process (defaults to powershell.exe).
  7. Map a driver to the kernel using -map

    master

    To map a driver file to the kernel, use the -map command. Depending on the shellcode version used, additional parameters may be required.

    Command Syntax: kdu -map <filename> [options]

    Options:

    • -scv <version>: Select shellcode version (default is 1). Use version 3 for specific driver object/registry requirements.
    • -drvn <name>: (Only for shellcode version 3) Sets the Driver object name.
    • -drvr <name>: (Only for shellcode version 3) Sets the driver registry key name.

    Example (Shellcode V3):

    kdu -scv 3 -drvn MyName -map MyDriver.sys
    kdu -scv 3 -drvn MyName -map MyDriver.sys
  8. Use Taigei as a DLL for Cheat Engine Driver Unlocking

    master

    In 32-bit (x86) environments, Taigei can be used to unlock the Cheat Engine driver (\\.\CEDRIVER73). This is achieved by using the DllMainUnlockDBK entry point.

    When the DLL is attached to a process (DLL_PROCESS_ATTACH), it performs the following steps:

    1. Loads its own raw executable content from disk.
    2. Locates the .text section of the current process image.
    3. Overwrites the process's .text section with its own raw .text section.
    4. Opens a handle to \\.\CEDRIVER73.
    5. Sends the driver handle to the server via IpcSendHandleToServer.

    Note: This specific functionality is only compiled for 32-bit targets and uses the entry point DllMainUnlockDBK.

  9. Understand MSFT blacklist types

    master

    Microsoft (MSFT) uses several methods to blacklist drivers. These criteria are noted in the provider metadata:

    • Cert: The driver is banned based on the certificate used to sign it, allowing multiple files to be banned simultaneously.
    • Name: The driver is banned by its original filename entry stored in the VERSION_INFO file resources. This requires cross-checking file versions to avoid false positives on unaffected versions.
    • Hash / Page hash: The driver is banned by its Authenticode hash or page hash, allowing MSFT to target an exact driver file.
  10. Reference the KDU Provider Metadata Table

    master
    The KDU project maintains a detailed registry of supported kernel drivers (providers) that can be used for various low-level operations. This metadata includes unique identifiers, driver names, device names, associated CVEs, and cryptographic hashes (SHA1/SHA256) for verification. Developers can use this information to identify specific drivers, check compatibility with NT builds, and verify the integrity of driver files.