Labs / Night Watch / IDS/IPS, honeypots & sinkholes

Lab 2 of 3 · IDS/IPS, honeypots & sinkholes

DNS sinkhole: blocking bad domains for every client at once

Block a bad domain for every client at once and find the infected host.

Open this lab Pro 5 steps

The idea

A DNS sinkhole makes the one resolver every machine trusts answer a known-bad domain with a dead end, blocking it for the whole network at once and naming which machine asked. Here infectedPc and cleanPc share the company resolver, badNs serves the malware's domain, and the sinkhole server catches what the block sends its way.

Sinkhole or NXDOMAIN
Sinkhole or NXDOMAIN

Steps

  1. One resolver for every client

    Both PCs point at the same DNS server, the company resolver at 10.0.1.12, in /etc/resolv.conf. Every name they look up passes through this one box, so whatever it decides, including what to block, lands on the whole network at once.

    infectedPc:~# cat /etc/resolv.conf
    infectedPc:~# dig +short www.site
    cleanPc:~# dig +short www.site
  2. An infected host phones home, and the log names it

    infectedPc runs malware that calls home to its command-and-control (C2) domain, c2.evil. The resolver does not block it yet: the name resolves and the beacon lands. But it logs every query, and that log is how you find which machine is infected.

    infectedPc:~# dig +short c2.evil
    infectedPc:~# curl -sS -m3 http://c2.evil/
    resolver:~# grep c2.evil /var/log/unbound.log

Pro

3 more steps in the app

  1. Block it for everyone: the sinkhole
  2. The sinkhole logs who arrives
  3. A hard block: NXDOMAIN
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab