What is a command and control server?
When malware lands on a computer, it usually cannot do much on its own. It needs orders: which files to steal, which targets to attack, which new code to download. The command and control (C2) server is where those orders come from. Infected machines, often called bots or implants, contact it at intervals, ask for tasks, run them and report back. A group of machines answering to the same C2 is a botnet. For a server owner, the important point is the other side of the story: a compromised server can become one of those bots, sending spam, mining coins or attacking others while you pay for the hardware.
How does C2 traffic usually work?
Most implants call out rather than wait for incoming connections, because outbound traffic is rarely blocked. This regular call home is called beaconing. To blend in, modern C2 traffic often travels over HTTPS to ordinary-looking domains, over DNS queries with encoded data, or through popular web services. Some families use peer-to-peer designs with no single server to take down.
| Channel | What it looks like | Typical clue |
|---|---|---|
| HTTPS beacon | Small requests to one host at steady intervals | Clockwork timing, rare domain, odd TLS fingerprint |
| DNS tunneling | Many queries with long random subdomains | High query volume to one zone, TXT lookups |
| IRC or raw TCP | Long-lived connection to an unusual port | Connection from a process that should not network |
| Web service abuse | Posts to chat, paste or code hosting sites | A server process talking to services it never needs |
How does a server get recruited?
Usually through the basics: SSH with guessable passwords, an outdated web app with a known flaw, an exposed admin panel or database without authentication, or a leaked key. Automated scanners try these on every public IPv4 address all day, so a new machine is probed within minutes of going online. That is why the first hour on a new box matters: key-only SSH, updates and a default-deny firewall; see Harden SSH on Linux and iptables basics.
What are the signs that my server talks to a C2?
- Processes you do not recognize, often with names imitating system tasks, or running from
/tmp,/dev/shmor hidden folders. - Sustained CPU use with no matching workload, a classic sign of a coin miner.
- Outbound connections to unfamiliar addresses or ports: check with
ss -tnp state established. - New cron entries, systemd units or SSH keys you did not add.
- A sudden jump in outgoing traffic, visible in your interface counters and in the monthly traffic figure.
A quick look at what is listening and talking out:
ss -tunp | awk 'NR == 1 || $6 !~ /127\.0\.0\.1/' ls -la /proc/*/exe 2>/dev/null | grep -E 'deleted|/tmp/|/dev/shm' crontab -l -u www-data; ls /etc/cron.d /etc/systemd/system
The second line spots processes whose binary was deleted after start or that run from temporary folders, two common tricks.
How do I block C2 traffic?
Restrict outbound connections as well as inbound ones. Most servers only need to reach package mirrors, DNS, a few APIs and their backup target. An egress policy that allows those and logs the rest makes beaconing visible and often stops it. Running your own DNS resolver with query logging, or a filtering resolver, catches DNS-based C2. The host firewall concepts are the same as for inbound rules; iptables basics shows the syntax.
What should I do if a server is compromised?
Treat it as untrusted. Do not try to clean it in place: implants often leave several footholds. Copy logs and suspicious files off for analysis, rotate every credential that was on the box (SSH keys, database passwords, API tokens), reinstall the operating system from the panel, restore data from a backup taken before the intrusion, and fix the weakness that let the attacker in before going live again. A clean backup on a separate machine makes this a routine job; see Backup server. Our edge DDoS filtering protects your machine from floods, but it cannot know whether outbound traffic from your own box is legitimate, which is why host hygiene matters.
Is running a C2 server ever legitimate?
Security teams run C2 frameworks in authorized red-team exercises and penetration tests, against systems whose owners have agreed in writing. Outside such engagements, operating C2 infrastructure is abuse and breaks the fair use rules. The legitimate cousin is configuration management: tools like Ansible or Salt send commands to many servers you own, openly and with your keys.
Machines to Start Secure From Day One
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| E1 | Intel Xeon E3-1240 v3 | 4 / 8 | 16 GB DDR3 | 2x 240 GB SSD | 2x 1 Gbps | $30.52 | $91.56 (3 months) |
| E2 | Intel Xeon E3-1270 v3 | 4 / 8 | 32 GB DDR3 | 1x 480 GB SSD | 2x 1 Gbps | $38.32 | $114.96 (3 months) |
| S1 | Intel Xeon E-2276G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $53.32 | $53.32 (1 month) |
| S2 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $58.39 | $58.39 (1 month) |
Keep Reading
Harden SSH on Linux
A practical hardening list for sshd on a fresh dedicated box: keys, users, rate limits, firewall scope and an outside audit.
OpenSet up fail2ban
Install fail2ban, write a jail.local for SSH and nginx, read the ban list and unban an address you locked out by mistake.
OpenEdge DDoS filtering
How common volumetric attacks are filtered at the network edge before they reach your ports, and what you still handle on the box.
OpenBackup server
A machine whose job is to receive, keep and restore copies of other systems, and how to size one on budget bare metal.
OpenFAQ
Quick Answers
Command and control. It is the channel and the server attackers use to direct compromised machines.
Look for unknown processes, steady unexplained CPU use, odd outbound connections with ss, and new cron jobs, units or SSH keys.
It blends in with normal web traffic and is encrypted, so simple inspection cannot read the commands.
Reinstall. Rotate all credentials, restore data from a backup taken before the intrusion and close the hole that was used.
No. Edge filtering absorbs incoming floods. Outbound control traffic is stopped with egress rules and a clean, patched system.