Medusa AntiCheat is a proof-of-concept anti-cheat system built for learning Windows kernel development and experimenting with advanced process monitoring and injection detection techniques.
The system consists of four main components:
- ObCallbacks: Monitor handle operations and object access
- Notify Routines: Track process/thread creation and image loading
- Minifilter: File system operation monitoring
- Communication Port: Bi-directional IPC with userland via
\MedusaComPort - Unified Event Structure: Uses
ACEventstruct for all kernel-to-userland communication
- Event Processing: Receives and processes kernel events in real-time
- DLL Injection: Automatically injects monitoring DLL into new processes
- WebSocket Client: Streams events to backend for analysis and storage
- Process Scoring: Evaluates suspicious behavior patterns
- Event Translation: Converts kernel events to unified format for backend
- API Hooking: Uses MinHook to intercept critical Windows APIs
- IPC Communication: Reports hooked function calls back to userland agent
- Injection Detection: Monitors
CreateRemoteThreadExand other injection APIs - Unified Reporting: Uses same
ACEventstructure as kernel components
- WebSocket Server: Real-time event ingestion from userland agents
- Event Processing: Handles binary
ACEventstructures via WebSocket - Detection Engine: Multiple specialized detectors for different attack patterns
- Real-time Analysis: Processes events as they arrive for immediate threat detection
- Process Creation/Termination: Track all process lifecycle events
- Thread Creation: Monitor thread creation across all processes
- Handle Operations: Detect suspicious handle access patterns
- Image Loading: Monitor DLL/module loads via LoadImage notifications
- File System Activity: Track file operations through minifilter
- CreateRemoteThreadEx: Detect DLL injection attempts
- LoadLibraryW: Monitor dynamic library loading
- Process Memory Operations: Track
VirtualAllocEx,WriteProcessMemory
- Real-time Event Stream: WebSocket connection to backend (
MedusaBackend) - Image Load Detection: Specialized detector for monitoring protected processes
- Event Enrichment: Add process metadata and context to events
- Initialization: Userland agent takes target PID and DLL path as arguments
- Driver Communication: Connects to kernel driver via minifilter port
\MedusaComPort - Process Injection: Automatically injects monitoring DLL into all new processes
- Event Collection: Kernel driver sends events (process, thread, handle, file operations)
- API Monitoring: Injected DLL hooks critical APIs and reports calls via IPC
- Backend Streaming: All events forwarded to WebSocket backend for analysis
- Real-time Detection: Events processed and suspicious patterns flagged
All components now use a unified ACEvent structure for consistent event reporting:
typedef struct _ACEvent {
enum EventSource src; // KM (Kernel), UM (Userland), DLL
wchar_t EventType[260]; // Event type (e.g., "CreateProcess")
int CallerPID; // Process ID of event caller
int TargetPID; // Target process ID
int ThreadID; // Thread ID involved
int ImageFileName[260]; // Process/image file name
wchar_t CommandLine[1024]; // Command line arguments
int IsCreate; // Creation (1) or termination (0)
PVOID ImageBase; // Base address of loaded image
ULONG ImageSize; // Size of loaded image
} ACEvent;KM: Events originating from kernel driverUM: Events from userland agentDLL: Events from injected monitoring DLL
PROC_TAG: Process creation/termination eventsTHREAD_TAG: Thread creation eventsOB_TAG: Object handle operation eventsFLT_TAG: File system minifilter eventsLOADIMG_TAG: Image/DLL load events
cd MedusaBackend
go run Main.go WSServer.go Event.go
# Backend listens on :8080 for WebSocket connections# Compile and load kernel driver
# Run userland agent with target PID, WebSocket URL, and DLL path
./MedusaUserlandAgent.exe <target_pid> <websocket_url> <dll_path>
# Example:
./MedusaUserlandAgent.exe 1234 ws://localhost:8080/ ./MedusaUserDLL.dllThe backend will receive and process events in real-time, displaying them in JSON format while running detection algorithms.
This project is not production-ready. A real anti-cheat would also need:
- Obfuscation and encryption
- Secure backend persistence
- Hardened communication
These are skipped here since the focus is on prototyping and experimenting with kernel ↔ userland interaction.
Anti-cheat development combines kernel security, Windows internals, and attack surface analysis.
This project is my playground to explore these concepts while building something functional.
