Password spraying: how to detect it in Windows and Linux logs
How to detect password spraying in Windows event logs, domain controller logs and SSH logs, tell it from stale passwords, and find the guess that worked.
Password spraying is a brute-force technique in which an attacker tries one or two common passwords against many accounts, instead of many passwords against one account. Each account sees only a failure or two, so lockout policies never trigger, and in any organisation of a few hundred people the odds are good that someone chose "Winter2026!" or the company name followed by a year.
That design is also what gives it away. A single source that fails against dozens of different accounts in a short time does not look like any normal user, and the logs that record it are already on every Windows host, every domain controller and every Linux server. This article shows where password spraying shows up, how to separate it from the background of stale passwords, and how to find the account where the guess worked, with examples from two intrusions we staged and investigated in our lab.
How password spraying works
A spray has three parts: a list of account names, a short list of likely passwords, and patience.
The account list comes from anywhere: a company website, LinkedIn, an email address format plus a list of first names, or, once inside the network, the directory itself. The passwords are the ones people pick when a policy demands length, a capital letter, a number and a symbol: season plus year, company name plus year, "Welcome1!", "Password123". The attacker tries the first password against every account, waits, then tries the next, keeping each account's failure count below the lockout threshold within the observation window.
| Technique | Accounts | Passwords per account | Signature in the logs |
|---|---|---|---|
| Brute force | One or a few | Many | Many failures for one account, usually ending in a lockout |
| Password spraying | Many | One or two per round | One or two failures for each of many accounts from the same source |
| Credential stuffing | Many | One, from a breach | Failures and successes for many accounts, each with a different password |
| Stale password | One | The same old one, repeatedly | Steady, regular failures for one account from one device |
Attackers spray wherever a login is exposed: VPN gateways, Remote Desktop, webmail and cloud identity providers from the internet, and SMB, Kerberos and LDAP once they are inside. Cloud sign-in logs are a separate source with their own tooling; this article covers the Windows and Linux evidence that an investigation of hosts and domain controllers relies on.
Where password spraying shows up in Windows logs
On the computer that was targeted
Every failed logon on a Windows computer writes event ID 4625 to its Security log, with the account name tried, the logon type, the source address and a status code. For a spray against a server's SMB or RDP service you will see a run of 4625 events with logon type 3 or 10, from one address, for many different account names, each with status 0xC000006A (correct name, wrong password) or 0xC0000064 (no such user).
On the domain controllers
For domain accounts, the authentication happens on a domain controller, which records it whichever machine the attacker pointed at:
- 4771 with failure code 0x18 is a wrong password over Kerberos, with the client address.
- 4776 with error 0xC000006A is a wrong password over NTLM, with the workstation name the client reported (no address).
- 4768 with result 0x6 is a user name that does not exist, which is what enumeration before a spray looks like.
Domain controllers are the best single place to look, because one query over their logs covers every target in the domain. They are also the busiest logs you own, so collect them early, before the spray and the morning's ordinary logons roll the history away.
The success
The event that matters most is not a failure. It is the 4624 successful logon (on the target) or the 4768 with result 0x0 (on the domain controller) for one of the sprayed accounts, from the spraying source, after the failures began. That is the account whose password was guessed, and everything in its session afterwards belongs to the attacker.
Where it shows up on Linux servers
SSH password spraying is constant on any server with port 22 open to the internet. The SSH daemon logs every attempt in /var/log/auth.log (Debian and Ubuntu), /var/log/secure (Red Hat family) or the systemd journal. Typical lines look like this (addresses from the documentation range):
sshd[2481]: Invalid user oracle from 198.51.100.23 port 51234
sshd[2481]: Failed password for invalid user oracle from 198.51.100.23 port 51234 ssh2
sshd[2490]: Failed password for root from 198.51.100.23 port 51302 ssh2"Invalid user" lines are names that do not exist on the server; "Failed password for" without "invalid user" is a real account. A spray from one source shows one or two attempts for each of many names; a botnet spreads the same list across many sources, a few attempts each. Failed logins through login and some other services are also written to /var/log/btmp, readable with lastb (see Linux login records), but SSH attempts are most reliably found in the daemon's own log lines.
The question is the same as on Windows: did any source that sprayed also log in? Look for "Accepted password" or "Accepted publickey" from those addresses.
Spraying, guessing or a stale password?
Most failed logons in any organisation are not attacks. Before calling something a spray, check the pattern:
| What you see | Most likely |
|---|---|
| One account, one device, a failure every few minutes for days | A phone, service, scheduled task or mapped drive with an old password |
| One account, dozens of failures in a minute, one source | Password guessing against that account |
| Many accounts, one or two failures each, one source, minutes to hours | Password spraying |
| Many accounts, a few failures each, many sources, same names | Distributed spraying (botnet) |
| Many non-existent names (0xC0000064, 0x6, "Invalid user") | Account enumeration, often before a spray |
| Failures followed by a success from the same source | The guess that worked: start the investigation here |
Two measures separate the cases quickly: the number of distinct accounts per source, and the regularity of the timing. Stale passwords are regular and narrow; sprays are wide.
Investigating a password spray, step by step
- Scope the source. Group failed logons by source address and count distinct accounts, first seen and last seen. Do it across every host and domain controller in scope at once, not host by host.
- List the accounts tried. For each spraying source, list the account names and the status codes. Real accounts with wrong passwords tell you who was targeted; non-existent names tell you the attacker's list was guessed rather than taken from your directory.
- Find any success. For each targeted account, search for a successful logon from the spraying source (4624, 4768 with 0x0, "Accepted" in SSH logs) after the first failure.
- Follow the successful session. From the 4624, take the Logon ID and the logon type. Process creation, new accounts, scheduled tasks and outbound connections in that session are the attacker's.
- Check for the other protocols. A source that sprayed SMB may also have tried RDP, VPN or webmail, which are logged elsewhere. Search firewall and VPN logs for the same address.
- Contain. Block the sources, reset the passwords of every account that was guessed, and check whether any of them reused that password elsewhere.
A real example: two hosts, ten minutes
In the Windows intrusion we staged for our lab (the Halden Freight office case), the attacker started against workstation HF-WS01 from 10.211.55.2 at 22:02:58 UTC. Grouping the 4625 events by source and account shows the pattern at once:
| Account | Failed attempts | First | Last |
|---|---|---|---|
| administrator | 5 | 22:02:58 | 22:03:08 |
| finance | 5 | 22:03:10 | 22:03:20 |
| a.berg | 15 | 22:03:22 | 22:04:20 |
| admin | 5 | 22:03:34 | 22:03:44 |
| scanner | 5 | 22:03:58 | 22:04:08 |
Thirty-five failures in under a minute and a half: five tries each against four common names, mixed with a longer run against a real user, a.berg, all with status 0xC000006A for a.berg (right name, wrong password). That is spraying and targeted guessing from the same source, which is common in practice. At 22:05:03 the same address logged on as a.berg, a network logon followed two seconds later by a Remote Desktop session. Within ten minutes that session had created a local administrator account, installed a service and a scheduled task, staged finance documents in an archive and moved by RDP to a second workstation. Every one of those steps sits in the session that started with the guessed password.
On the Linux side of the lab (the Halden Freight portal breach), the two servers logged 2,817 failed SSH logins from internet addresses over the period, 1,465 on the web server and 1,352 on the database server. A detection rule written during the investigation grouped them by source and checked each source for a later successful login. None had one: the attacker's real SSH logins came from a different address, with a key planted after a web application exploit, and were preceded by no failures at all. That is the other half of the lesson. A spray that never succeeded is noise to block; the absence of failures before a login can be the more important clue.
Finding password spraying with Arcsentry
Arcsentry loads Windows event logs, domain controller logs and Linux authentication logs into one case, so the spray can be scoped across every host with one query. Failed Windows logons per source, with the number of accounts tried:
filter event_code == "4625"
group {source_ip} (aggregate {
accounts = (dcount user_target_name),
attempts = count this,
first_seen = (earliest timestamp),
last_seen = (latest timestamp)
})
sort {-accounts}The same shape on domain controllers uses 4771 with failure code 0x18, and on Linux servers the SSH lines in syslog:
filter event_type == "syslog" && message ~= "(?i)(failed password|invalid user)"
group {source_ip} (aggregate {attempts = count this, first_seen = (earliest timestamp), last_seen = (latest timestamp)})
sort {-attempts}Asked in plain English ("which addresses failed to log on, against which accounts, how many times?"), Arcsentry writes and shows the equivalent query before it runs; in the Halden case that question produced the table above. The AI investigator takes the next steps on its own when asked how the attacker got in: it found the burst, the success at 22:05:03 and the session that followed, and cited each event. A query that proves useful can be saved as a detection rule and run on every future case.
Defending against password spraying
- Block the passwords sprays use. A banned-password list (company name, seasons, years, "Welcome", "Password") removes the guesses that work. Length beats complexity rules.
- Require multi-factor authentication on everything exposed to the internet: VPN, webmail, Remote Desktop gateways and cloud sign-in. A sprayed password is then not enough.
- Do not expose RDP or SSH with passwords to the internet. Put RDP behind a gateway or VPN; use keys for SSH and disable password authentication.
- Keep the lockout policy, and alert on its absence. Spraying is designed to stay under thresholds, so alert on distinct accounts per source, not only on lockouts.
- Log what you need and keep it. Failure auditing on, domain controller Security logs sized for weeks, and authentication logs forwarded centrally.
- Retire dormant accounts. Accounts nobody uses are the ones whose initial or old passwords never changed.
Frequently asked questions
What is password spraying?
Password spraying is a brute-force attack that tries one or a few common passwords against many accounts, rather than many passwords against one account, so that no account reaches the lockout threshold. It is MITRE ATT&CK technique T1110.003.
How is password spraying different from brute force?
Classic brute force tries many passwords against one account and usually triggers a lockout. Spraying tries few passwords against many accounts and avoids lockouts. In the logs, brute force is many failures for one account; spraying is a failure or two each for many accounts from the same source.
Which Windows event IDs detect password spraying?
On the targeted computers, 4625 (failed logon). On domain controllers, 4771 with failure code 0x18 (Kerberos wrong password), 4776 with 0xC000006A (NTLM wrong password) and 4768 with result 0x6 (unknown user, from enumeration). A 4624 or 4768 success from the same source afterwards shows which account was guessed.
How do you detect password spraying in SSH logs?
Look in auth.log, secure or the journal for "Failed password" and "Invalid user" lines, group them by source address and count distinct user names. Then check whether any of those sources has an "Accepted password" or "Accepted publickey" line.
Does account lockout stop password spraying?
Not on its own. Spraying is paced to stay under the threshold. Lockout limits the number of guesses per account; detection needs to count accounts per source, and multi-factor authentication and banned passwords make the guesses useless.
How we wrote this
Drafted with AI from evidence in our own lab, with Laura Pompeu responsible for the article. The evidence comes from Halden Freight office intrusion (Windows) and portal breach (Linux), built and investigated in our lab, so every example can be checked against real records.
Sources
- MITRE ATT&CK T1110.003: Brute Force: Password Spraying, MITRE
- Password spray investigation (incident response playbook), Microsoft
- 4625(F) An account failed to log on; 4771(F) Kerberos pre-authentication failed; 4776(S, F) The computer attempted to validate the credentials for an account, Microsoft
- OWASP: Password Spraying Attack, OWASP
See it on your own evidence. Free for 7 days.
Tell us what you want to investigate. A person replies within one business day with the download and a trial licence.
Request a trial