CoCoineticBack to coinetic.io

Event ID 4740 and 4771: account lockouts and Kerberos failures

Event 4740 is Windows saying "A user account was locked out". Event 4771 says "Kerberos pre-authentication failed", usually a wrong password against a domain controller. Together they tell you who is locked out, from which computer, and whether it is an old password somewhere or someone guessing.

In short
  • Where: Security log of the domain controllers. 4740 is always on the PDC emulator, because every lockout is reported to it.
  • 4740: look at Account Name and Caller Computer Name: the computer the bad passwords came from.
  • 4771: look at Failure Code and Client Address. 0x18 = wrong password.
  • Most lockouts are an old password still saved somewhere: a mapped drive, a service, a scheduled task, a phone. Attacks come from many user names or from the internet.

1. Where to find the events

Both events are written by domain controllers into Event Viewer (eventvwr.msc) › Windows Logs › Security.

If you find nothing: 4740 needs the audit subcategory User Account Management (Success), 4771 needs Kerberos Authentication Service (Failure). Check with auditpol /get /category:* on a domain controller. The default domain controller policy normally has them on.

Recent lockouts, with the computer they came from (as administrator, with the ActiveDirectory module):

$pdc = (Get-ADDomain).PDCEmulator
Get-WinEvent -ComputerName $pdc -FilterHashtable @{LogName='Security'; Id=4740} -MaxEvents 50 |
  Select-Object TimeCreated, @{n='User';e={$_.Properties[0].Value}}, @{n='CallerComputer';e={$_.Properties[1].Value}}

In the event's data the Caller Computer Name is stored in the field named TargetDomainName (the second value), which is why Properties[1] is the computer and not the domain.

2. Reading Event 4740: who was locked out, and from where

FieldWhat it tells you
Account That Was Locked Out › Account NameThe user who can no longer log on.
Caller Computer NameThe computer that sent the bad passwords. This is where you look next.
SubjectUsually the domain controller's own computer account. Not the culprit.

The Caller Computer Name is the computer that passed the logon on. If it is your Exchange Server, a web Server or an RDP gateway, the real source is behind it: a phone with the old password (ActiveSync), a browser, a remote client. Then look in that Server's own logs (IIS logs, Event 4625) for the client address. If the field is empty, the request often came from a device or service that does not send a computer name; use the 4771 events at the same time instead.

3. Reading Event 4771: why Kerberos refused

The fields that matter are Account Name, Client Address and Failure Code. The Client Address is often written as ::ffff:10.0.1.25: that is just an IPv4 address in IPv6 notation, so the computer is 10.0.1.25.

Failure CodeMeaningWhat it usually is
0x18Pre-authentication failed: wrong passwordThe classic. A typo, an old saved password, or guessing. Repeated 0x18 from one address is what leads to a 4740.
0x12Client credentials revoked: account disabled, expired, locked out or outside logon hoursAfter a lockout, every further try shows 0x12. A stream of them means the source is still trying.
0x17Password has expiredA user or a service account whose password ran out. Not an attack.
0x25Clock skew too greatThe client's clock is more than 5 minutes off (the default). Fix the time sync, not the password.

Kerberos failures for a user name that does not exist at all are usually logged as Event 4768 (failure code 0x6), not 4771. Many 4768 / 0x6 events with changing names are a sign of someone trying user names.

Count the wrong passwords per user and address over the last day (on a domain controller):

Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4771; StartTime=(Get-Date).AddDays(-1)} |
  ForEach-Object { $d = @{}; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
  Where-Object Status -eq '0x18' | Group-Object TargetUserName, IpAddress | Sort-Object Count -Descending | Select-Object -First 15 Count, Name

4. Finding the source of repeated lockouts

Once you know the Caller Computer Name or the client address, look on that computer for anything still using the old password:

Microsoft's older Account Lockout and Management Tools (LockoutStatus.exe) show the bad password count per domain controller, if you prefer a window to PowerShell.

5. Stale password or attack?

6. Stop it for good: Coinetic reads the failures and blocks the attackers

Doing this by hand means: pulling 4740 and 4771 events from every domain controller, decoding failure codes, mapping ::ffff: addresses to computers, and again for every new lockout. Against attacks from the internet, Windows itself only counts and locks; it does not block the address, so the guessing goes on, and every lockout lands on your helpdesk.

Coinetic takes the attack side off your hands, on every Windows Server and PC:

Honest limit: addresses from your own network are shown, but never banned. That is on purpose: a PC with an old saved password must not cut itself off. So the internal lockouts from section 4 still have to be fixed at their source by you; Coinetic shows you the address and the user name to start with.

Protect this Server or PC in 5 minutes

Download Coinetic, install, done: it starts protecting at once. 30 days free with all features, no payment details. From $20 per computer per year.

Start the free 30-day trial →

More guides: all Coinetic guides.

Frequently asked

Why do I see Event 4740 only on one domain controller?

The lockout is written by the domain controller that locked the account and by the PDC emulator. Search the PDC emulator and you see every lockout of the domain in one place.

What does Event 4771 failure code 0x18 mean?

Kerberos pre-authentication failed because the password was wrong. A few are typos; a steady stream from one computer is an old saved password; many user names or many addresses point to guessing.

The Caller Computer Name is my Exchange Server. Is Exchange the problem?

Usually not. Exchange passed on a logon from a phone, Outlook or a browser. Look for the user's devices with the old password, or in the IIS logs on the Exchange Server for the client address.

Why does the Client Address start with ::ffff:?

It is an IPv4 address written in IPv6 form. ::ffff:192.168.1.20 is simply 192.168.1.20.