Labs / Defensive Tools / Detect and analyse: signatures, sandbox, telemetry and decoys

Lab 5 of 5 · Detect and analyse: signatures, sandbox, telemetry and decoys

Honey-traps: decoys that only a snooper trips

Set a decoy host and a canary token nobody legitimate touches, and catch the one who does.

Start this lab 5 steps

The idea

Emil looks after the computers at Volans Observatory, whose archive holds decades of telescope data. A visiting researcher's account was used last week from a desk nobody was sitting at, and Emil wants to know if anyone is poking around where they shouldn't.

He sets two honey-traps: bait with no legitimate use, so any touch of it is an alert worth acting on, with almost no false positives. One is a honeypot host whose fake SSH, FTP and admin ports log every connection. The other is a canary token, a URL planted in a bait credentials file on the real archive, which calls home the instant anyone fetches it.

Two traps, two empty logs
Two traps, two empty logs
Honest work never reaches the decoy
Honest work never reaches the decoy
Any touch of the decoy is a high-confidence alert
Any touch of the decoy is a high-confidence alert
The bait sits on the real server, the alarm on the decoy
The bait sits on the real server, the alarm on the decoy
The fetch itself is the alert
The fetch itself is the alert

Steps

  1. Two traps, nothing legitimate touches

    Emil has set two decoys on the decoy host (10.0.1.11). The first is a honeypot. It listens on three ports a snooper loves, 22 (SSH), 21 (FTP) and 8080 (a web admin panel), and none of them serves anyone.

    The second is the call-home for a canary token: a small web server on port 9000, the beacon, that logs any fetch of a planted URL.

    Neither has a legitimate user, so both logs should be empty right now. That empty log is the baseline, and every line that appears later is a lead.

    decoy:~# ss -tln
    decoy:~# awk '/accepting connection/ {n++} END {print (n + 0) " touches logged"}' /var/log/honeypot.log
    decoy:~# awk '/CANARY/ {n++} END {print (n + 0) " token fetches logged"}' /var/log/canary.log
  2. A normal day, no alerts

    The analyst does their real work: they fetch the front page from the archive server (10.0.1.10). Honest traffic has no reason to reach a decoy or to know a planted URL, so both traps should stay silent.

    That silence is why their alerts are worth reading. A trap never has honest traffic to wade through, so it raises no false alarms.

    analyst:~# curl -sS http://10.0.1.10/
    decoy:~# awk '/accepting connection/ {n++} END {print (n + 0) " touches logged"}' /var/log/honeypot.log
    decoy:~# awk '/CANARY/ {n++} END {print (n + 0) " token fetches logged"}' /var/log/canary.log
  3. A scan trips the honeypot

    Someone who gets onto a network usually maps it first. A port scan knocks on every address's ports to see which are open. The scan cannot know which host is the trap, so it connects to the decoy host like any other, and the moment it does, the honeypot logs the touch with the source address.

    insider:~# nmap -Pn -sT -p 21,22,8080 10.0.1.10-13
    decoy:~# grep 'accepting connection' /var/log/honeypot.log
  4. The canary token: bait in your data

    A honeypot catches someone probing the network. A canary token catches someone already inside your data: it is a decoy credential, file or URL that nothing legitimate uses, wired to alert the instant anything touches it.

    Emil planted one: a bait credentials-backup.txt at an unlinked path on the archive server. No staffer browses there, but an intruder trying paths on the web server finds it. Read it the way they would.

    insider:~# curl -sS http://10.0.1.10/backup/credentials-backup.txt
  5. Take the bait, call home

    The intruder, tempted by a "recovery-doc" in a file of admin secrets, fetches the token URL to see what it holds. That fetch is what Emil was waiting for. The URL is unique to this bait, so the server that answers it knows which decoy was touched, and by whom.

    Fetch it, then read the canary's log.

    insider:~# curl -sS http://10.0.1.11:9000/t/vault-7f3a2c
    decoy:~# grep CANARY /var/log/canary.log

Run these steps on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab