Module 01 · Networking · Names into addresses · about 15 min to read
Continue where you left off ×
Write the telegram yourself
Write the Telegram Yourself · Open board
The code: teaching/code/dns_telegram.py: ~30 lines, stdlib only.
Before you start. DNS Resolution showed you a DNS lookup happening. DNS on the wire took its 29 bytes apart on the wire. Here you write those same 29 bytes yourself, by hand, and send them.
The idea in 30 seconds
A DNS lookup is 29 bytes: a random tag, a “please recurse” flag, some counts, the telegram-spelled name, and the answer kind wanted.
The note travels as one fire-and-forget packet, UDP, to port 53. The reply is a separate, unproven packet back.
The tag it echoes is the only thing tying a reply to your question, why it has to be random.
Dan Kaminsky, 2008: 65,536 possible tags is a guessable few seconds, not real security.
The fix randomised the return port too, stretching the guess to over eight hours, still a bet, not proof; DNSSEC is the proof.
A malformed request gets silence, not an error, because answering strangers’ garbage would arm them against someone else.
Read the story
Lesson 4 of 44 in Networking
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson 2008: the reply nobody could prove was real What your computer actually sends Type it yourself The reply is a stranger’s letter, not a return value Doormen don’t apologize How big a guess is the tag, really One level up: be the resolver, not the client Homework (break it on purpose) The bigger homework: stop being a stub Terms it explains: packet, port, UDP, byte, TTL, stub, authoritative, QR, RA, RCODE, 65,536, source port, 4.3 billion, DNSSEC, read, Add `read_name`, off.
Review Networking
Mark as read Saved in this browser, and to your account when you sign in.