Lion Cipher Lab

Trace how Linux turns a hostname into an IP address, and catch a hosts-file override

Why it matters

Every time a program connects to a name -- your bank's website, a software update server, an API -- something has to turn that name into an IP address first. That step is called NAME RESOLUTION, and on Linux it is not just 'ask DNS'. There is a local file, /etc/hosts, that is checked first, and whatever it says wins. That makes it a favourite of adware and malware: add one line and the victim's computer quietly sends 'www.yourbank.example' to an attacker's server, or sends the antivirus update site to nowhere, while DNS itself looks perfectly healthy. It also causes honest confusion every…

What you'll learn

Steps in this lab

  1. Open a throwaway Linux box and install the lookup tools
  2. Read the three files that decide where a name goes
  3. getent asks the way programs ask; dig asks DNS only
  4. Save a known-good baseline BEFORE anything goes wrong
  5. Play the attacker: plant a hosts-file override
  6. Catch it three ways, and count
  7. Why reordering nsswitch.conf is not a fix
  8. Fix it properly, and prove the fix with the same numbers
  9. The honest negative: what these checks cannot tell you
  10. The judgment: which tool for which question

Open the full interactive lab →