Lightweight and modular C/C++ library for debugger detection and active response on Windows.
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
/project
βββ main.cpp
βββ include/antidebug.h
βββ build/libantidebug.a
g++ main.cpp -Iinclude -Lbuild -lantidebug -o app.exe
#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;
}bool antidebug_init(void);Initializes the system:
- runs early detection
- enables required privileges (SeDebugPrivilege)
- starts monitoring thread
bool antidebug_detected(void);Returns whether a debugger has been detected at runtime.
void antidebug_exit(void);Immediately terminates the current process.
int kill_debugger(void);Attempts to terminate known debugger processes:
- x64dbg
- x32dbg
- IDA (32/64)
- OllyDbg
Requires sufficient privileges to succeed.
int kill_process_by_name(const std::string &target);
int kill_process_by_pid(DWORD pid);Used internally to terminate processes.
void show_notification(std::string title, std::string info);Displays a Windows notification when a debugger is detected.
- Uses legacy Shell_NotifyIcon API
- Behavior may vary depending on Windows version
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
The library implements a layered detection + reaction model:
- Executed before
main() - Detects debuggers attached at process startup
- Sets detection flag (no heavy action here)
- PEB inspection (BeingDebugged, NtGlobalFlag)
- WinAPI checks (
IsDebuggerPresent) - Remote debugger detection
- Background thread continuously checks environment
- Non-deterministic timing
When a debugger is detected:
- Detection flag is set
- Privileges are elevated (SeDebugPrivilege)
- Known debugger processes are terminated
- Notification is displayed
- Application can terminate itself
- 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
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.