Course contentsShow
← Security
Lesson 2223 of 3,05243. Offensive Security ToolingFree lesson

C2 Infrastructure Setup

Designing resilient command and control infrastructure with redirectors, domain fronting, and traffic obfuscation.

C2 Infrastructure Setup

What You'll Learn

You'll learn how to design resilient command and control (C2) infrastructure that stays hidden from defenders by using redirectors, domain fronting, and traffic obfuscation techniques.

Why Infrastructure Matters

Think of C2 infrastructure like a spy network: your operators (handlers) need to communicate with agents (compromised systems) without revealing the headquarters. Direct connections from victims to your C2 server are easily traced and blocked. Professional adversaries build layered infrastructure that makes detection and attribution extremely difficult.

Core Components

Redirectors

Redirectors are intermediate servers that forward traffic between victims and your actual C2 server. Like a mail forwarding service, they hide the real destination. If a redirector gets burned, you simply spin up another while your main server remains safe.

Common redirector types:

  • Apache/Nginx mod_rewrite rules - Filter and forward legitimate traffic
  • Cloud-based redirectors - Disposable instances on AWS, Azure, or DigitalOcean
  • CDN redirectors - Leverage content delivery networks for legitimacy

Domain Fronting

This technique makes C2 traffic appear to connect to legitimate services (like major CDNs or cloud providers) at the network level, while actually routing to your infrastructure. It's like addressing a letter to Amazon but including instructions inside for secret delivery elsewhere.

Traffic Obfuscation

Blend C2 communications into normal network traffic using:

  • HTTPS with valid certificates - Encrypt and legitimize traffic
  • Protocol mimicry - Make C2 look like DNS, HTTP, or other common protocols
  • Jitter and sleep timers - Randomize beacon intervals to avoid patterns

Best Practices

  • Never connect directly from your machine to C2 infrastructure
  • Use domain categorization services to age domains before operations
  • Implement layered redirectors (victim → redirector → redirector → C2)

Key Takeaway: Resilient C2 infrastructure uses multiple layers of indirection and obfuscation to protect your core server from detection, takedown, and attribution.