Skip to content

Zibgame/AntiDebugger-Win64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ AntiDebugger-Win64

Lightweight and modular C/C++ library for debugger detection and active response on Windows.


🎯 Overview

AntiDebugger-Win64 is a focused Windows security utility that provides practical, low-level debugger detection mechanisms packaged as a reusable static library.

The project is designed to be:

  • 🧩 Composable: each detection technique is isolated and extendable
  • 🧠 Low-level oriented: direct interaction with Windows internals (PEB, TLS, threads)
  • βš™οΈ Production-friendly: minimal overhead, simple API, easy linking
  • βš”οΈ Active defense capable: can react by killing debuggers and notifying the user

Typical use cases:

  • πŸ”’ Protecting sensitive code paths
  • πŸ› οΈ Hardening binaries against casual debugging
  • πŸ“š Learning Windows internals and reverse engineering techniques

πŸš€ Integration (Recommended)

πŸ“¦ Minimal structure

/project
 β”œβ”€β”€ main.cpp
 β”œβ”€β”€ include/antidebug.h
 β”œβ”€β”€ build/libantidebug.a

βš™οΈ Compilation

g++ main.cpp -Iinclude -Lbuild -lantidebug -o app.exe

πŸ§ͺ Usage

#include "antidebug.h"
#include <iostream>

int main()
{
    if (!antidebug_init())
        return 1;

    if (antidebug_detected())
        antidebug_exit();

    std::cout << "Application running" << std::endl;
    return 0;
}

🧩 Public API

πŸ”§ Initialization

bool antidebug_init(void);

Initializes the system:

  • runs early detection
  • enables required privileges (SeDebugPrivilege)
  • starts monitoring thread

πŸ” Detection state

bool antidebug_detected(void);

Returns whether a debugger has been detected at runtime.


πŸ’€ Process termination

void antidebug_exit(void);

Immediately terminates the current process.


βš”οΈ Active response

int kill_debugger(void);

Attempts to terminate known debugger processes:

  • x64dbg
  • x32dbg
  • IDA (32/64)
  • OllyDbg

Requires sufficient privileges to succeed.


πŸ”« Low-level helpers

int kill_process_by_name(const std::string &target);
int kill_process_by_pid(DWORD pid);

Used internally to terminate processes.


πŸ”” Notification

void show_notification(std::string title, std::string info);

Displays a Windows notification when a debugger is detected.

⚠️ Note:

  • Uses legacy Shell_NotifyIcon API
  • Behavior may vary depending on Windows version

πŸ—οΈ Architecture

src/
 β”œβ”€β”€ core/
 β”‚    └── antidebug.cpp
 β”‚
 β”œβ”€β”€ checks/
 β”‚    β”œβ”€β”€ api.cpp
 β”‚    β”œβ”€β”€ peb.cpp
 β”‚    └── remote.cpp
 β”‚
 β”œβ”€β”€ process/
 β”‚    └── process.cpp
 β”‚
 β”œβ”€β”€ notification/
 β”‚    └── notification.cpp
 β”‚
 β”œβ”€β”€ runtime/
 β”‚    └── monitor.cpp
 β”‚
 β”œβ”€β”€ tls/
 β”‚    └── tls_callback.cpp
 β”‚
 └── examples/
      └── basic.cpp

include/
 └── antidebug.h

build/
 └── libantidebug.a

🧠 Detection & Response Strategy

The library implements a layered detection + reaction model:

⚑ Early stage (TLS callback)

  • Executed before main()
  • Detects debuggers attached at process startup
  • Sets detection flag (no heavy action here)

πŸ”Ž Init phase

  • PEB inspection (BeingDebugged, NtGlobalFlag)
  • WinAPI checks (IsDebuggerPresent)
  • Remote debugger detection

πŸ” Runtime monitoring

  • Background thread continuously checks environment
  • Non-deterministic timing

βš”οΈ Active response (NEW)

When a debugger is detected:

  1. Detection flag is set
  2. Privileges are elevated (SeDebugPrivilege)
  3. Known debugger processes are terminated
  4. Notification is displayed
  5. Application can terminate itself

⚠️ Limitations

  • Requires sufficient privileges to kill external processes
  • Some debuggers may resist termination
  • Windows notification system is not fully reliable
  • Not resistant to advanced anti-anti-debug techniques

⚠️ Disclaimer

This project is intended for:

  • defensive security
  • reverse engineering practice
  • low-level Windows experimentation

It does not guarantee protection against advanced analysis tools or skilled reverse engineers.

About

Lightweight C/C++ anti-debugging library for Windows πŸ›‘οΈ Detects debuggers, breakpoints, and anomalies in real time βš™οΈ Designed to increase reverse engineering cost, not prevent it πŸš€ Easy to integrate, minimal overhead, and built for low-level security research πŸ”

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors