How the attack works
A group managed service account (gMSA) has no password that an administrator sets. A domain controller computes the current password whenever an authorized host asks for it, from attributes of the account and from a root key of the Microsoft Key Distribution Service (KDS). The root keys are objects of class msKds-ProvRootKey in the container CN=Master Root Keys,CN=Group Key Distribution Service,CN=Services,CN=Configuration of the forest, and the key material is in their msKds-RootKeyData attribute.
The default access control list of a root key object lets only Enterprise Admins, Domain Admins and SYSTEM in. An attacker who has reached that level reads the root key once and takes it away. Together with the SID and the msDS-ManagedPasswordId attribute of a gMSA, the key is enough to compute the password of that account on the attacker's own machine, now and after every later rotation, without another request to a domain controller. The technique is known as the Golden gMSA attack, by analogy with the Golden Ticket. Rotating the password of a gMSA does not help, because the next password is computed from the same root key.
The read is an ordinary directory query by a privileged account and looks like administration. Microsoft therefore suggests an audit entry (SACL) on the Master Root Keys container that records successful reads of msKds-RootKeyData. With it, the domain controller logs each read in event 4662, with the class GUID of msKds-ProvRootKey as the object type. Domain controllers use the root key under their own computer accounts, so the signal is an access by any other account. As Microsoft notes, this auditing sees only an online read. A key taken from a backup or from a copy of the directory database leaves no such event.
What an attacker needs
- Read access to the KDS root key objects, by default Enterprise Admins, Domain Admins or SYSTEM on a domain controller. The attack is a way to keep and widen access after such a compromise, not a way in.
- The SID and the
msDS-ManagedPasswordIdattribute of each gMSA whose password is to be computed.
Impact
The attacker can compute the password of every gMSA that derives from the stolen key, for as long as that key is in use. gMSAs commonly run directory synchronization, federation, database and monitoring services, some of them with Tier 0 rights. The access does not depend on any account the defender can reset. Recovery means creating a new root key and moving or re-creating the gMSAs, which Microsoft documents as a separate procedure.
Detection rules
KDS Root Key Object Accessed by a Non-Computer Account
Detects event 4662 on an object of class msKds-ProvRootKey (schemaIDGUID aa02fd41-17e0-4f18-8687-b2239649736b), a root key of the Key Distribution Service, by an account whose name does not end in $. Group managed service account passwords are computed from that key, so a copy of its msKds-RootKeyData attribute (schemaIDGUID 26627c27-08a2-0a40-a1b1-8dce85b42993, listed in Properties when it is read) lets the holder compute them offline. Domain controllers use the key under their own computer accounts, which the filter excludes. A read made with a computer account, and a key taken from a backup or a copy of the directory database, are therefore not detected. Requires the audit subcategory Audit Directory Service Access and the audit entry (SACL) Microsoft describes on the Master Root Keys container for successful reads of msKds-RootKeyData.
title: KDS Root Key Object Accessed by a Non-Computer Account
id: 2b596388-47d2-415d-abb8-092449d056e2
status: experimental
description: >-
Detects event 4662 on an object of class msKds-ProvRootKey (schemaIDGUID
aa02fd41-17e0-4f18-8687-b2239649736b), a root key of the Key Distribution
Service, by an account whose name does not end in $. Group managed service
account passwords are computed from that key, so a copy of its
msKds-RootKeyData attribute (schemaIDGUID
26627c27-08a2-0a40-a1b1-8dce85b42993, listed in Properties when it is read)
lets the holder compute them offline. Domain controllers use the key under
their own computer accounts, which the filter excludes. A read made with a
computer account, and a key taken from a backup or a copy of the directory
database, are therefore not detected. Requires the audit subcategory Audit
Directory Service Access and the audit entry (SACL) Microsoft describes on
the Master Root Keys container for successful reads of msKds-RootKeyData.
references:
- https://attack.mitre.org/techniques/T1555/
- https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/recover-from-golden-gmsa-attack
- https://learn.microsoft.com/en-us/windows/win32/adschema/c-mskds-provrootkey
- https://learn.microsoft.com/en-us/windows/win32/adschema/a-mskds-rootkeydata
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4662
author: Forestall
date: 2026-11-14
tags:
- attack.credential-access
- attack.t1555
logsource:
product: windows
service: security
detection:
selection:
EventID: 4662
ObjectType|contains: 'aa02fd41-17e0-4f18-8687-b2239649736b'
filter_computer_accounts:
SubjectUserName|endswith: '$'
condition: selection and not 1 of filter_*
falsepositives:
- Administrators who list or create KDS root keys, for example before deploying a group managed service account, and directory tools that browse the configuration partition with an administrator account. Match the event to a change record. Do not exclude administrator accounts as a group.
- Backup, assessment and identity security products that read the configuration partition with a service account. Exclude that account by exact SubjectUserName.
level: high
False positives
- Administrators who list or create KDS root keys, for example before deploying a group managed service account, and directory tools that browse the configuration partition with an administrator account. Match the event to a change record. Do not exclude administrator accounts as a group.
- Backup, assessment and identity security products that read the configuration partition with a service account. Exclude that account by exact SubjectUserName.
Triage
- Identify the reader (SubjectUserName, SubjectLogonId) and find the matching logon (4624) and its source address. An administrator account that reads the key from a workstation or member server needs an explanation.
- Ask whether an administrator was working with root keys at that time, for example listing them before creating a gMSA, or running a backup or assessment tool that reads the configuration partition.
- Check what else the account did in the same session. Reads of gMSA objects shortly before or after strengthen the case.
- Without a benign explanation assume the attacker knows the root key. List the gMSAs, rank them by privilege, and plan Microsoft's recovery procedure. Look for sign-ins of gMSAs from hosts that do not run their service.
Response
Once the attack is confirmed:
- Disable or reset the account that read the root key, end its sessions and isolate the computer the read came from. The account had Enterprise Admins or Domain Admins level access, so handle it as a compromised Tier 0 identity.
- Reduce the rights of the most privileged gMSAs to what their services need while the recovery is prepared. Rotating a gMSA password does not lock the attacker out, because the next password comes from the same root key.
- Create a new KDS root key and restart the Microsoft Key Distribution Service on all domain controllers, as Microsoft's recovery article describes. Plan for the waiting time before a new root key is usable, which the article gives as 10 hours in production.
- Choose the scenario of that article that fits. If you do not know what was exposed and when, replace every gMSA that used the old key with a new one and update the services that use them. Microsoft suggests applying the procedure to all domains of the forest.
- Verify that each gMSA now derives from the new key, which the article shows how to read from msDS-ManagedPasswordId, then delete the old root key object and confirm replication.
- Review what the gMSAs did since the read, such as directory changes and synchronization or federation activity, and undo changes that no service owner can explain.
Mitigation
- Treat the KDS root keys as Tier 0 secrets, on a level with the krbtgt key. Keep Enterprise Admins and Domain Admins small, and protect domain controller backups and virtual disks, which contain the keys.
- Do not grant access to the Group Key Distribution Service container beyond the defaults, and review its access control list for added entries.
- Add the audit entry (SACL) Microsoft describes on the Master Root Keys container for successful reads of msKds-RootKeyData on msKds-ProvRootKey objects, and enable the audit subcategory Audit Directory Service Access on domain controllers.
- Give each gMSA only the rights its service needs. A gMSA with domain-wide rights turns a stolen root key into a standing path to the domain.
- After a confirmed theft follow Microsoft's recovery procedure for a Golden gMSA attack, which creates a new root key and moves the gMSAs to it.
Frequently asked questions
Why does rotating a gMSA password not remove the attacker after the KDS root key was read?
Every gMSA password is computed from attributes of the account and from the root key. An attacker who holds the key computes the next password the same way a domain controller does, without contacting one. Access ends only when the gMSAs move to a new root key that the attacker does not know, which is what Microsoft's recovery procedure achieves.
Which reads of the KDS root key does this rule not see?
It does not see a read made with a computer account, because domain controllers use the key under their own accounts and the filter excludes names that end in $. It also cannot see a key taken from a backup or from a copy of the directory database, since the auditing records only an online read. After a domain controller compromise, a missing alert is therefore no proof that the key is safe.
What has to be configured before a domain controller logs event 4662 for the root key?
Two settings are needed. The audit subcategory Audit Directory Service Access must be enabled on domain controllers, and the Master Root Keys container needs the audit entry (SACL) Microsoft describes for successful reads of msKds-RootKeyData. Without that audit entry the read leaves no event, even when the subcategory is enabled.
Can an administrator read the root key for a legitimate reason?
Yes. Listing the root keys before a gMSA is created produces the same event, and so do backup, assessment and identity security tools that browse the configuration partition. Match each event to a change record or to a known service account. Exclude such a service account by its exact name and do not exclude administrator accounts as a group.
References
- MITRE ATT&CK T1555: Credentials from Password Stores
- How to recover from a Golden gMSA attack (includes the auditing recommendation)
- Create a Key Distribution Service (KDS) root key
- Group Managed Service Accounts overview
- ms-Kds-Prov-RootKey class
- ms-Kds-RootKeyData attribute
- Event 4662: An operation was performed on an object