Labs / Cryptography at Work / Hashes, passwords and obfuscation

Lab 4 of 5 · Hashes, passwords and obfuscation

Targeted wordlists: cracking passwords coined from the target's own words

Two hashes rockyou can't touch fall to a wordlist built from the target itself: cewl scrapes words, john rules reshape them, crunch sprays the year.

Start this lab 5 steps

The idea

Vikram runs an authorised penetration test for Pentland Observatory and has captured two account hashes. They are plain MD5 — the weak kind — and yet rockyou, the 14-million-password leak that tore through a table of hashes in the last lab, gets nowhere on either one.

The reason is not strength, it is coverage. rockyou holds passwords people reused across the internet; it does not hold a word a small observatory coined for itself. When a password is built from local vocabulary — a telescope name, a project, a year — no off-the-shelf list contains it, and cracking stalls on hashes that are otherwise weak.

The fix is a wordlist built from the target: cewl to scrape the observatory's own words, john rules to reshape each word into the house pattern, and crunch to fill the predictable tail. A few dozen aimed guesses beat fourteen million generic ones.

Vikram only points these tools at Pentland Observatory because it has authorised this test in writing. Running a cracker against a system whose owner has not authorised you in writing is a crime, not a lab exercise.

Why rockyou misses and a profiled list hits
Why rockyou misses and a profiled list hits

Steps

  1. Two hashes rockyou will not give up

    You're on your Kali box, kali, with the two captured hashes saved at /home/kali/loot/portal.txt, one username:hash row each. Both are plain MD5 — already named, because naming the hash was the previous lab's job — so the only question left is which word each digest came from.

    Reach for rockyou first, the way you would for any fast hash: hand john the format, the wordlist and a short time cap, and let it run the whole 14-million-word list. On a raw MD5 that takes about a second.

    kali:~# cat /home/kali/loot/portal.txt
    kali:~# john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt --max-run-time=25 --pot=/tmp/generic.pot /home/kali/loot/portal.txt
    kali:~# john --show --format=raw-md5 --pot=/tmp/generic.pot /home/kali/loot/portal.txt
  2. Scrape the observatory's own words with cewl

    cewl (the Custom Word List generator) crawls a website and prints every distinct word it finds. Point it at the observatory's public site — reachable on the lab LAN at http://10.0.1.20/ — and it harvests the vocabulary the staff see every day: the telescope names, the place names, the project words.

    Use -d 1 to follow links one level deep and -m 5 to keep only words of five letters or more, which drops the filler ("the", "and") and leaves the names worth guessing. -w writes them to a file you'll feed a cracker.

    kali:~# cewl -d 1 -m 5 -w /home/kali/loot/site.txt http://10.0.1.20/
    kali:~# sort /home/kali/loot/site.txt
  3. The bare word is not the password

    Try the scraped list as it stands: point john at the two hashes with --wordlist=/home/kali/loot/site.txt and the same raw-md5 format. The list now holds Allermuir and Threipmuir, so if either password were the bare word it would fall here.

    It will not. A real password is rarely the raw word — people add a capital, a digit, a year to clear the "must contain a number" rule. The scraped word is the base; the password is the base plus a predictable twist.

    kali:~# john --format=raw-md5 --wordlist=/home/kali/loot/site.txt --pot=/tmp/raw.pot /home/kali/loot/portal.txt
    kali:~# john --show --format=raw-md5 --pot=/tmp/raw.pot /home/kali/loot/portal.txt
  4. Mangle the words with rules — the first account falls

    john's --rules option runs each wordlist word through a set of transformations before it hashes the guess: capitalise the first letter, append a digit, swap letters for look-alike symbols, and dozens more. One scraped word becomes hundreds of realistic variants, so Allermuir is now tried as Allermuir1, Allermuir!, Allermuir7 and the rest of the house pattern.

    Run the same command as before with --rules added. The list is still tiny; the rules multiply it into the shapes people actually choose.

    kali:~# john --format=raw-md5 --wordlist=/home/kali/loot/site.txt --rules --pot=/tmp/crack.pot /home/kali/loot/portal.txt
    kali:~# john --show --format=raw-md5 --pot=/tmp/crack.pot /home/kali/loot/portal.txt
  5. Spray the house year with crunch — the second account falls

    The rules took j.lennox because its twist was a single digit. s.aitken resisted, so the twist is longer — and the most common long twist is a year. Rules do not spray every four-digit year, but crunch does: it generates every string matching a pattern you give it.

    j.lennox built a password on one telescope name, so try the other — Threipmuir, the survey array, the second name all over the site. crunch 14 14 -t Threipmuir%%%% builds every 14-character string that is that word followed by four digits (% means a digit), from Threipmuir0000 to Threipmuir9999 — 10,000 candidates, the base word from your scrape with the predictable tail filled in. Feed that list to john.

    kali:~# crunch 14 14 -t Threipmuir%%%% -o /home/kali/loot/years.txt
    kali:~# john --format=raw-md5 --wordlist=/home/kali/loot/years.txt --pot=/tmp/crack.pot /home/kali/loot/portal.txt
    kali:~# john --show --format=raw-md5 --pot=/tmp/crack.pot /home/kali/loot/portal.txt

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