Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Menelaus29/c2-framework/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The C2 Framework is an experimental command and control system designed for academic research and cybersecurity analysis only. Built with Python, it demonstrates modern C2 architecture patterns while implementing multiple evasion techniques for traffic analysis research.Key Features
The framework provides a complete C2 infrastructure with focus on security research:Secure Communication
AES-256-GCM encryption with HKDF key derivation and replay protection via nonce validation
Traffic Evasion
Configurable jitter strategies, padding techniques, and HTTP header randomization
Session Management
Persistent sessions with SQLite storage, heartbeat monitoring, and graceful reconnection
Task Execution
Safe command execution with timeout controls, output capture, and blocklist enforcement
Architecture Components
The framework consists of four primary components:Server Component
- FastAPI-based HTTP server handling beacon endpoints
- Session manager tracking active agent connections
- Command queue managing task dispatch and results
- SQLite database for persistent storage and replay protection
Agent Component
- Beacon loop with exponential backoff retry logic
- Environment checks enforcing lab-only operation
- Command executor with safety controls and blocklists
- Jitter strategies (uniform and gaussian) for timing variation
Communication Protocol
The framework implements a custom binary protocol with authenticated encryption:Evasion Techniques
Multiple traffic evasion strategies support research into detection methods:- Jitter Strategies
- Padding
- Header Randomization
Uniform Jitter: Random intervals within ±N% of base beacon intervalGaussian Jitter: Normally distributed intervals with configurable standard deviation
Security Features
The framework implements multiple security controls for safe research operation:Environment Enforcement
- LAB_MODE environment variable required
- Whitelisted server hosts only
- VM detection logging
- Debugger detection warnings
Command Blocklist
Blocks privileged operations:
- Registry modifications (reg)
- Task scheduling (schtasks, at)
- Service control (sc)
- Network mapping (nmap, arp)
- Privilege enumeration (whoami /priv)
Replay Protection
- UUID-based nonces in every message
- Server-side nonce validation and storage
- 409 Conflict on replay attempts
Safe Execution
- subprocess.run with shell=False
- Configurable timeout enforcement
- Output size limits (64KB)
- Exit code capture
Message Flow
The typical communication flow between agent and server:All messages are encrypted, authenticated, include replay protection nonces, and may be padded for traffic analysis resistance.
Technology Stack
- Python 3.10+ - Core implementation language
- FastAPI - Async HTTP server framework
- SQLite - Persistent session and task storage
- Cryptography - AES-GCM encryption, HKDF key derivation
- Uvicorn - ASGI server with TLS support
- Requests - HTTP client with custom TLS adapter
- PyYAML - Traffic profile configuration
Getting Started
To begin working with the C2 Framework:Architecture
Understand the system design and component interaction
Research Disclaimer
Review usage restrictions and legal requirements
Setup Guide
Configure the lab environment and deploy components
Research Applications
This framework supports research in:- Traffic Analysis: Study encrypted C2 detection methods
- Behavioral Analysis: Examine jitter and timing patterns
- Protocol Design: Test authenticated encryption schemes
- Evasion Techniques: Evaluate header randomization effectiveness
- Telemetry Collection: Capture and analyze beacon traffic