Labs / Network Attacks / Breaking in and flooding

Lab 1 of 4 · Breaking in and flooding

Online login guessing: an aimed list beats a brute one

Scrape a target's site for words with cewl, then let hydra throw them at a live SSH login until a reused one opens the door.

Start this lab 5 steps

The idea

You are on the Kali box kali, with a signed engagement against Westhaven Dispatch. One host answers: their operations server, running a status page on 80 and SSH on 22.

SSH takes passwords, so you could guess — but online credential guessing against a real box is usually a dead end. The accounts that matter hold long random passphrases no wordlist contains, and a loud guessing burst is exactly what a hardened login is built to refuse. The way in is not a bigger list, it is a sharper one: the word a courier coined for its own routes, printed on its own public page, and reused as a password on a door nobody rate-limited.

A sharper list, not a bigger one
A sharper list, not a bigger one

Steps

  1. Which door even takes a guess

    Online guessing attacks a live service, one round trip per attempt, so the first question is which services are even listening and which of them take a password at all. A fast port scan answers it.

    nmap asks each port whether something answers. Guessing only makes sense where a password is checked: SSH, a web login, a database. A static status page is not a login, however open the port — so the scan tells you which door is even worth a guess.

    kali:~# nmap -Pn -n -p22,80 10.0.1.20
  2. A generic list bounces off

    The lazy move is a generic password list — the millions of real-world passwords in a leak like rockyou. Against Westhaven it is hopeless, and it is worth watching it fail so you understand why the next step works.

    hydra throws credentials at a live service for you: -l sets one username, -P a password file, and the ssh:// module speaks the SSH login. Point it at the shared dispatch account with a handful of the usual suspects. A generic list holds passwords people reused from other sites; it does not hold a word a company coined for itself, so a courier's own route name is nowhere in it.

    kali:~# printf '%s\n' password 123456 admin letmein qwerty courier changeme > /tmp/common.txt
    kali:~# hydra -l dispatch -P /tmp/common.txt ssh://10.0.1.20
  3. Harvest the company's own words

    The fix for a list that holds the wrong words is to build one from the right source: the target's own site. cewl crawls a web page and writes out every distinct word it finds, which is exactly the vocabulary a staff member reaches for when inventing a password they will remember — a route name, a product, the town.

    This is Wordlist profiling: a small list, but aimed. -d 1 follows links one level deep, -m 5 keeps words of five letters or more, and -w writes the result to a file. Read what it harvests — the route names from the status page are right there.

    kali:~# cewl -d 1 -m 5 -w /tmp/words.txt http://10.0.1.20/
    kali:~# cat /tmp/words.txt
  4. The reused word falls

    Now run the same hydra, the same account, with the aimed list instead of the generic one. A list of a few dozen company words finishes in seconds, and where fourteen million generic passwords missed, one scraped route name fits.

    This is the whole lesson of online guessing against a real target: brute force by volume loses to a hardened login, but an aimed guess beats a reused word every time. When hydra reports a valid pair, confirm it is real by logging straight in with it.

    kali:~# hydra -l dispatch -P /tmp/words.txt ssh://10.0.1.20
    kali:~# sshpass -p Kittiwake ssh -o StrictHostKeyChecking=no dispatch@10.0.1.20 id
  5. What the server's log shows — and the fix

    Switch seats. Every one of those guesses hit a real sshd, which wrote a line for each. On the ops server the auth log tells the whole story: a burst of failures from one address, then an acceptance.

    That pattern — many failures then a success, all from the same source in seconds — is what a defender watches for, and it points straight at the three fixes, none of which is "use a longer generic blocklist":

    • Do not reuse a scrapeable word. The only reason the guess worked is that dispatch used a route name off the public site. A random passphrase from a manager is not on any list, aimed or generic.
    • Rate-limit the login. Nothing stood in front of port 22, so hydra could guess as fast as sshd allowed. A lockout after a few failures (fail2ban, or an iptables rate limit) turns a seconds-long attack into a hopeless one — you close that gap yourself in the practice tasks.
    • Prefer keys to passwords. PasswordAuthentication no with key-only login offers an online guesser no method to attack at all.

    Running this same guessing 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.

    opshost:~# grep -E 'Failed password|Accepted password' /var/log/auth.log | tail -n 12

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