Event ID 4740
Event ID 4740: Account Locked Out
A user account was locked out
- Log source
- Security
- How to enable it
- Account Management > Audit User Account Management (Success)
- Category
- Account Management
- Priority
- Medium
- Typical volume
- Medium
- MITRE ATT&CK
What Event ID 4740 means
4740 is logged when an account reaches the lockout threshold. For domain accounts, look on the domain controller that holds the PDC emulator role, since it processes every lockout whichever controller saw the bad passwords.
Its most useful value sits in an unexpected place. The caller computer, which tells you where the wrong passwords came from, is stored in the XML field TargetDomainName, although the rendered message labels it Caller Computer Name. Queries that assume the field holds a domain get nonsense.
Most lockouts are stale passwords. Attack-driven ones look different in aggregate: several unrelated users within minutes, or privileged and service accounts that nobody types by hand. Single accounts that lock again after each unlock point at a device with an old password.
Key fields to inspect
| Field | Meaning | Suspicious when |
|---|---|---|
TargetUserName | Account that was locked. | Administrators, service accounts, or many users in the same minutes. |
TargetDomainName | Caller computer name, despite its label in the XML. | Empty or unfamiliar, which is common for attacks through mail or web front ends. |
TargetSid | Security identifier of the account. | RID 500, if administrator lockout is enabled by policy. |
SubjectUserName | Domain controller that recorded the lockout. | Normally a computer account ending in $. |
SubjectDomainName | Domain of that controller. | Not useful for triage. |
Detection queries
Find callers that lock several accounts within fifteen minutes. Adjust names and thresholds to your environment. About these queries.
Splunk SPL
index=windows source="XmlWinEventLog:Security" EventCode=4740
| rename TargetDomainName AS caller
| bin _time span=15m
| stats dc(TargetUserName) AS locked values(TargetUserName) AS users BY _time caller
| where locked>=3 Microsoft Sentinel KQL
SecurityEvent
| where EventID == 4740
| extend Caller = TargetDomainName
| summarize Locked = dcount(TargetUserName), Users = make_set(TargetUserName, 50) by Caller, bin(TimeGenerated, 15m)
| where Locked >= 3 PowerShell
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4740; StartTime = (Get-Date).AddDays(-2) } |
ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
Select-Object Time, TargetUserName, TargetDomainName, SubjectUserName | Format-Table -AutoSize Attack scenarios
Careless password spray
An attacker who misjudges the lockout threshold locks dozens of accounts. The caller is the server whose service was attacked, such as a mail or VPN front end, and its own logs hold the external address.
Brute force on one account
Repeated lockouts of an administrator from one workstation show guessing from inside. Check that host for tools before you assume that the user forgot the password.
Deliberate denial of access
Anyone who can list user names can lock accounts on purpose. Many lockouts with no success anywhere may be disruption or a distraction.
Investigation checklist
- Read TargetDomainName to get the caller computer.
- On the caller, look for 4625 and 4648 at the same time to find the process or remote address.
- If the caller is a mail, VPN or web server, read its logs for the client address.
- On domain controllers, gather 4771 (0x18) and 4776 (0xC000006A) for the account.
- For repeat lockouts, check scheduled tasks, services, mapped drives and phones.
Common benign causes
- Phones and mail clients with an old password after a change.
- Services and scheduled tasks that run as a user.
- Disconnected Remote Desktop sessions with cached credentials.
Event ID 4740 FAQ
Where do I find the source of an account lockout?
Open 4740 on the PDC emulator and read Caller Computer Name, which is TargetDomainName in the XML. Then examine that computer's 4625 events for the same account and time.
Why is Caller Computer Name blank?
The authentication reached the domain controller without a client name, which happens with some NTLM and non-Windows clients. Use 4776, 4771 and NTLM operational logs to trace the path.
Is event 4740 logged on every domain controller?
It is logged on the controller that processed the lockout and on the PDC emulator, to which bad passwords are forwarded. Querying the PDC emulator is enough in most domains.