Investigation · Credentials
Is this a brute-force or password-spray attack, and did any attempt succeed?
Tell brute force from spraying by grouping failures, decode the failure codes, check the DC's Kerberos and NTLM logs, and prove whether any login succeeded.
When you would ask thisYou see a spike of failed logons and must classify the attack, identify the source, and determine whether it ended in a successful authentication.
Steps
- 1
Gather the failures
Event 4625 is a failed logon. For each one record TargetUserName, IpAddress, WorkstationName, LogonType and the Status and Sub Status codes. Then count two ways: by IpAddress and by TargetUserName. The shape of those counts is what distinguishes the attacks, so do the grouping before interpreting any single event. Note that 4625 covers NTLM and local failures; Kerberos pre-authentication failures are a separate event covered below and must be pulled from the domain controller.
Group failed logons by source and account (collected .evtx)Get-WinEvent -Path .\Security.evtx -FilterXPath "*[System[EventID=4625]]" | ForEach-Object { $x = [xml]$_.ToXml(); [pscustomobject]@{ User = ($x.Event.EventData.Data | Where-Object Name -eq 'TargetUserName').'#text' IP = ($x.Event.EventData.Data | Where-Object Name -eq 'IpAddress').'#text' } } | Group-Object IP, User | Sort-Object Count -Descending | Select-Object Count, Name - 2
Classify the pattern
Brute force is many failures against one account, often from one source: a high count for a single TargetUserName. Password spraying is the inverse, a few attempts each against many accounts, usually from one source in a tight window, so you see many distinct TargetUserName values with low per-account counts but a high total from one IpAddress. Credential stuffing looks like spraying but with valid-looking usernames. The grouping from the previous step tells you which immediately.
- 3
Decode the failure reason
In 4625 the Sub Status carries the specific reason: 0xC000006A is a wrong password (the account exists), 0xC0000064 is a username that does not exist, 0xC0000234 is account locked out, 0xC0000072 disabled, 0xC0000071 expired password and 0xC000006F logon outside permitted hours. A run of 0xC0000064 is enumeration of nonexistent names; a switch from 0xC0000064 to 0xC000006A for one name means the attacker found a real account and is now guessing its password. Pair with 4740 for lockouts triggered.
- 4
Check the domain controller's view
Against a domain, pull the DC logs. Kerberos pre-authentication failures are 4771, where Status 0x18 is a wrong password and 0x12 a disabled, locked or expired account; 4768 with a failure code shows TGT requests, and 0x6 means the client was not found. NTLM validation is 4776, where Status 0xC000006A is a bad password and 0xC0000064 no such user, Status 0x0 being success. These carry the source in IpAddress or Workstation and catch spraying that never hits a single host's 4625.
- 5
Determine whether any attempt succeeded
For each targeted account and source, look for a success right after the failures: a 4624 from the same IpAddress, a 4776 with Status 0x0, or a 4768 then 4769 pair on the DC. A dense burst of 4625 or 4771 for an account that ends in a 4624 from the same source is a successful breach of that account. Record the winning TargetUserName, the source and the LogonType used, because that is the session you now have to scope.
- 6
Scope the successful session
Take the TargetLogonId from the successful 4624 and follow it forward: 4672 if the session gained administrative rights, 4688 and Sysmon 1 for what it executed, and 5140 or 5145 for shares it touched. This converts 'they got in' into 'here is what the compromised account did', which is what containment needs. If the success was on the DC side only (4769), pivot to the target host named in ServiceName to find the corresponding session.
Where it goes wrong
- 4625 is not generated for Kerberos pre-authentication failures; those are 4771 on the domain controller, so a host-only 4625 search misses domain password spraying.
- If an account has Kerberos pre-authentication disabled (AS-REP roastable), a password attack against it may not produce 4771 at all; treat pre-auth-disabled accounts as a separate exposure.
- An account-lockout policy can mask spraying: a low-and-slow attack stays under the threshold on each account, so a modest count per name across many names is still an attack.
- With NLA, an RDP brute force can surface as 4625 Type 3 failures before any Type 10, so filtering only on Type 10 undercounts it.
- The source IpAddress may be a VPN, proxy or NAT gateway shared by many clients, so a single IP is not proof of a single actor.
- At the default 20 MB the Security log rolls over within hours on a busy DC, so the failures that preceded a success may already be gone; reconcile against forwarded logs.
Beyond event logs
Account lockout tooling
DC Security logs (4740) and Microsoft's LockoutStatus / Account Lockout tools
4740 names the caller computer that triggered a lockout, which helps attribute spraying to a source when the 4625 IpAddress is blank, as it sometimes is for certain logon paths.