How does a device become part of a botnet?
Through the same doors used for any intrusion, applied at enormous scale. Scanners try default passwords on routers and cameras, guess weak SSH and database passwords, and fire exploits for freshly published vulnerabilities at every reachable address. Infected attachments and cracked software recruit desktops. Once in, the bot installs itself to survive reboots, often kills competing malware, and phones home for instructions. Servers are attractive recruits because they have fast links and run around the clock; one compromised box with a 2x 10 Gbps uplink is worth thousands of home routers to an attacker.
How are botnets controlled?
| Model | How bots get orders | Weakness for the operator |
|---|---|---|
| Central server | Bots poll one or a few command servers over HTTP, IRC or a custom protocol | Taking down the servers cuts off the herd |
| Domain generation | Bots compute a daily list of domains and try them until one answers | Defenders who crack the algorithm can register domains first |
| Peer to peer | Bots pass orders among themselves | Harder to build and to keep consistent |
| Hidden services and legitimate platforms | Orders posted where traffic blends in | Platforms can remove accounts once spotted |
Command and control server looks at the server side of this arrangement in more detail.
What do botnets do?
- DDoS attacks: thousands of sources flood a target at once, which is why networks filter at the edge rather than on each machine.
- Spam and phishing: mail sent from many residential and server addresses to dodge blocklists.
- Credential stuffing: leaked username and password pairs tried against login pages from many addresses.
- Cryptocurrency mining: CPU time stolen to mine coins, a common payload on hijacked servers.
- Proxying: infected machines resold as residential or server proxies for other criminals.
- Click and ad fraud: fake visits and clicks that look like real users.
What signs suggest a server has been recruited?
- CPU pinned at full load by a process with a random or system-looking name such as
kworkerdsor[kthreadd]in an odd location. - Outbound connections to many addresses on ports like 22, 23 or 6379, which means your box is scanning others.
- New cron entries, systemd units or
authorized_keyslines you did not add. - Outgoing traffic climbing toward the monthly allowance with no matching growth in visitors.
- Abuse complaints about attacks or spam coming from your address.
ps -eo pid,user,pcpu,comm,args --sort=-pcpu | head -12 ss -tnp state established '( dport = :22 or dport = :23 or dport = :6379 )' | head ls -la /proc/*/exe 2>/dev/null | grep -E '\(deleted\)|/tmp/|/dev/shm/' | head crontab -l; ls /etc/cron.d /var/spool/cron/crontabs 2>/dev/null; systemctl list-units --type=service --state=running | tail -n +2 | head -40
Programs running from /tmp or /dev/shm, or from a binary that was deleted after launch, are classic bot traits.
Why do botnets love exposed databases and caches?
Because breaking in requires no exploit at all. A Redis instance listening on the public address without a password lets anyone write a cron file or an SSH key to disk through its own commands. An unauthenticated Docker API lets anyone start a privileged container that mounts the host file system. Scanners test for both within minutes of a port opening, and the resulting infections are among the most common on rented servers worldwide. A single line, bind 127.0.0.1 in the Redis config, or leaving the Docker socket local, closes the door.
What should I do if my machine is part of a botnet?
Treat it as a full compromise. Block outbound traffic except your own SSH session while you collect evidence, note the entry point if you can find it, then reinstall from the panel and restore data from a backup taken before the infection. Rotate every password and key that existed on the box. Removing one visible process is rarely enough, since bots typically install several persistence methods and sometimes a Rootkit.
How do I keep a server out of botnets?
- Disable SSH password logins and use keys; see Set up passwordless SSH.
- Never expose Redis, MongoDB, Elasticsearch, Docker's API or database ports to the internet without authentication; bind them to localhost.
- Patch web apps, plugins and panels quickly, since bots weaponize new exploits within days.
- Run fail2ban or similar rate limiting on login services, covered in Set up fail2ban.
- Watch outbound traffic, not only inbound; a sudden rise is often the first clue.
How does the network protect machines from botnet floods?
Large DDoS attacks from botnets are filtered at our network edge before they reach a machine, described on Edge DDoS filtering. Application-level floods, such as login attempts spread over thousands of addresses, still reach your services, so rate limits and a Web Application Firewall remain your job. Single-tenant hardware like the S2 keeps that control fully in your hands.
Machines You Can Lock Down End to End
| 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) |
| S2 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $58.39 | $58.39 (1 month) |
| S6 | Intel Xeon E-2288G | 8 / 16 | 64 GB DDR4 | 2x 1 TB NVMe | 2x 10 Gbps | $89.92 | $89.92 (1 month) |
Keep Reading
Command and control server
The server attackers use to steer infected machines, how C2 traffic looks on the wire, and how to keep your own box from joining in.
OpenMalware
Software written to harm, spy on or take over systems: the main families, how each reaches a Linux server and what keeps it out.
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.
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.
OpenFAQ
Quick Answers
A network of hijacked devices running hidden software that lets one operator command them, typically for attacks, spam or mining.
Mostly through weak SSH passwords, unprotected databases and unpatched web applications found by automated scanners.
Look for unexplained CPU use, outbound scanning, unknown cron jobs or services, and processes running from temporary directories.
Rarely. Bots install several ways to come back. Reinstall from a clean image and restore data from a backup made before the infection.
Large floods are filtered at the network edge. Application-level abuse such as login attempts still needs limits on the machine.