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.
Steps
-
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.txtthat 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
-
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.
-Ltakes the whole username list,-psets the single password tried against each — the mirror image of brute force, where-lis one user and-Pis 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
-
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
-
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+digitpattern. - 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
- 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
Run these steps on real machines
Keep reading
- Kali Tools: hydra article
- MITRE ATT&CK T1110.003: Password Spraying article
- Microsoft: Password spray investigation article