Event ID 4740 Windows Security log

Event ID 4740: A User Account Was Locked Out — Finding the Source

Published

An account was locked out — the event names the account and the computer the attempts came from, but not the IP, the logon type or the reason, so the preceding failure events carry the real story.

Logged on: For user accounts, Microsoft states the event generates on domain controllers, member servers, and workstations.

Microsoft's title

4740(S): A user account was locked out.

Source: Microsoft's event 4740 documentation · field names checked against it on every build

Fields that matter in an investigation

FieldXML / SentinelWhat it tells you
Security ID TargetSid Under "Account That Was Locked Out" — the SID of the account that was locked out, and the identifier Microsoft''s monitoring recommendations are built around for high-value accounts.
Account Name TargetUserName Under "Account That Was Locked Out" — the name of the account that was locked out; this is the identity whose authentication failures you go and read.
Account Domain TargetDomainName Domain or computer name for the account; for local accounts it holds the name of the computer the account belongs to. In Microsoft''s sample XML this field carries "WIN81", the same value used as the Caller Computer Name example, so confirm what your own data puts here before treating it as a domain.
Caller Computer Name "the name of computer account from which logon attempt was received and after which target account was locked out" — the machine to pivot to, and the field Microsoft's alerting recommendations key on.
Security ID SubjectUserSid Under "Subject" — SID of the account that performed the lockout operation. Microsoft recommends reporting the event whenever this is not SYSTEM, because the lockout is normally applied by the system.
Account Name SubjectUserName Under "Subject" — the name of the account that performed the lockout operation; in Microsoft''s sample this is the domain controller''s own computer account, DC01$.
Account Domain SubjectDomainName Domain or computer name for the subject account; well-known principals such as LOCAL SERVICE or ANONYMOUS LOGON show "NT AUTHORITY".
Logon ID SubjectLogonId Hexadecimal value that can correlate this event with recent events containing the same Logon ID, for example 4624 — the session of whoever or whatever performed the lockout operation.

What it records

Event 4740 is the audit record Windows writes when the account lockout policy trips: “This event generates every time a user account is locked out.” It belongs to the Audit User Account Management subcategory, and Microsoft states that for user accounts it generates on domain controllers, member servers, and workstations — so domain account lockouts land on the DCs, and local account lockouts on the machine that owns the account.

The record has three parts. Subject is the account that performed the lockout operation, with its Security ID, Account Name, Account Domain and Logon ID; the Logon ID is the hexadecimal value Microsoft describes as correlating this event with recent events that contain the same value, such as 4624. In Microsoft’s own sample XML the Subject SID is S-1-5-18 and the Subject name is DC01$, which is why the monitoring guidance treats anything other than SYSTEM here as worth reporting.

Account That Was Locked Out carries the Security ID and Account Name of the victim — the SID being the value Microsoft’s recommendations tell you to watch for high-value accounts such as domain administrators.

Additional Information holds the single most useful pivot in the event: Caller Computer Name, “the name of computer account from which logon attempt was received and after which target account was locked out.”

What 4740 does not contain matters just as much. There is no IP address, no logon type, no sub status code and no count of failed attempts — the record says only that the threshold in your account lockout policy was reached. The reason lives in the authentication failures that preceded it.

When it matters

PatternReading
One lockout, one account, user calls the service deskMistyped or newly changed password
Same account locked repeatedly at regular intervals from one Caller Computer NameCredential cached in a service, task, mapped drive or mail client on that host
Many different accounts locked inside a short windowA spray or brute-force run that pushed past the threshold — see 0xC0000234
Caller Computer Name not from your domainMicrosoft recommends monitoring for all 4740 events where this is the case
Caller Computer Name is a machine the account should never authenticate fromMicrosoft’s guidance is to trigger an alert on exactly this
Subject\Security ID is not SYSTEMMicrosoft recommends reporting it — the lockout was not applied by the system
Lockout of a domain administrator or other high-value accountMicrosoft recommends monitoring every lockout for those SIDs

Lockouts cut both ways. They can be the collateral damage of password guessing against real accounts, which is the 0xC000006A and Kerberos 0x18 shape, or they can be the goal — deliberately locking out accounts to deny access. A wave of 4740s across unrelated accounts deserves the same urgency either way.

How to investigate

Start with every lockout in the window and who or what applied it:

SecurityEvent
| where TimeGenerated > ago(24h)
| where EventID == 4740
| project TimeGenerated, Computer, LockedOutAccount = TargetUserName, TargetUserSid,
          AccountDomainField = TargetDomainName, SubjectUserName, SubjectUserSid, SubjectLogonId
| order by TimeGenerated desc

Separate the one-off from the recurring, because repeat lockouts on one account are a different investigation from one lockout on many accounts:

SecurityEvent
| where TimeGenerated > ago(7d)
| where EventID == 4740
| summarize Lockouts = count(), DCs = make_set(Computer, 10), Callers = make_set(TargetDomainName, 10),
            First = min(TimeGenerated), Last = max(TimeGenerated)
    by TargetUserName
| order by Lockouts desc

Then get what 4740 withholds — the source address and the failure reason — by joining each lockout to the failures that preceded it:

let lockouts = SecurityEvent
    | where TimeGenerated > ago(24h) and EventID == 4740
    | project LockTime = TimeGenerated, TargetUserName, LockedOnDC = Computer;
SecurityEvent
| where TimeGenerated > ago(25h) and EventID == 4625
| join kind=inner lockouts on TargetUserName
| where TimeGenerated between (LockTime - 30m .. LockTime)
| summarize Failures = count(), SubStatuses = make_set(SubStatus, 5), Sources = make_set(IpAddress, 10),
            Workstations = make_set(WorkstationName, 10), LogonTypes = make_set(LogonType, 5)
    by TargetUserName, LockTime, LockedOnDC
| order by LockTime desc

For Kerberos clients the failures appear as 4771 instead, where Status carries the Kerberos code and IpAddress arrives with an ::ffff: prefix:

SecurityEvent
| where TimeGenerated > ago(24h)
| where EventID == 4771 and Status =~ "0x18"
| extend SourceIp = replace_string(IpAddress, "::ffff:", "")
| summarize Failures = count(), DCs = make_set(Computer, 5), Services = make_set(ServiceName, 5)
    by TargetUserName, SourceIp
| order by Failures desc

Finally, surface the lockouts Microsoft flags as abnormal — anything the system did not apply:

SecurityEvent
| where TimeGenerated > ago(30d)
| where EventID == 4740
| where SubjectUserSid != "S-1-5-18"
| project TimeGenerated, Computer, TargetUserName, TargetUserSid, SubjectUserName, SubjectUserSid, SubjectLogonId
| order by TimeGenerated desc

From there, pivot on the Caller Computer Name and work that host; check 4776 Error Codes on the DC for NTLM validation attempts; use the Subject Logon ID to find the matching 4624 if a session performed the operation; and watch for 4767 (account unlocked) followed by a 4624 success, which means the account is live again and you need to know who used it. If the failures that caused the lockout cross many accounts from one source, work it as a spray — the Windows 4625 password-spray rule groups failures that way. With no SIEM to hand, export the Security log as XML from Event Viewer and load it into the free browser log analyzer.

Related events and codes

  • Event ID 4624 An account was successfully logged on.
  • Event ID 4625 An account failed to log on.
  • Event ID 4767 A user account was unlocked.
  • Event ID 4771 Kerberos pre-authentication failed.
  • Event ID 4776 The computer attempted to validate the credentials for an account.
  • Event ID 4723 An attempt was made to change an account's password.
  • Event ID 4724 An attempt was made to reset an account's password.
  • Event ID 4738 A user account was changed.
  • 0xC0000234 The account is locked because the lockout threshold was reached; every further attempt fails with this code until the lockout ends or an administrator unlocks it.
  • 0xC000006A The account exists and the password was wrong. One event is a typo; many against one account is brute force; one source failing across many real accounts is password spraying.
  • 0xC0000064 Someone tried to log on with an account name that does not exist. Occasional typos are normal; bursts of invented names from one source are username guessing or spraying with a generic list.
  • 0x18 The domain controller rejected the pre-authentication data sent with a ticket request — Microsoft's listed cause is that the wrong password was provided; repeated 0x18 events for one account are a brute-force indicator.
  • 0x12 The domain controller refused the ticket request because the account itself is barred from logging on — Microsoft's examples are an account that is disabled, expired or locked out — rather than because of anything about the password.

Detect it

MITRE ATT&CK: T1110T1110.001T1110.003T1531

Frequently Asked Questions

Does 4740 tell me the IP address the bad passwords came from?
No. Microsoft is explicit that "even if the computer is not in your domain you will get the computer name instead of an IP address in the 4740 event". The only source hint in the record is Caller Computer Name, so for an address you have to read the 4625, 4771 or 4776 failures logged in the minutes before the lockout.
Which machine should I search for the 4740?
Microsoft states that for user accounts the event generates on domain controllers, member servers and workstations. A domain account lockout is recorded by domain controllers, so search across all of them; a local account lockout is recorded by the computer that owns the account, where Account Domain holds that computer's name.
Why is the Subject of the lockout the domain controller's own computer account?
The Subject fields name the account that performed the lockout operation, and that is normally the system applying the account lockout policy — Microsoft's sample XML shows SubjectUserSid S-1-5-18 with SubjectUserName DC01$. Because of that, Microsoft recommends reporting the event whenever Subject\Security ID is not SYSTEM.
An account locks out every few minutes with no user at the keyboard — what now?
Take the Caller Computer Name and work on that host. Repeated lockouts at regular intervals with wrong-password failures from one machine usually come from a credential stored somewhere after a password change — a service, scheduled task, mapped drive or mail client. Confirm by matching the 4625 Sub Status 0xC000006A timestamps against the lockout times before treating it as an attack.

Find every 4740 in your own logs

Load a Windows Security event export into the free browser analyzer to group events by account, source address and status, with password spraying, brute force and lockout storms flagged. Nothing is uploaded.