Overview
The C2 Framework provides a layered evasion system designed to reduce the detectability of beacon traffic and avoid network monitoring, behavioral analysis, and signature-based detection systems. Evasion techniques work together across three dimensions:Temporal Evasion
Beacon timing randomization using jitter strategies
Traffic Obfuscation
Payload size randomization through padding
Header Polymorphism
HTTP header randomization and rotation
Evasion Architecture
All evasion features are controlled through a unified traffic profile system that allows operators to select pre-configured evasion levels or create custom profiles.Profile Selection Trade-offs: Higher evasion levels provide better stealth but increase bandwidth usage and may introduce timing delays. Select profiles based on your operational security requirements and network environment.
Evasion Components
1. Jitter Strategies
Control beacon timing randomization to avoid predictable check-in patterns.- Uniform Jitter: Flat random distribution within ±jitter_pct of base interval
- Gaussian Jitter: Bell-curve distribution for more natural timing variance
evasion/sleep_strat.py:8-33
2. Traffic Padding
Add random bytes to beacon payloads to obscure actual message sizes and defeat size-based fingerprinting.- Dynamic Padding: Random padding between min/max thresholds per request
- Length Prefix Protocol: 2-byte header encodes padding length for strip operation
- Cryptographic Randomness: Uses
os.urandom()for unpredictable pad bytes
evasion/padding_strat.py:8-40
3. Header Randomization
Rotate and randomize HTTP headers across four levels:| Level | User-Agent | Accept-Language | Accept-Encoding | Header Order |
|---|---|---|---|---|
| 0 | Fixed Chrome | Fixed en-US | Fixed gzip | Fixed |
| 1 | Rotated | Fixed en-US | Fixed gzip | Fixed |
| 2 | Rotated | Rotated | Fixed gzip | Fixed |
| 3 | Rotated | Rotated | Rotated | Shuffled |
evasion/header_randomizer.py:32-76
Traffic Profiles
The framework includes four pre-configured profiles:baseline - No Evasion
baseline - No Evasion
low - Light Evasion
low - Light Evasion
medium - Moderate Evasion (Default)
medium - Moderate Evasion (Default)
high - Aggressive Evasion
high - Aggressive Evasion
Loading Profiles
Profiles are loaded at beacon initialization fromevasion/profile_config.yaml:
transport/traffic_profile.py:72-110
Detection Avoidance
Each evasion technique targets specific detection methods:Timing Analysis
Threat: Predictable beacon intervals detected by NetFlow analysisMitigation: Jitter strategies break fixed timing patterns
Size Fingerprinting
Threat: Consistent payload sizes create detectable signaturesMitigation: Random padding obscures actual message lengths
Header Signatures
Threat: Static User-Agent or header combinations flagged by IDSMitigation: Header randomization mimics diverse legitimate traffic
Behavioral Analysis
Threat: ML-based detection identifies non-human traffic patternsMitigation: Gaussian jitter + header shuffling mimics organic browsing
Operational Security Guidelines
Recommended Profile Selection
-
Low-Risk Environments →
lowormediumprofile- Corporate networks with basic monitoring
- Bandwidth-sensitive operations
- Long-term persistence scenarios
-
High-Risk Environments →
highprofile- Government/military networks
- Financial institutions
- Environments with advanced EDR/NDR solutions
-
Testing/Development →
baselineprofile- Local testing
- Performance benchmarking
- Debugging beacon communication
Next Steps
Jitter Strategies
Deep dive into timing randomization algorithms
Traffic Padding
Learn payload padding implementation details
Header Randomization
Understand HTTP header polymorphism
Traffic Profiles
Configure custom evasion profiles