Home / Blog / Alert Triage
Spotting Brute Force in Splunk with bin and stats
Learn to spot brute force in Splunk: count Windows 4625 and Linux SSH failures in time buckets with bin and stats, then tell guessing from spraying and check for false positives.
A burst of failed logons is one of the first patterns a SOC (Security Operations Centre) analyst learns to read. This guide shows how to count Windows and Linux failures in Splunk using two commands, bin and stats, and how to decide whether a count means an attack or just a forgotten password.
Scenario: At 09:12 an alert fires with the title "Multiple failed logons". It names the source 10.0.4.22 and the server SRV-FILE01. You have a few minutes to decide: is someone guessing passwords, or did a colleague change their password last night and forget a saved login on their phone?
What brute force looks like in logs
Brute force means guessing passwords until one works. MITRE ATT&CK (a public catalogue of attacker behaviour) tracks it as technique T1110. Every wrong guess leaves a log line, so spotting it is mostly a counting job: how many failures, in how long, from where, against which accounts.
ATT&CK splits the technique into sub-techniques. Three are worth knowing now:
The shape in the logs is different for each. Guessing gives one account with a lot of failures. Spraying gives one source touching many accounts, a few failures each. ATT&CK also notes that attackers may deliberately slow a spray down to stay under alert thresholds, so a quiet trickle can still matter.
Which log lines to look for
Windows: event 4625
Windows records every failed logon as event 4625, "An account failed to log on". It is written on the computer where the attempt was made. These are the fields you will use most:
| Field | What it tells you |
|---|---|
| Account For Which Logon Failed | The account name that was tried |
| Source Network Address | The IP address the attempt came from |
| Logon Type | How the logon was attempted: 2 is interactive (at the keyboard), 3 is network, 10 is remote desktop |
| Status and Sub Status | Codes that explain why it failed |
Two Sub Status codes are worth remembering. 0xC0000064 means the user name does not exist. 0xC000006A means the user name exists but the password was wrong. The overall Status 0xC000006D is the general "logon failed" code. Microsoft documents 0xC0000234 as the code for a locked out account.
Watch out: Event 4625 contains two fields called Account Name. The first, under Subject, is the account that reported the failure, often the computer itself. The second, under Account For Which Logon Failed, is the account that was tried. Splunk can mix these up, so always check which one you are reading.
Linux: SSH authentication lines
SSH (Secure Shell, the remote login service) writes failures to the authentication log: /var/log/auth.log on Debian and Ubuntu, /var/log/secure on Red Hat style systems. A failed attempt looks like this:
Nov 18 09:12:41 SRV-WEB02 sshd[4121]: Failed password for invalid user admin from 10.0.4.22 port 52144 ssh2
The words "invalid user" mean that user name does not exist on that server. Attackers often try names like admin or test, so a run of invalid users from one address is a strong hint of guessing.
Step 1: count failures with stats
Start with the simplest search that answers "who is failing most?"
index=wineventlog sourcetype="WinEventLog:Security" EventCode=4625
| stats count by Source_Network_Address
| sort - count
- Line 1 picks the data: your Windows index, the Security log, and only event 4625.
- Line 2 counts the events for each source address.
- Line 3 sorts so the biggest count is first.
Note: The index name here is a placeholder, and field names such as Source_Network_Address depend on how your Splunk is set up. Open one real event, look at the Fields sidebar, and use the names you see.
This tells you who failed most, but not when. Fifty failures in three weeks is normal. Fifty in five minutes is not. That is where bin comes in.
Step 2: group failures into time buckets with bin
The bin command rounds the time on each event down to a fixed step, such as five minutes, so events in the same step share one time value. Then stats can count per step. Splunk documents this pattern as bin _time span=5m followed by stats.
index=wineventlog sourcetype="WinEventLog:Security" EventCode=4625
| rex "Account For Which Logon Failed:\s+Security ID:\s+\S+\s+Account Name:\s+(?<target_user>\S+)"
| bin _time span=5m
| stats count AS failures dc(target_user) AS accounts_tried by _time Source_Network_Address
| where failures >= 10
| sort - failures
- The rex line pulls out the second Account Name, the account that was tried, into a field called target_user. It is a safe way around the duplicate name problem.
- bin _time span=5m puts every event into a five minute bucket.
- stats counts failures per bucket and per source. dc means distinct count, so accounts_tried is how many different accounts that source tried.
- where keeps only buckets with 10 or more failures. Ten is a starting point, not a rule. Adjust it for your environment.
- sort puts the noisiest source first.
A result might look like this:
| _time | Source_Network_Address | failures | accounts_tried |
|---|---|---|---|
| 2026-11-18 09:10:00 | 10.0.4.22 | 46 | 1 |
| 2026-11-18 09:10:00 | 10.0.7.51 | 12 | 12 |
The first row is one account hit 46 times: classic guessing. The second row is 12 different accounts, one failure each: this looks like spraying.
Step 3: the same idea for Linux SSH
index=linux sourcetype=linux_secure "Failed password"
| rex "Failed password for (?:invalid user )?(?<target_user>\S+) from (?<src_ip>\d{1,3}(?:\.\d{1,3}){3})"
| bin _time span=5m
| stats count AS failures dc(target_user) AS accounts_tried by _time src_ip
| where failures >= 10
- The first line searches for the words "Failed password" in the Linux secure log. The sourcetype name linux_secure comes from the Splunk Add-on for Unix and Linux, so yours may differ.
- The rex line captures the user name and the source address. The (?:invalid user )? part means the words "invalid user" are optional, so one pattern handles both kinds of line.
- The last three lines work exactly as they did for Windows.
Tip: Run the search over the last 24 hours first and look at the biggest numbers. Seeing what normal looks like on your data is the quickest way to choose a sensible threshold.
Step 4: decide what the numbers mean
- S1Read the countsHigh failures with one account tried points to guessing. Low failures across many accounts points to spraying.Counts
- S2Read the targetsAre the accounts real? Many Sub Status 0xC0000064 or "invalid user" lines mean the source is guessing names.Targets
- S3Look for a successSearch for event 4624 (a successful logon) or the SSH phrase "Accepted password" from the same source after the failures.Outcome
- S4Identify the sourceIs 10.0.4.22 a known server, a VPN pool, a scanner or an unknown external address?Owner
Failures, then a success
HighA guess worked and the account could now be in use by someone else.
Escalate quickly, and follow your process for resetting the account and checking what it did next.
Many accounts, one source
HighLikely password spraying (T1110.003), aimed at staying under a per account lockout.
Check whether any of the accounts succeeded, and look at the same source in other logs.
One account, steady small trickle
MedOften a saved old password on a phone, mapped drive or scheduled task.
Check with the user or the service owner before treating it as an attack.
Common false positives
Not every burst is an attack. Before you escalate, check these:
- Did the user change their password recently, leaving an old one saved on a device?
- Is the account a service account with an outdated password in a script or scheduled task?
- Is the source a vulnerability scanner or a planned penetration test?
- Is the source a shared address, such as a VPN or office gateway, hiding many users behind one IP?
Watch out: Do not block an address just because it tops a list. A shared gateway could lock out a whole office. Confirm what the source is first.
Where this fits on shift and in your studies
Failed logon alerts are routine work in a SOC, so being able to read one quickly is a very practical skill. Authentication attacks and log analysis are standard themes in entry level security study, including CompTIA CySA+ and Security+, so check the official exam objectives for the exact wording.
For what to study next:
- Read the MITRE ATT&CK page for T1110 and its sub-techniques.
- Learn event 4624 (successful logon) so you can follow a failure through to a success.
- Look up account lockout event 4740 on domain controllers.
- Read the Splunk documentation for bin and stats, then try timechart for a quick graph.
Key takeaways
- Brute force detection is mostly counting failures in a short window, then asking who, how many accounts and what happened next.
- Use bin _time span=5m with stats count to turn a pile of events into a per source, per time bucket view.
- Add dc(target_user) to tell one account being guessed from many accounts being sprayed.
- Always look for a success after the failures, and check the false positives before escalating or blocking.
Start small: run the first search on your own test data, then add one line at a time until you can explain every step. If you can say what each line does in plain words, you are ready to use it on a real alert.
Written by Ben, Cybersecurity Student