1. Resources
  2. Detection sources
  3. Event ID 21

Event ID 21: The client certificate for the user is not valid, and resulted in a failed smartcard logon

Written by the KDC on a domain controller when it refuses the client certificate of a certificate sign-in. A generic, older event; since KB5057784 Enforcement mode also logs it for a certificate outside the NTAuth store.

Log source
Windows System log
Detection value
Supporting
Volume
Low (estimate)
Last updated
Log
System log (Microsoft-Windows-Kerberos-Key-Distribution-Center, on by default)
Logged on
Domain controllers only
Event versions
0
Detects
1 attack (1 rule)
MITRE ATT&CK
1 technique in 1 tactic
Threat groups
2 groups that MITRE ATT&CK records using these techniques
Fields the rules read
The event ID and the provider only

When it is written

A domain controller writes 21 when its Key Distribution Center (KDC) does not accept the client certificate of a certificate sign-in (PKINIT), such as a smart card, Windows Hello for Business or computer public key sign-in, and the sign-in fails. The event names the account (Domain and Username) and gives the chain status (Status), the result of validating the certificate. Microsoft calls it a generic, legacy event that can be logged for several reasons, and gives no list of them; KB5057784 names it the AS-REQ Failure Event.

One of those reasons is the NTAuth check of the protections for CVE-2025-26647 (KB5057784). In Enforcement mode, a domain controller with the updates released on or after April 8, 2025 refuses a valid certificate that does not chain to a CA in the NTAuth store and writes 21, with a chain status saying that a CA certificate is not trusted by the policy provider. In Audit mode the same sign-in succeeds and the KDC writes event 45 instead. Enforcement is the default from the July 2025 updates.

Only the domain controller that handled the sign-in writes the event: collect the System log of every domain controller. Member servers and workstations can show a different event 21, from the Kerberos client (source Security-Kerberos), written when they validate the PAC of an inbound ticket: filter on the provider.

How to turn it on

Microsoft-Windows-Kerberos-Key-Distribution-Center writes the event to the System log (Event Viewer > Windows Logs > System), which is on by default. Microsoft

Event 21 is on by default. Microsoft lists it under the KdcExtraLogLevel value (HKLM\SYSTEM\CurrentControlSet\Services\Kdc): the flag 2 logs PKINIT errors as KDC warning event 21, and 2 is the value's default. Read it with reg query HKLM\SYSTEM\CurrentControlSet\Services\Kdc /v KdcExtraLogLevel; when the value is absent the default applies. The same value carries flags 1 and 16 for failed 4769 events, so a value set for those must still include 2.

For the NTAuth check the domain controller also needs the updates released on or after April 8, 2025 and Enforcement mode: AllowNtAuthPolicyBypass 2 in the same key, the default from the July 2025 updates (see event 45). Microsoft ends support for that registry value with the updates released in or after October 2025: from then on, certificates used for sign-in must be issued by a CA in the NTAuth store.

Fields

In Event Viewer order. The field names are those of the event XML, from the event template of Windows Server 2025 (build 26100.32230, January 13, 2026): the provider belongs to a server role, so the template comes from the provider manifests that the EVTX-ETW-Resources project exported from that release.

FieldWhat it holdsSince
DomainDomain of the account whose certificate was refused: the part before the backslash in the event text, which KB5057784 prints as <Domain\UserName>.v0
UsernameName of that account, the part after the backslash. Microsoft notes that it is the security principal that started the Kerberos authentication: a user account, including Windows Hello for Business sign-ins, or a computer account (a name ending with $) for a machine sign-in with a public key.v0
The chain status wasStatusChain status: the result of validating the certificate, as text, shown after "The chain status was". The one value Microsoft documents is the NTAuth case, that a certification chain processed correctly but one of the CA certificates is not trusted by the policy provider. The template has no field for the certificate's subject, issuer, serial number or thumbprint: event 45 lists them, and the 4768 of a successful certificate sign-in records the issuer, serial number and thumbprint.v0
Binary dataBinaryBinary data Windows attaches to the event (the template ends with a binary element). Microsoft does not document what it holds for this event.v0

Values to know

The chain status was Status

ValueMeaningSignal
A certification chain processed correctly, but one of the CA certificates is not trusted by the policy provider.The chain is valid but does not reach the NTAuth store (the case Microsoft documents)In Enforcement mode of the CVE-2025-26647 protections, a refused sign-in with a certificate from a CA not approved for sign-in. Check first whether the account signs in with Windows Hello for Business key trust or is a computer, the subject of Microsoft's known issue.Attack signal
Any other chain statusAnother certificate problemThe event is generic. Read the status and pass it to the team that runs the PKI.Failure

Username

ValueMeaningSignal
Ends with $A computer accountMicrosoft says a computer account means a machine sign-in with a public key (PKINIT).Worth knowing
A privileged accountA member of an administrative group such as Domain AdminsA refused certificate sign-in for such an account deserves a look at its explicit certificate mappings and at who holds the certificate.Attack signal

Volume and noise

Microsoft states no volume. Every refused certificate sign-in can produce one, so the rate follows the health of your certificate sign-ins. Microsoft's smart card guidance names certificate problems that make a domain controller refuse a sign-in, among them an expired or revoked certificate, a revocation list that cannot be checked and an issuing CA missing from the NTAuth store; it does not say which of them log event 21. After the April 2025 updates Microsoft also documented a known issue with events 45 and 21 for Windows Hello for Business key trust and computer sign-ins with self-signed certificates.

Keeping it manageable

  • Keep every event from every domain controller: the volume follows refused certificate sign-ins, and the rule for certificates outside the NTAuth store reads the event ID and the provider alone.
  • Alert on the chain status Microsoft documents for the NTAuth check (a CA certificate not trusted by the policy provider) in Status, and report other chain statuses to the team that runs the PKI.
  • Filter on the provider as well as the ID, so that the Kerberos client's own event 21 on member servers does not mix in. As an XPath query of an Azure Monitor data collection rule, which puts the log name and ! first (a Windows Event Forwarding subscription takes the expression after the ! in a Select of that log): System!*[System[Provider[@Name='Microsoft-Windows-Kerberos-Key-Distribution-Center'] and (EventID=21 or EventID=45)]].
  • When you change KdcExtraLogLevel for other KDC logging, keep the PKINIT flag 2 in the value, or event 21 stops.

Sample event

Version 0, with made-up values.

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-Kerberos-Key-Distribution-Center" Guid="{3FD9DA1A-5A54-46C5-9A26-9BD7C0685056}" EventSourceName="KDC" />
    <EventID Qualifiers="32768">21</EventID>
    <Version>0</Version>
    <Level>3</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2026-11-18T09:30:12.4567890Z" />
    <EventRecordID>1048576</EventRecordID>
    <Correlation />
    <Execution ProcessID="712" ThreadID="2408" />
    <Channel>System</Channel>
    <Computer>DC01.corp.example.com</Computer>
    <Security />
  </System>
  <EventData>
    <Data Name="Domain">CORP</Data>
    <Data Name="Username">alice</Data>
    <Data Name="Status">A certification chain processed correctly, but one of the CA certificates is not trusted by the policy provider.</Data>
  </EventData>
</Event>

Attacks this event reveals

Detection rules that read this event:

Frequently asked questions

Why does event 21 appear when all our sign-in CAs are in the NTAuth store?

Microsoft describes 21 as a generic, legacy event that can be logged for several reasons; a chain that does not reach the NTAuth store is only one of them. Read the chain status in the event. Revoked or expired certificates and revocation lists that cannot be checked also make a domain controller refuse a certificate sign-in.

Is this the same event 21 that appears on member servers?

No. This one comes from the Kerberos Key Distribution Center on domain controllers. Since the April 2024 updates the Kerberos client (source Security-Kerberos) writes its own informational event 21 on computers that validate the PAC of inbound tickets, about actions a domain controller took on the ticket, such as filtering SIDs. Filter on the provider.

How do I make sure event 21 is logged?

It is on by default. Microsoft ties it to the PKINIT flag 2 of the KdcExtraLogLevel registry value on the domain controller, whose default is 2. If someone set the value for other KDC logging, check that 2 is still part of it.

Which certificate does event 21 refer to?

The event names the account and the chain status only; its template has no field for the certificate's subject, issuer, serial number or thumbprint. In Audit mode event 45 lists them, and on a successful certificate sign-in event 4768 records the issuer, serial number and thumbprint.

References