Please enable JavaScript to use CodeHS

Cybersecurity Defense

What Is a Honeypot? Trapping Hackers on Purpose

Imagine a shiny wallet left on a table. It is empty, and it has a silent alarm inside. A honeypot is that wallet for computers. It looks valuable, it is fake, and the moment someone grabs it, the defenders know. Everything here is a safe toy model.

Security series ~20 min Beginner friendly 4 interactives
The big idea

A fake that looks real, on purpose

A honeypot is a fake computer, service, or file that looks valuable but holds nothing real. Real users never need it. So when something touches it, that is a strong sign that someone is where they should not be.

The name comes from the idea of bait: a pot of honey that attracts bees. Here the "bees" are intruders, people or programs that try to sneak into computers without permission. The "honey" is something that looks juicy, like a server named student-records-backup.

Why does a fake machine work so well? Think about a school hallway. Hundreds of students walk by every day, and that is normal. Now put a locked door labeled "Answer Keys" that no teacher ever uses. If someone starts rattling that doorknob, you notice right away. The quiet fake door makes the odd behavior easy to see.

New words show up on this page. Here is a short list, and each one is explained again where it is used.

Honeypot
A whole fake system, like a pretend server, set up to be probed.
Honeytoken
One fake item, like a file or account, that sends an alert when touched.
Decoy
Anything made to look real so it draws attention away from real things.
Intruder
Someone or something that enters a system without permission.
Alert
A message that warns defenders something odd just happened.
Log
A written record of events, in order. Defenders read logs to learn what happened.
Defender
A person or team who protects computers and the people who use them.
False alarm
An alert caused by something harmless, like a backup program.

Safety note. Every simulation on this page is a toy. Nothing here scans a network, probes a real computer, or teaches you to attack anything. This page is about defense and doing the right thing.

Why build a trap?

Three jobs for a fake machine

Defenders do not build honeypots for fun. A honeypot does three useful jobs. Tap each one to see how it helps.

One more reason honeypots are popular: they make very few false alarms. A normal busy server gets thousands of regular visits, so odd ones hide in the crowd. A decoy gets almost no regular visits at all. When it lights up, it is worth a look.

Try it: defender console

Place decoys, then watch a pretend intruder wander

You are the defender. The map shows a small school network. Five machines are real. Four spare slots can hold a decoy, but your budget allows only three. Place them, pick how the pretend intruder behaves, and press Run. The intruder is just a scripted token that follows a fixed path. It does nothing harmful.

Defender console

Toy modelscripted, harmless, runs only in your browser
Intruder style
When an alert fires
Decoys: 0 / 3

Tip: decoys only help if the intruder walks into them. Think about where each style goes first.

What did you just see? A decoy by itself does not stop anyone. It is a tripwire. Its job is to turn a silent break-in into a loud one, early. Real defenders also make decoys look believable and keep them away from anything that matters.

Try it: honeytokens

Tiny traps hidden among real things

A honeytoken is a single fake item that sends an alert when someone uses it. It can be a fake file, a fake user account, a fake password, or a fake secret key. It costs almost nothing to make, and it can sit right next to real files.

Below is a toy shared folder for a school. Four items are real. Three are honeytokens planted by the security team. Open things and watch the alert feed. Then try the nightly backup program to see how false alarms happen.

School shared folder

Toy modelno real files are opened
  • homework-help.docxFile, edited yesterday
  • teacher-passwords-OLD.txtFile, no one remembers it
  • lunch-menu.pdfFile, posted weekly
  • grades-master-COPY.xlsxFile, in the "Admin" folder
  • class-photos/Folder, shared by the yearbook club
  • account: backup-adminUser account, powerful, never signs in
  • library-books.csvFile, updated by the librarian
alert-feedAlerts: 0

Notice the pattern. Nobody needs teacher-passwords-OLD.txt for homework, so a single touch is suspicious. The same is true for an account that never signs in. There is no need to guess whether the behavior is "normal". It should never happen at all.

But the backup program reads everything, so it trips the traps too. That is a false alarm. Defenders fix it by adding the trusted program to an allow list, which is a short list of things the alert system should ignore. They keep that list small, because a long list leaves gaps.

Ethics and the law

Detect and learn. Never harm.

A honeypot uses a little trickery, so the rules matter. The goal is to detect trouble and learn from it. The goal is never to hurt anyone, and especially never to hurt people who did nothing wrong.

  • RULE 1Own it or get permissionSet honeypots only on systems you own or have written permission to use. Do not plant traps on someone else's network.
  • RULE 2No real private dataFill decoys with made-up data. Never copy real names, grades, or passwords to make bait look believable.
  • RULE 3Keep it isolatedA decoy must not become a stepping stone. If an intruder took over a honeypot, it must not be able to reach real machines or attack other people.
  • RULE 4No hacking backCatching an intruder does not give you the right to break into their computer. In many places that is a crime, even if they started it.
  • RULE 5Protect the innocentCurious classmates, lost visitors, and harmless programs can bump into decoys too. Check the evidence before blaming anyone.

You may also hear the word entrapment. It means pushing someone to commit a crime they would not have done otherwise. Honeypots are usually passive: they sit and wait. They do not call out to people or invite them in. Laws about this differ by country and situation, so treat this page as an introduction, not legal advice. When in doubt, ask a teacher, a school IT leader, or a lawyer.

Okay or not okay?

Scenario 1 of 5

Limits

Attackers are not always fooled

Honeypots are clever, but they are not magic. Skilled intruders know about them and look for clues. A decoy can give itself away in a few ways.

  • Too easy. A server with the password "admin" that holds a file called ALL-THE-SECRETS.zip looks like bait, because it is.
  • Too perfect or too fresh. Real machines are messy. They have odd errors, old files, and many different users. A spotless machine with no history stands out.
  • Acts wrong. A "very old" machine that answers faster than old hardware could is suspicious.
  • Nobody uses it. A server with zero normal traffic can be a clue by itself.

There is a second limit. A honeypot only sees what touches it. If an intruder walks around it, you get no alert. And silence does not prove safety, because it may mean nobody came by, or it may mean the alert system is broken. That is why defenders test their traps and use them as one layer next to firewalls, strong passwords, and software updates.

Defense in depth. No single tool catches everything. Layers work like the walls of a castle: if one fails, the next one still helps.

Try it: spot the trap

Real server or decoy?

Here are eight descriptions of machines on a school network. Decide whether each one is real or a decoy. You will see the clues after every answer. These clues are hints, not proof. Even experts get fooled.

Spot the trap

Case 1 of 8

Did you notice the last decoy was hard to spot? That is the real lesson. The defenders could tell because they have the official asset list. The attacker does not. Good decoys use the knowledge that only the defenders have.

Think

Check your understanding

A honeypot sends zero alerts for a whole year. Is it failing? What would you check?

Not necessarily. Silence can mean no one has tried to get in. But it could also mean the trap is broken. Good defenders test it: they touch the decoy themselves on purpose and confirm that an alert arrives. They also ask whether it still looks like a real machine and whether it sits where an intruder would actually walk.

Quick answers

Questions people ask

What is the difference between a honeypot and a honeytoken?

A honeypot is a whole decoy system, like a pretend server. A honeytoken is one fake item, like a file, account, or password, that sends an alert when used. Honeytokens are smaller and can hide among real things.

Are honeypots legal?

Running one on your own systems with the owner's permission is a common defensive practice. Rules vary by country and situation, so this is not legal advice. Keep real private data out, keep the decoy isolated, and never hack back.

Can attackers tell a honeypot is fake?

Sometimes. Decoys that are too easy, too perfect, or too quiet can give themselves away. That is why honeypots are one layer of defense, never the only one.

Does a honeypot replace a firewall or antivirus?

No. A firewall controls what traffic may enter. A honeypot watches for visitors who touch things they should not. They do different jobs and work best together.

Quick quiz

Check what you learned

1. Why is a decoy file nobody should ever open so useful?

2. A defender catches an intruder in a honeypot. What should they do?

3. Which decoy is most likely to give itself away?

Keep learning

Where to go next

Think like a defender

You can now explain decoys, honeytokens, and why honeypots must detect without harming anyone. Next, see how firewalls guard the door, how ethical hackers help, and how AI spots attacks.

Related: What Is Malware?