The idea
Casimir has a signed testing contract with Culverton Transit, the city's bus and tram authority. Every staff laptop in their office looks names up through one shared resolver, which asks an upstream server once and caches the answer for everyone.
From Casimir's Kali box on the office network, sit in the middle of that upstream query and forge the answer for the staff portal. The resolver caches the lie, so staff who open the portal land on Casimir's copy of it, even after he has packed up and gone. Then see the cure: a resolver that checks DNSSEC signatures.
Steps
-
The office resolver, answering for everyone
Culverton's office has one forwarding resolver at
10.0.1.10. It does not walk the DNS tree itself. It asks an upstream resolver, keeps the answer in its cache, and hands that stored answer to the next staff member who asks.That shared cache is what Casimir is after. Ask the resolver for a staff name to see it work.
staff:~# dig +short www.transit @10.0.1.10
-
Poison the cache
Casimir's Kali box sits on the same office network as the resolver. It poisons ARP, so the resolver's upstream queries pass through Kali on their way out. Then bettercap answers the query for
portal.transititself, with10.0.1.66: a copy of the portal that Casimir set up on the office network.The resolver cannot tell the forged answer from a real one, so it caches it.
kali:~# sudo bettercap -no-colors -iface eth0 -eval 'net.probe on; sleep 6; set arp.spoof.fullduplex true; set arp.spoof.targets 10.0.1.10; arp.spoof on; set dns.spoof.domains portal.transit; set dns.spoof.address 10.0.1.66; set dns.spoof.all true; dns.spoof on; sleep 180' staff:~# dig +short portal.transit @10.0.1.10
-
The attacker is gone; the lie remains
Casimir has stopped bettercap. Nothing on the network is forging anything now. A staff member arrives late, and their laptop never saw a single forged packet. They ask the same resolver for the portal.
Whether they get the truth depends on the cache. Every DNS record carries a time to live (TTL), a countdown in seconds. A resolver serves its stored copy of a record until that countdown reaches zero, and only then asks upstream again. So the question is whether the forged record is still counting down.
latecomer:~# dig +short portal.transit @10.0.1.10
-
A resolver that checks the signature
The office kept a second resolver at
10.0.1.11that checks DNSSEC signatures. Thetransitzone is signed, so every real answer for it carries a signature that chains up to the root's key. A validating resolver checks that signature before it caches anything. A forged answer has no valid signature, so a validating resolver marks itbogusand refuses it withSERVFAILinstead of caching it.Casimir starts forging again, aimed at the office resolver. Ask the validating resolver the same name. In this lab the forgery reaches only the office resolver at
10.0.1.10, so you will not see abogusrefusal itself. You will see the validating resolver serve the real, signed portal while its neighbour serves the lie.The defender's checklist:
- Validate DNSSEC on your resolver. A forged, unsigned answer is
bogusand is dropped. This is the one fix that holds whether the attacker sits on the path or guesses from outside it. - Randomise the source port (and 0x20 name casing, and DNS cookies). Against an off-path attacker these turn the forgery into a race nobody wins.
- Protect the path to the upstream with DNS over TLS or HTTPS, so an on-path attacker cannot read or forge the query. Pin the gateway's MAC with Dynamic ARP Inspection to stop the ARP poisoning this attack rode in on.
Run this only against systems whose owner has authorised you in writing. Without that, it is an offence under laws like the UK Computer Misuse Act and the United States' CFAA. Casimir's engagement letter is what makes this a test.
kali:~# sudo bettercap -no-colors -iface eth0 -eval 'net.probe on; sleep 6; set arp.spoof.fullduplex true; set arp.spoof.targets 10.0.1.10; arp.spoof on; set dns.spoof.domains portal.transit; set dns.spoof.address 10.0.1.66; set dns.spoof.all true; dns.spoof on; sleep 180' staff:~# dig +short portal.transit @10.0.1.11
- Validate DNSSEC on your resolver. A forged, unsigned answer is
Run these steps on real machines
Keep reading
- Cloudflare: DNS cache poisoning article
- Root Cause: the Kaminsky DNS vulnerability (2008) article
- Kali Tools: bettercap article