Labs / Network Attacks / Breaking in and flooding

Lab 4 of 4 · Breaking in and flooding

DNS reflection: bounce a flood off someone else's resolver

Measure how a tiny query draws a huge DNSSEC answer off an open resolver, then forge a victim's address so the flood hits them.

Start this lab 4 steps

The idea

You're Beatrix, on a signed engagement against Kelp & Anchor, working from the Kali box kali. Their recursive resolver at 10.0.1.10 answers the whole internet — an open resolver, and there are millions like it. A DNS reflection attack turns one into a weapon: UDP never checks who sent a query, so you stamp a victim's address on a tiny request and the resolver mails a large DNSSEC answer to the victim, who never asked. The flood arrives from Kelp & Anchor's resolver, not from you (reflection), and the answer dwarfs the question (amplification). The only real fix is to stop being an open resolver.

A tiny question, a huge answer, aimed elsewhere
A tiny question, a huge answer, aimed elsewhere

Steps

  1. A resolver that answers the whole internet

    A resolver should recurse only for its own network. Ask this one for a name from inside Kelp & Anchor's LAN, and again as a stranger out on the internet, and see whether both are served. That second answer is the whole problem.

    staff:~# dig +short www.lab @10.0.1.10
    kali:~# dig +short www.lab @10.0.1.10
  2. A small question, a huge answer

    Now the amplification. Ask for everything about a DNSSEC-signed zone (an ANY query, signatures included). The question is a few dozen bytes; weigh the answer, stuffed with keys and signatures, against it.

    kali:~# dig +notcp +dnssec ANY lab @10.0.1.10
  3. Reflected onto someone who never asked

    Put the two together. Stamp the victim's address (10.0.2.13) on each query, so the resolver mails the big answer to the victim instead of to you. Fire a small burst and capture what lands on the victim.

    kali:~# sudo nping --udp -p 53 -g 7777 -e eth0 -S 10.0.2.13 --data abcd01000001000000000001036c61620000ff00010000291000000080000000 -c 30 --rate 30 10.0.1.10
  4. Close the resolver — and the fixes

    The attack needs a resolver that answers strangers, so the fix is to not be one. On Kelp & Anchor's router, drop DNS arriving from the internet toward the resolver. Fire the same burst and confirm nothing reflects — while the staff client, which never crosses the router, still resolves names.

    Then the defender's checklist:

    • Do not run an open resolver. Answer recursion only for your own network (allow-recursion), the single fix that removes you as a reflector — what you do here.
    • Response Rate Limiting on authoritative servers, and refusing ANY (RFC 8482), cut the amplification.
    • Anti-spoofing at the edge (BCP 38) stops the forged source leaving the attacker's network in the first place — the control that would end reflection everywhere, if everyone deployed it.

    Running this against a system whose owner has not authorised you in writing is an offence under laws like the UK Computer Misuse Act and the United States' CFAA — the engagement letter is what makes it a test and not a crime.

    kelpRouter:~# iptables -A FORWARD -d 10.0.1.10 -p udp --dport 53 -j DROP
    kali:~# sudo nping --udp -p 53 -g 7777 -e eth0 -S 10.0.2.13 --data abcd01000001000000000001036c61620000ff00010000291000000080000000 -c 30 --rate 30 10.0.1.10
    staff:~# dig +short www.lab @10.0.1.10

Run these steps on real machines

Keep reading

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