Monday, August 24, 2026

How to Trigger Windows Event ID 4625 with Kali Linux and Metasploit — A CTA Detection Lab

 

Introduction

Windows Event ID 4625 is generated when a logon attempt fails. For security monitoring systems such as Cyber Threat Analyzer (CTA), this event is particularly useful because repeated failed authentication attempts can indicate password guessing, brute-force activity, or an unauthorized user attempting to access a Windows system.

In this lab, I used a Kali Linux virtual machine and Metasploit Framework to generate failed SMB authentication attempts against a Windows VM. The purpose is not to compromise the machine, but to create realistic security telemetry that can be observed in Windows Event Viewer and detected by CTA.

Lab safety: Perform this test only against a Windows VM or other system you own or are explicitly authorized to test. Use an isolated virtual network whenever possible.

Lab Environment

The test consists of two virtual machines:

  • Kali Linux VM — used to generate the authentication attempts.

  • Windows VM — the monitored target.

  • Metasploit Framework — used to perform the SMB login testing.

  • Windows Event Viewer — used to verify Event ID 4625.

  • Windows Threat Analyzer — used to detect and analyze the resulting event.

In this example, the Windows VM has the address:

192.168.254.101

The Windows account being tested is:

Administrator

Why Event ID 4625 Is Generated

Windows records security auditing information whenever authentication attempts occur.

A successful authentication can produce Event ID 4624, while a failed authentication can produce Event ID 4625.

When Metasploit repeatedly attempts SMB authentication using incorrect passwords, Windows receives those authentication requests and rejects the invalid credentials. Assuming the appropriate Windows auditing policies are enabled, the failed attempts are recorded as Event ID 4625.

This makes the test useful for validating a detection pipeline:

Kali Linux
     |
     | SMB authentication attempts
     v
Windows SMB Service
     |
     | Authentication failure
     v
Windows Security Event Log
     |
     | Event ID 4625
     v
Windows Threat Analyzer
     |
     v
Detection / Alert / Risk Analysis

Starting Metasploit

From the Kali Linux VM, start Metasploit:

msfconsole

Once the Metasploit console loads, select the SMB login scanner:

use auxiliary/scanner/smb/smb_login

Configure the Windows target:

set RHOSTS 192.168.254.101

Specify the Windows username:

set SMBUser Administrator

For the lab, configure a password file containing test passwords:

set PASS_FILE /root/passwords.txt

Enable verbose output so the authentication results can be observed:

set VERBOSE true

Finally, execute the scanner:

run

Metasploit will attempt the configured SMB authentication tests against the Windows VM.

What Happens on the Windows Machine?

For every invalid authentication attempt that reaches the Windows system and is rejected, Windows can generate a failed-logon security event.

The important event is:

Event ID: 4625
Provider: Microsoft-Windows-Security-Auditing
Description: An account failed to log on.

The exact event contents depend on the Windows version, authentication protocol, account configuration, and auditing configuration.

Among the information that may appear in the event are:

  • Account name

  • Account domain

  • Logon type

  • Source network address

  • Authentication package

  • Failure reason

  • Status/substatus codes

  • Workstation information

The Source Network Address is especially valuable for detection because it can identify the system generating the failed authentication attempts.

Verifying Event 4625

On the Windows VM, open:

Event Viewer

Navigate to:

Windows Logs
    └── Security

Filter the Security log for:

4625

The resulting entries should correspond to failed authentication attempts generated during the lab.

You can also verify the events from PowerShell:

Get-WinEvent -FilterHashtable @{
    LogName='Security'
    Id=4625
} -MaxEvents 20

This provides a convenient way to confirm that Windows is actually receiving and recording the failed authentication attempts.

How CTA Can Detect the Activity

This is where the test becomes particularly useful for Windows Threat Analyzer.

Instead of simply displaying Event ID 4625, CTA can analyze the event as part of a broader authentication-abuse detection strategy.

For example:

Event 4625
    ↓
Identify failed authentication
    ↓
Extract source IP
    ↓
Identify targeted account
    ↓
Count repeated failures
    ↓
Apply detection rule
    ↓
Calculate risk
    ↓
Generate WTA alert

A single failed login may be normal. A large number of failures from the same source within a short period is considerably more interesting from a security-monitoring perspective.

Turning Individual Events Into Detection

The real value of a SIEM/EDR-style monitoring system is correlation.

For example, CTA could detect a pattern such as:

Multiple 4625 events
        +
Same source IP
        +
Same target account
        +
Short time interval
        =
Possible password-guessing activity

The detection can then be mapped to the appropriate MITRE ATT&CK technique and assigned an appropriate severity.

This is significantly more useful than simply saying:

"Event ID 4625 occurred."

Instead, the system can communicate:

Repeated failed SMB authentication attempts detected from a remote host.

That provides the analyst with context and reduces the amount of manual investigation required.

Why This Is a Useful CTA Test

This simple laboratory exercise validates several components of a Windows security-monitoring platform.

1. Windows Event Collection

WTA must successfully receive the Windows Security events.

2. Event Parsing

The application needs to extract meaningful fields from Event ID 4625.

3. Rule Matching

The detection engine should recognize the event according to its configured rule.

4. Correlation

Multiple failed authentication events can be correlated based on:

  • Source IP

  • Username

  • Target machine

  • Time window

  • Number of failures

5. Risk Scoring

Repeated failures can contribute to a higher risk score than an isolated authentication failure.

6. MITRE ATT&CK Mapping

The activity can be associated with relevant credential-access or valid-account/password-guessing techniques depending on the precise behavior being detected.

A More Realistic Detection Scenario

The most interesting experiment is not simply generating one 4625 event.

Instead, generate a sequence of failed authentication events and observe how CTA handles the pattern.

For example:

14:32:01  4625  Administrator  Source A
14:32:02  4625  Administrator  Source A
14:32:03  4625  Administrator  Source A
14:32:04  4625  Administrator  Source A
14:32:05  4625  Administrator  Source A

A detection engine can recognize that these events are related.

The result can become something like:

Detection: Possible SMB Password Guessing
Source: 192.168.x.x
Target Account: Administrator
Failed Attempts: 5
Time Window: 5 seconds
Severity: High

This demonstrates the difference between event collection and threat detection.

Conclusion

Using a Kali Linux VM and Metasploit provides a controlled way to generate failed SMB authentication activity in a Windows laboratory environment.

The important part of the experiment is not Metasploit itself. The objective is to produce realistic Windows security telemetry and then verify that Cyber Threat Analyzer can collect, recognize, correlate, score, and alert on the resulting Event ID 4625 activity.

A basic test therefore becomes a complete detection-validation workflow:

Kali Linux
      ↓
Metasploit SMB authentication testing
      ↓
Failed Windows authentication
      ↓
Windows Event ID 4625
      ↓
WTA Event Collector
      ↓
Detection Rule
      ↓
Correlation Engine
      ↓
Risk Engine
      ↓
Security Alert

This kind of controlled attack simulation is valuable during development because it allows CTA's detection capabilities to be tested against actual Windows security events rather than only synthetic data.

Friday, August 21, 2026

Brute-force authentication

The problem with counting failed logons

Brute force is the most direct credential attack there is: repeatedly guessing passwords against a single account until one of them works, or until the attacker gives up and moves on. It's also, on paper, the easiest attack to detect — Windows logs every single failed logon as Security Event ID 4625, so in theory you just watch for a lot of them against the same account and you're done.

In practice, "watch for a lot of 4625s" is close to useless as a detection rule on its own, for two reasons that show up in almost every real environment:

  1. The threshold is impossible to tune. Set it too low and every user who fat-fingers their password twice on a Monday morning triggers an alert. Set it high enough to survive that noise and a patient attacker who spaces guesses out, or who's specifically trying to stay under a lockout policy, sails right underneath it.
  2. A raw count throws away all the context that actually tells you whether this is an attack. Ten failed logons against a service account that authenticates from the same server every five minutes due to a stale scheduled task credential is background noise. Three failed logons against a domain admin account, from an IP that's never authenticated successfully before, at 2 AM, is a very different story — and a flat count treats them identically.

This is the gap RULE-001 is built to close: instead of asking "how many 4625s," it asks "how many independent signals, of the kind an actual brute-force attempt would produce, does this specific failure carry."

How RULE-001 actually scores a failure

Every 4625 event gets evaluated against seven weighted signals, spanning four of WTA's ten detection dimensions (WHO, TARGET, TIMING, HISTORY, NETWORK). Nothing here is a hard yes/no rule; every signal adds points, and the event only becomes an alert once the running total clears a threshold of 40 out of 100 possible points.

DimensionSignalPoints
WHOTarget account name looks privileged (admin, administrator, a domain-admin-style name, etc.)+15
TARGETFirst failure seen against this account this session+10
TIMINGOff-hours — before 07:00 or after 20:00+15
HISTORYRepeated failures against the same account, tracked in a rolling 15-minute window+10 per extra failure, capped at +50
HISTORYFan-out — the same source has also failed against 3 or more distinct accounts+25
NETWORKNo prior successful logon on record for this account, to weigh the failure against+15
NETWORKSource IP looks external (not RFC1918/loopback/link-local)+10

Two things about how this plays out in practice are worth calling out directly, because they're the actual point of scoring it this way rather than counting:

A single isolated failure from a known-good source is nearly free. If a source IP has authenticated successfully before, and this is the first failure seen against an ordinary-looking account during business hours, the signals mostly cancel out to close to zero. That's the "Monday-morning typo" case being correctly ignored without anyone having to write a special-case exception for it.

A short burst against the right target clears the bar fast. Three repeat failures against a privileged-looking account (+15), off-hours (+15), from a source with no prior successful logon (+15) and that looks external (+10), plus the repeat-failure history itself (+10 × 2 extra failures = +20) adds up to 75 points on the third failure alone — nearly double the 40-point threshold — well before anything resembling a lockout policy would have kicked in. That's the scenario RULE-001 is actually built to catch: an attacker who knows to keep attempt counts low doesn't get a free pass just because they stayed under some fixed number.

The fan-out signal (+25 for hitting 3+ distinct accounts) deliberately stays a lightweight nudge inside RULE-001's own score rather than the whole story. Real password-spray detection — accounting for attempt averages per account, and escalating specifically when the pattern spreads across multiple target hosts — lives in its own dedicated detector (ACCT-SPRAY / ACCT-SPRAY-MULTI-HOST, covered in section 1.2). RULE-001 just makes sure a spray-shaped burst against any one of those accounts doesn't go unscored while the dedicated spray detector is still building up its own picture across the wider window.

Testing the rule without attacking anything

The most useful way to actually understand a scored detection rule isn't to read the point table, it's to watch it score a sequence of events and see exactly where the total crosses the line. Below is a small Python script that does that safely: it generates synthetic Windows Security 4625-shaped log entries with the signal combinations described above — it never touches a real login form, service, or account. It's the kind of thing you'd use to validate a detection rule in a lab/CI pipeline before trusting it in production, the same idea as a purple-team exercise, minus the actual attack.

Coming up next...demo hack on bruteforce attack and WTA will detect it!

Credential Attacks

 Almost every intrusion, whether it starts with a phishing email, an exposed RDP port, or a leaked password from some unrelated breach, eventually comes down to the same problem: getting a set of valid credentials, then getting more of them. Credential attacks are the techniques attackers use to do that, and they show up constantly in Windows Security event logs, mostly as Event ID 4624 (successful logon), 4625 (failed logon), and 4776 (credential validation).

The trouble with detecting them is that a raw event count tells you almost nothing. A handful of failed logons is normal, everyone fat-fingers a password. The question a detection engine actually needs to answer is what shape the failures take, who's failing, from where, against which accounts, and how that compares to what's normal for this environment. That's the difference between flagging noise and catching an attack in progress.

This section covers three related but distinct credential attack patterns, and where Windows Threat Analyzer currently stands on detecting each one.

Brute-force authentication

Brute force is the most direct version of the problem: repeatedly guessing passwords against a single account until one works, or until the attacker gives up. In WTA, this is handled by:

RULE-001 — Multiple Failed Logons

Rather than alerting on 4625 by itself, RULE-001 scores each failure against several behavioral signals and only fires once enough of them stack up:

  • repeated failures against the same account, tracked within a 15-minute window
  • the targeted account name looking privileged
  • failures happening outside normal business hours
  • a source IP with no prior successful authentication on record
  • a source IP that looks external rather than internal
  • a lightweight nudge when the same source is also failing against several other accounts (a hint of spraying, though the real spray detection lives elsewhere — see 1.2)

A single failed login from a source that's authenticated successfully before contributes almost nothing to the score. A burst of failures against a privileged-looking account, off-hours, from a source with no authentication history, clears the alerting threshold easily. That's the "more sophisticated than 4625 = attack" distinction in practice: the same raw event can mean nothing or mean everything, depending entirely on the context around it.

Password spraying

Spraying inverts the brute-force shape. Instead of many passwords against one account, it's a handful of passwords tried thin across a large number of accounts, specifically to stay under any single account's lockout threshold. A source hammering one account fifty times trips RULE-001. A source trying one or two passwords against two hundred accounts doesn't look like a brute-force attack at the account level at all, it looks like two hundred unrelated single failures, unless something is watching for the pattern across accounts.

That's what this dedicated detector does:

ACCT-SPRAY / ACCT-SPRAY-MULTI-HOST

  • ACCT-SPRAY groups failed logons by source IP and fires once that source has failed against a threshold number of distinct accounts, with a low average number of attempts per account, the low attempts-per-account average is what separates a real spray from a source that's just hammering a couple of accounts hard.
  • ACCT-SPRAY-MULTI-HOST fires alongside ACCT-SPRAY the moment that same spraying source's activity also spans multiple distinct target hosts, the attack's natural second stage once spreading thin across accounts on one host isn't tripping anything.

The distinction matters because brute force and spraying call for different responses, and a flat "too many 4625 events" rule can't tell you which one you're looking at. WTA's spray detector is protocol-agnostic (it catches both Kerberos and NTLM failures), while RULE-032 below adds an NTLM-specific version of the same idea.

NTLM credential attacks

NTLM is where WTA's credential-attack coverage gets genuinely deep. NTLM authentication is common and mostly legitimate on almost every Windows network, which is exactly what makes attacks against it hard to spot: pass-the-hash, NTLM relay (Responder, ntlmrelayx, Inveigh), protocol downgrade to NTLMv1 or LM, and password spraying against the NTLM path specifically all show up in ordinary-looking logon telemetry unless you know precisely what to look for. Five rules cover this ground, all gated so they only ever fire on traffic that actually negotiated NTLM, never on NTLM authentication itself.

RULE-028 — Suspicious NTLM Authentication Scores content-level suspicion with no cross-event history required:

  • a blank workstation identity alongside a real source IP, common in relay tooling that can't supply a genuine workstation name
  • an anonymous/null-session-style logon target
  • a source IP that isn't private or local
  • a privileged-looking target account
  • a source IP already known bad from IOC data, which alerts on its own regardless of any other signal

RULE-029 — NTLM From Unexpected Source Host Tracks a running baseline of which sources normally authenticate to each destination host, and flags a source showing up against a destination for the first time, once that destination already has an established baseline to be unexpected against. A brand-new host's very first NTLM logon isn't treated as suspicious just because there's no history yet.

RULE-030 — NTLM Downgrade The one rule in this group willing to alert on a single event with no corroborating history: a live NTLMv1 or, worse, LM negotiation on a modern network is worth flagging by itself, since Windows only falls back to either when explicitly permitted by policy or actively coerced by a relay/MITM tool. Adds weight when the downgrade targets a privileged account or rides a failed authentication attempt.

RULE-031 — Unusual NTLM Source/Destination Relationship One source authenticating via NTLM to several distinct destinations in a short window, the pattern a stolen hash or relay session leaves when it's reused host-to-host, plus an independent signal for the same account authenticating from more than one distinct source, a harvested credential being replayed from several machines at once.

RULE-032 — Repeated NTLM Authentication Failures Fires alongside, not instead of, RULE-001. This is the NTLM-specific cut of the failure data: several failures against the same account from the same source (brute force), or failures spread thin across several different accounts from the same source (password spraying against the NTLM path specifically), a pattern that per-account brute-force counting alone can miss entirely, since no single account ever sees more than a failure or two.

Together, these five rules turn NTLM, historically one of the hardest protocols to monitor precisely because it's supposed to be everywhere, into one of WTA's better-instrumented detection surfaces for credential-relay and downgrade activity specifically.

Detection Engineering Files: Cyber Threat Analyzer


Welcome

Every alert a SOC analyst triages started somewhere — a rule someone wrote, tested, and shipped because a real attack technique needed a real answer. This blog is that story, one technique at a time.

Cyber Threat Analyzer (CTA) is a Windows-native detection and investigation platform, and this series walks through what it can catch and how it catches it — the event IDs, the logic, the MITRE ATT&CK mapping, and the reasoning behind each detection. If you're building detections of your own, triaging alerts for a living, or just curious what's actually watching your endpoints, this is written for you.

What CTA actually does

WTA isn't a single detection — it's a full pipeline, and each stage of that pipeline is its own detection surface:

  • 120+ built-in rules spanning credential access, lateral movement, persistence, defense evasion, and process injection, each mapped to a MITRE ATT&CK technique.
  • A behavioral rule engine that scores events instead of just matching them — a single suspicious event rarely triggers an alert on its own, but the right combination of signals does. Process ancestry, unusual DLL loads, and LSASS access attempts are all scored this way, not just flagged on sight.
  • Credential attack detection: DCSync, DCShadow (rogue domain controller detection), AS-REP roasting, NTLM relay and downgrade abuse, and account spraying across single and multiple hosts.
  • Lateral movement detection: admin share access, remote service creation, WMI/WinRM remote execution, and RDP host-hopping.
  • File Integrity Monitoring with real-time ransomware behavior detection — watching for the rate and pattern of file changes that separate an attacker's encryption routine from a backup job.
  • A continuous Registry Persistence Monitor, watching the keys attackers actually use to survive a reboot, as they're written — not on a scheduled sweep.
  • An on-demand Autoruns-style persistence sweep for the startup locations a live monitor alone won't catch retroactively.
  • A Network Threat Monitor, including LLMNR/NBT-NS poisoning detection at the packet level.
  • Sigma rule ingestion, so the community detection engineering ecosystem plugs directly into WTA instead of stopping at the door.
  • Kill-chain visualization and an investigation workspace that pulls the surrounding evidence — related events, process trees, network activity — around an alert automatically, so triage starts with context instead of a blank search bar.
  • Case management and PDF reporting to take an alert from "detected" to "documented," in the same place it was caught.
  • A central-server/agent architecture, for teams running this across more than one endpoint rather than one analyst on one machine.

That's the toolbox. Each entry in this series takes one piece of it — one technique, one rule, one detection — and shows the attack, the telemetry it leaves behind, and exactly how CTA turns that telemetry into an alert.

Who this is for

Detection engineers, SOC analysts, and anyone who'd rather understand why an alert fired than just acknowledge it and move on. Some entries will get technical — event IDs, field values, the actual scoring logic — because that's the level triage actually happens at.

New entries go up regularly. If there's a technique you want covered sooner, say so in the comments.

CTA is evolving very fast so stay tuned to this blog for updates and tutorials.

Hands-On with CTA ASM/EASM: Practical Techniques, Tips and Tricks for Effective Attack Surface Management

  A practical field guide for SOC analysts, security engineers, vulnerability managers, penetration testers, and cybersecurity consultants I...