Please enable JavaScript to use CodeHS

Cybersecurity Basics

What Is a Botnet?

Somewhere in your house, there might be a device quietly taking orders from a stranger — and working perfectly fine otherwise, so nobody notices. Multiply that by hundreds of thousands of homes, and you've got a botnet: a hidden army of everyday devices, all controlled by one attacker at once.

Security ~10 min Beginner friendly
The Big Idea

What is a botnet?

Think about every internet-connected thing in a typical house: a laptop, a phone, a Wi-Fi router, maybe a smart TV, a video doorbell, or a security camera. Almost none of those devices ever get a second look once they're set up. They just sit there, quietly working.

That's exactly what makes a botnet possible. A botnet is a large group of everyday internet-connected devices — computers, but also routers, security cameras, smart TVs, even smart fridges — that have secretly been infected with malware (software designed to do something harmful) and can all be controlled remotely by one attacker. The real owners usually have no idea anything is wrong, because the device still works normally the whole time.

The vocabulary, in one place: each infected device is called a bot (or a "zombie," since it obeys commands without its owner knowing). The whole group of bots under one attacker's control is the botnet. The system the attacker uses to send orders to every bot at once is called a command-and-control server, or C2 for short. One message from the C2 server can instantly become an instruction followed by every single bot in the botnet — ten, ten thousand, or ten million of them.

That last part is what makes botnets so powerful. An attacker doesn't have to convince ten thousand people to do something bad. They just have to infect ten thousand devices once, and after that, one click sends every one of them the exact same order at the exact same time.


How It Works

How a device becomes a "bot"

Getting turned into a bot usually happens in two separate steps: infection, then check-in.

Step 1: infection

A device gets infected with botnet malware the same way devices get infected with any other malware — by clicking a malicious link or attachment, through an unpatched security hole the software's maker never fixed, or, especially for smart home gadgets like cameras and routers, because the device was never given a real password in the first place (it shipped with a default password like "admin" that the owner never bothered to change). This tutorial doesn't re-explain malware infection in depth — What Is Malware? and Virus vs. Worm vs. Trojan already cover exactly how that happens.

Step 2: check-in

Once the malware is running, it doesn't usually do anything dramatic right away. Instead, it quietly reaches out to the attacker's command-and-control server — sometimes just once a day, sometimes constantly — to say "I'm here, and I'm ready." Then it waits. The device might sit in this waiting state for weeks or months, doing nothing unusual and drawing no attention, until the attacker finally decides to use it.

Why IoT devices are such easy targets: "IoT" stands for Internet of Things — ordinary objects like cameras, thermostats, and routers that connect to the internet. Most people update their phone and laptop regularly but never think to update a router's software or change a camera's default password, sometimes for years. That makes IoT devices some of the easiest targets for building a botnet.


Interactive

Botnet control room

Below is a simplified map of 28 ordinary devices — laptops, cameras, routers, smart TVs — all currently idle and disconnected from each other. Click Spread malware to watch an attacker infect them one by one, turning each into a bot wired up to a central command-and-control (C2) server. Once enough are infected, try issuing a command and see it reach every bot at once.

Control room — attacker's view IDLE
Devices infected 0 / 28
Commands issued 0
C2 SERVER
Idle, uninfected device Infected bot Command-and-control server

28 ordinary devices, all idle. None of them are infected yet.

Notice that issuing a command didn't need each device to be convinced individually — one instruction from the C2 server, and every bot obeyed it at once. That's the entire point of building a botnet in the first place: total, instant control over a huge number of devices the attacker doesn't own.


Why It Matters

What attackers actually use botnets for

A botnet is a tool, and like a lot of tools, it can be pointed at more than one job. Here are four of the most common:

DDoS attacks

The attacker orders every bot to send traffic at the same website or server at the same moment, overwhelming it so real visitors can't get through.

Spam and phishing at scale

Instead of sending millions of spam or phishing emails from one suspicious address that gets blocked immediately, the attacker sends them from thousands of "clean-looking" home internet addresses at once — each bot sending just a few, so none of them look unusual on their own.

Cryptomining

Mining cryptocurrency takes huge amounts of computing power and electricity. Instead of paying for that themselves, an attacker can secretly run mining software on thousands of victims' devices, using their processing power and running up their electric bills, while the attacker collects the cryptocurrency.

Credential stuffing

When one website's passwords leak in a data breach, attackers try those same username/password pairs on other websites, betting people reused them. Doing that from one computer gets noticed and blocked fast. Spreading the attempts across thousands of bots and IP addresses makes it look like ordinary traffic from all over the world instead of one attacker hammering the login page.


Fighting Back

Why botnets are hard to take down

You might think shutting down a botnet is as simple as arresting whoever owns it. But the "owners" of the individual devices are just ordinary people — the family whose smart camera got hijacked has no idea it's part of an attack, and arresting them would make no sense at all. The only person actually responsible is the attacker controlling the C2 server, and finding them is a lot harder.

No single guilty owner

Every device belongs to an innocent person who didn't know their gadget was infected. Shutting off their device doesn't punish anyone responsible — it just removes one bot out of thousands.

Spread across countries

Bots are usually scattered across dozens of countries, each with its own laws and law enforcement. Coordinating a takedown across that many jurisdictions takes time attackers count on.

Reinfection

Even if a device gets cleaned up, if the vulnerability that let the malware in never gets patched, the same device can simply get reinfected later.

The scale is real: some of the largest botnets ever discovered have included millions of devices — and a huge share of them were exactly the kind of ordinary home routers, cameras, and IoT gadgets described in this tutorial, not specialized attacker equipment.


Protect Yourself

How to avoid becoming part of one

Most of what keeps a device out of a botnet is the same basic hygiene that protects against malware in general:

  • Keep software and firmware updated — updates often exist specifically to close the vulnerabilities botnets exploit to get in.
  • Change default passwords on routers and IoT devices (cameras, smart plugs, thermostats) the moment you set them up.
  • Don't click suspicious links or open unexpected attachments, even ones that look like they're from someone you know.
  • Use antivirus or other security software, and pay attention if it warns you about something.

A surprisingly effective habit: periodically restart and check on your smart devices. Some botnet malware only lives in a device's temporary memory and doesn't survive a full power cycle — so restarting a router or camera every so often can actually clear out an infection you never knew was there.


Your Turn

Check your understanding

Why is a botnet made of 100,000 ordinary devices more dangerous, and harder to stop, than a single attacker's computer trying to do the exact same thing?

Your answer:

Sample answer: one attacker's computer has one internet connection and one owner — it can be identified, blocked, or shut down fairly easily. A 100,000-device botnet spreads the exact same attack across 100,000 separate devices, addresses, and innocent owners scattered around the world. There's no single connection to block and no single guilty person to arrest, so defenders have to deal with an overwhelming, spread-out flood instead of one identifiable source. The devices also keep getting reinfected if their vulnerabilities are never patched, so even cleaning some of them up doesn't make the botnet go away for good.


Check Yourself

Quick quiz

1. What is a "bot" in the context of a botnet?

2. What does an attacker's command-and-control (C2) server do?

3. Besides DDoS attacks, which of these is a real use for a botnet?

Keep learning about cybersecurity

You've now seen how one attacker can quietly command an army of hijacked, everyday devices. Next, learn what happens when an attacker doesn't hijack a device at all, but instead sneaks into the middle of a conversation between two people who trust each other.

Part of the Cybersecurity Basics tutorial series.