What command and control is
The moment an exploit lands, the attacker has a problem: a shell in a terminal is fragile. Close the laptop, lose the connection, reboot the box, and the access is gone. Command and control (C2, or C&C) solves this. A small program — the implant or beacon — runs on the compromised host and reaches back out to a C2 server the attacker controls. The operator issues tasks through the server; the beacon picks them up, runs them, and returns the results.
The defining behavior is beaconing: rather than holding a constant connection (loud and obvious), the implant "phones home" on an interval — every few seconds, minutes, or hours — usually with randomized jitter so the pattern is harder to spot. Between check-ins it sleeps quietly. This is the rhythm that separates modern C2 from a raw reverse shell, and the rhythm that defenders learn to hunt for.
Metasploit is the on-ramp, not the destination
You already met Metasploit and Meterpreter. Meterpreter is a C2 channel — an in-memory implant with a rich command set, sessions, and pivoting. It is the perfect place to learn the concepts because it is free, well-documented, and forgiving.
It is also, in a real engagement against a defended network, the first thing to get caught. Stock Meterpreter and default Metasploit payloads are some of the most heavily signatured code in existence; every AV and EDR vendor has studied them for over a decade. Run a default payload against a modern endpoint and it is flagged, quarantined, and alerted on before you get a session. That single limitation is why a whole market of dedicated C2 frameworks exists — tools built from the ground up to survive on an endpoint that is actively watching.
The modern C2 landscape
Professional red teams and, increasingly, real intruders have moved toward frameworks designed for stealth and flexibility. You do not need to operate these to be a strong defender or tester — but you must recognize the names, because they dominate real intrusion reports.
| Framework | Type | What sets it apart |
|---|---|---|
| Cobalt Strike | Commercial | The long-time industry standard and still the most-observed C2 in real intrusions. Its "Beacon" implant and malleable C2 profiles set the template the others follow. Heavily pirated and abused by criminals. |
| Sliver | Open-source | BishopFox's cross-platform framework written in Go. mTLS, HTTP(S), DNS, and WireGuard channels; in-memory implants; multi-operator. The most common free Cobalt Strike alternative. |
| Havoc | Open-source | A modern, Cobalt-Strike-style framework with a polished UI, strong EDR-evasion features (reflective loading, sleep obfuscation), and a low barrier to entry. |
| Brute Ratel C4 | Commercial | Built specifically to defeat EDR. Its "Badger" agent is among the hardest implants to detect, with evasion tuned into every stage. Criminal abuse drove tighter vetting of its sales. |
| Mythic | Open-source | A modular platform with a web UI, multi-user support, and a microservice design that supports many agent types (Go, .NET, Python, and more). Favored for research and tailored operations. |
| Metasploit | Open-source | The learning standard and still excellent for known exploits — but its default C2 is the loudest and most-signatured of the group. |
The trend is clear: defenders got good at catching Cobalt Strike and Metasploit, so operators diversified toward modular, evasion-first tools — Sliver, Havoc, Brute Ratel, and Mythic — that offer encrypted multi-protocol channels, in-memory execution, and integration with cloud services. For a defender, the lesson is that "looking for Meterpreter" is nowhere near enough.
Redirectors: never expose the real server
A beacon that talks straight to the C2 server hands defenders a gift: block or seize that one IP and the whole operation collapses, and the server's address becomes an indicator that burns every host using it. So serious operators never let the beacon see the real server. They put redirectors in front — lightweight hops that forward only legitimate beacon traffic to the hidden C2 (the "team server") and silently drop everything else, including curious investigators and scanners.
- Redirectors — an nginx/Apache box or a cloud function that filters on headers, URIs, or user-agents and relays valid traffic onward. The implant only ever knows the redirector.
- Domain reputation — operators front their traffic with trusted, high-reputation domains and providers so it blends into normal web noise instead of standing out as a sketchy cloud IP.
- Resilience — multiple redirectors mean one getting blocked does not kill the channel; the team server can be rotated without re-touching every implant.
This is where one particular technique has become a favorite, because it delivers redirection, reputation, and resilience all at once — using infrastructure almost every network already trusts.
The Cloudflare Tunnel technique
Cloudflare's Tunnel service (the cloudflared daemon) and its serverless Workers were built for a legitimate purpose: letting a developer expose a service running on a private machine to the internet without opening a single inbound firewall port. Attackers realized the same machinery makes near-ideal C2 infrastructure. The chain looks like this:
→ Cloudflare Worker — serverless redirector; forwards only valid beacons (checked via custom CF-Access-* headers), drops the rest
→ Zero Trust application — gatekeeper that requires a service token so only the Worker can reach the tunnel
→ cloudflared tunnel — a daemon on the attacker's VM holding an outbound connection to Cloudflare; maps a public hostname to a local listener
→ internal C2 server (e.g. Sliver on 127.0.0.1:443)
Because cloudflared dials out to Cloudflare, the attacker's server needs no inbound ports open at all — nothing to find by scanning it. What the victim and any investigator see is ordinary HTTPS to Cloudflare's address space. The advantages stack up fast:
- Origin IP masking — the real C2 VM is never exposed; only Cloudflare's IPs appear on the wire, so the server cannot be directly scanned, blocked, or seized.
- Trusted HTTPS and reputation — traffic rides Cloudflare's encrypted, high-reputation infrastructure, blending into the enormous volume of legitimate Cloudflare-fronted traffic instead of standing out as a suspicious cloud host.
- Takedown resistance — the channel inherits Cloudflare's DDoS protection and resilience, and a blocked tunnel can be respun in minutes with no DNS changes.
- Fast, free entry — the throwaway trycloudflare.com service spins up an anonymous tunnel with no account, which is exactly why it shows up in real malware campaigns.
Detecting and defending against C2
If the traffic looks legitimate and the server cannot be scanned, how do defenders fight back? Not by chasing IPs — by hunting behavior:
- Beacon hunting — look for the rhythm: regular, low-volume callbacks to the same destination at a steady interval, even with jitter. Long-term traffic analysis surfaces the pattern a single packet never would.
- TLS fingerprinting — JA3/JARM fingerprints can flag implant TLS stacks that do not match the browsers and apps a host normally uses, even inside encrypted traffic.
- Egress control and inspection — restrict and monitor outbound traffic; unexpected use of cloudflared, or a server making tunnels it should not, is a strong signal. Many organizations alert on or block the cloudflared binary where it has no business running.
- Endpoint visibility — EDR that watches process behavior and in-memory activity catches implants that network controls miss, which is exactly the surface the evasion-first frameworks target.
The throughline of this phase: gaining access is one skill; keeping it quietly is another, and the cat-and-mouse of C2 versus detection is where much of modern offense and defense actually plays out. With a stable channel established, the next phase asks what you do with it — escalate, persist, pivot, and loot.