☼
⌃
☰

Botnet

Table of Contents

A network of compromised hosts (bots) under centralised attacker control. Each bot is a legitimate device infected with malware that allows remote command execution. The controlling attacker is the bot herder; the infrastructure they use to issue commands is the Command and Control (C2) channel.

Related: Command and Control Server Command and Control Detection Malware Analysis Denial of Service Ransomware Persistence

Infection Vectors

Bots are recruited through standard malware delivery methods:

  • Drive-by download — visiting a compromised or malicious site
  • Phishing — malicious attachment or link in email
  • Exploit kits — automated exploitation of browser/plugin vulns
  • Worm propagation — self-spreading across the network
  • Supply chain compromise — malicious code in legitimate software

C2 Architectures

The command and control channel determines how resilient and detectable a botnet is.

Centralised (IRC / HTTP)

Classic architecture. All bots connect to a single C2 server. Simple but fragile — takedown or blocking of the C2 server disrupts the entire botnet.

TEXT
Bot → C2 server ← Bot herder
Bot →
Bot →

HTTP-based C2 blends with normal web traffic. IRC was the original C2 channel — now largely replaced due to easy detection.

Peer-to-Peer (P2P)

No central server — bots relay commands through each other. Much more resilient: no single point of failure. Takedown requires dismantling enough of the peer network.

TEXT
Bot ↔ Bot ↔ Bot ↔ Bot
 ↕               ↕
Bot herder (connects to any bot)

Seen in: Conficker, ZeroAccess, GameOver Zeus

Domain Generation Algorithm (DGA)

Bot and herder both run the same DGA — generating hundreds of potential C2 domain names per day from a shared seed (date, etc.). The herder registers just one; the bot tries them all until it finds one that resolves. Defeats domain blocklisting.

PYTHON
# Simplified DGA example
import hashlib
from datetime import date

def generate_domain(date_str, seed="botnet"):
    data = f"{date_str}{seed}".encode()
    h = hashlib.md5(data).hexdigest()
    return f"{h[:12]}.com"

today = date.today().strftime("%Y%m%d")
print(generate_domain(today))

Primary Uses

Activity Description
DDoS Flood target with traffic from thousands of bots — volumetric, protocol, or application layer
Spam / phishing Send millions of spam or credential-harvesting emails
Credential stuffing Distribute login attempts across many IPs to evade rate limiting
Cryptomining Use victim CPU/GPU cycles for cryptocurrency mining
Click fraud Generate fake ad clicks for financial gain
Ransomware distribution Deliver ransomware payloads to the botnet
Proxy / traffic relay Route attacker traffic through bots to obscure origin
Initial access broker Sell access to compromised machines

Detection Indicators

Network-level

TEXT
— Beaconing: regular outbound connections at fixed intervals to the same destination
— Unusual protocols or ports: IRC (6667), high-entropy DNS queries (DGA)
— High DNS query rate to non-existent domains (DGA enumeration)
— Outbound traffic to known-bad IPs/domains (threat intel feeds)
— Large outbound data transfers (exfiltration)
— SYN floods or UDP floods from internal hosts (DDoS participation)

Host-level

TEXT
— Unexpected persistence mechanisms (Run keys, scheduled tasks, services)
— New processes spawned by browser or document applications
— Process making network connections it shouldn't (Word.exe → outbound TCP)
— High CPU usage with no user activity (cryptomining)
— Lateral movement indicators (PsExec, WMI remote execution)

RITA / Zeek detection

TEXT
RITA analyses Zeek logs specifically for beaconing patterns:
— Long connections to the same external IP at regular intervals
— High beacon score = high confidence of C2 beaconing
See: Command and Control Detection note

Takedown Methods

Botnets are disrupted through a combination of:

  • Sinkholing — law enforcement or researchers register DGA domains before the herder and redirect bot traffic to a controlled server, cutting C2 communications
  • Domain/IP blocklisting — ISPs and DNS resolvers block known C2 infrastructure
  • Legal action — seizure of C2 servers and arrest of herders
  • Peer poisoning — for P2P botnets, injecting fake or unresponsive peers to degrade the network

Notable takedowns: Emotet (2021), GameOver Zeus (2014), Conficker (ongoing, partial), Trickbot (2020)

Tips

  • Beaconing detection is the most reliable network-level botnet indicator — look for periodic outbound connections with consistent timing using tools like RITA on Zeek logs
  • DGA-based C2 produces large numbers of NXDOMAIN (non-existent domain) responses — a high NXDOMAIN rate from a single host is a strong indicator
  • Modern botnets increasingly use legitimate cloud infrastructure (GitHub, Discord, Pastebin, Twitter/X) as C2 to blend into normal traffic — allowlisting these services blindly is insufficient
  • A bot that is sinkholed is still infected — sinkholing only cuts C2, it does not remove the malware from the host