Labs / Network Attacks / Breaking in and flooding

Lab 2 of 4 · Breaking in and flooding

Password spraying: one password against everyone at once

Try one likely password once against every account on a staff login list — low and slow, to slip under the account lockout.

Start this lab 4 steps

The idea

You are on the Kali box kali, on a signed engagement against Brackenhall College. One host answers: the staff portal, with a directory on 80 and SSH on 22.

Guessing one account's password until it falls — brute force — trips a lockout after a handful of tries, and a hardened login refuses it long before the right word comes up. Spraying turns the attack sideways: take one likely password and try it once against every account. Each account sees a single failed attempt, far under any lockout threshold, and if even one person reused a weak shared secret, that account opens. The whole attack needs two things — a list of who has an account, and one good guess at the password a lot of them share.

One password down the column, under the lockout
One password down the column, under the lockout

Steps

  1. Who even has an account

    A spray is only as good as its list of usernames, so enumeration comes first. A fast port scan shows which services answer, and the portal itself often leaks the names — a directory page, an error that confirms a login, or a provisioning file nobody cleaned up.

    Scan the two ports, then read the site. Brackenhall's portal has a human-readable directory on /, and a left-behind /accounts.txt that lists every staff login name outright — the hard part of a spray, handed over.

    kali:~# nmap -Pn -n -p22,80 10.0.1.20
    kali:~# curl -s http://10.0.1.20/accounts.txt | tee /tmp/users.txt
  2. Guess the password everyone shares

    Now the one guess. Spraying works when an organisation hands many people the same weak secret — most often an onboarding default that new staff were never forced to change. Brackenhall's is no mystery: the college name and a digit, Brackenhall1.

    hydra sprays it for you. -L takes the whole username list, -p sets the single password tried against each — the mirror image of brute force, where -l is one user and -P is a whole password list. One attempt per account, so no single account comes near a lockout.

    kali:~# hydra -L /tmp/users.txt -p Brackenhall1 ssh://10.0.1.20
  3. One hit is a foothold

    A sprayed password is a real credential. Log straight in with one of the pairs to prove the foothold — the same move an attacker makes the moment a spray lands.

    kali:~# sshpass -p Brackenhall1 ssh -o StrictHostKeyChecking=no mdunne@10.0.1.20 id
  4. What the portal's log shows — and the fix

    Switch seats. Every sprayed attempt hit the real sshd, which logged each one. The portal's auth log tells the spray apart from brute force at a glance: one source address touching many different usernames, each once, and a success or two among them.

    That shape points straight at the fixes, none of which is "lock accounts faster" — a lockout barely notices a spray:

    • Do not ship a shared default. The only reason the spray worked is that many accounts held the same onboarding password. Force a change on first login, and ban the obvious CollegeName+digit pattern.
    • Require a second factor. With MFA, a guessed password alone opens nothing — the single most effective control against spraying.
    • Watch for the spray signature. Alert on one source hitting many distinct accounts in a short window, not only on repeated failures against one account.

    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.

    portal:~# 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