HookChain Documentation

repository·main·Indexed 20 days ago

https://github.com/helviojunior/hookchain

A research-driven technique for bypassing EDR solutions using IAT hooking, dynamic SSN resolution, and indirect system calls to evade Ntdll.dll monitoring. Includes API references for InitApi(), HGetProcAddress2, and SetDebug, as well as CLI usage instructions.

Tokens
650
Snippets
3
Records
6
Agent score
20%

What's inside HookChain

  1. What is HookChain?

    main

    HookChain is a technique designed to bypass Endpoint Detection and Response (EDR) systems by redirecting the execution flow of Windows subsystems. It achieves evasion by combining three specific techniques to remain invisible to EDRs that primarily monitor Ntdll.dll.

    Core Components of the HookChain technique:

    1. IAT Hooking: Modifying the Import Address Table to intercept function calls.
    2. Dynamic SSN Resolution: Dynamically resolving System Service Numbers (SSNs).
    3. Indirect System Calls: Using indirect syscalls to execute system functions without triggering standard EDR hooks in Ntdll.dll.

    This approach allows for evasion without requiring modifications to the original source code of the applications or malware involved.

  2. Access HookChain White Papers and Research

    main

    Detailed technical documentation and research regarding the HookChain technique can be found in the official white papers and the arXiv publication.

    Available Resources:

    • English White Paper (v1.5): Available on GitHub.
    • English arXiv Paper: arXiv:2404.16856
    • Portuguese White Paper (v1.5): Available on GitHub.
  3. Resolve procedure addresses with HGetProcAddress2

    main

    HookChain provides HGetProcAddress2 to resolve the address of functions from specific modules. This is used to locate system APIs like MessageBoxW/MessageBoxA from User32.dll or TerminateThread from Kernel32.dll for use in shellcode.

    // Example: Resolving MessageBoxW from User32
    PVOID pfMessageBox = HGetProcAddress2("User32", "MessageBoxW");
  4. Run HookChain via CLI

    main

    The HookChain executable can be run via the command line. It accepts a Process ID (PID) as the first argument. If no argument is provided, the application will prompt the user to type the PID manually.

    Usage:

    # Provide PID as an argument
    ./HookChain <PID>
    
    # Or run without arguments to be prompted
    ./HookChain