How it works
A group managed service account has no stored password. When an authorized host asks for it, a writable domain controller computes the value on the spot. The computation takes three inputs:
- The KDS root key, the secret of the Microsoft Key Distribution Service. Root keys are objects of class
msKds-ProvRootKeyinCN=Master Root Keys,CN=Group Key Distribution Service,CN=Services,CN=Configuration,<forest root>. The key material is inmsKds-RootKeyData, next to the parameters of the key derivation and key agreement algorithms. - The gMSA's SID.
- The gMSA's
msDS-ManagedPasswordId, a binary value that names the root key in use and the time period of the current password.
From these the domain controller derives a time-dependent key and from that the password. Nothing else is secret. The SID is public, and msDS-ManagedPasswordId is readable by domain users with a plain LDAP query. So anyone who holds the root key can run the same derivation offline and gets the same password the domain controller would hand to an authorized host. The researcher who published the technique, Yuval Gordon, named it Golden gMSA by analogy with the Golden Ticket: one stolen secret replaces the directory's own authority.
Three properties make it serious:
- It bypasses the retrieval list. The ordinary gMSA password read works only for principals in
PrincipalsAllowedToRetrieveManagedPassword. The computation does not ask the domain controller for anything. - It does not expire. The gMSA password rotates, but the root key behind it does not, and Windows has no operation that changes the secret of an existing root key. Every future password of the account derives from the same key.
- It is forest-wide. The root keys are in the configuration partition, which every domain controller of the forest holds. Control of one domain's controller exposes the keys behind the gMSAs of all domains.
The root key can be taken in two ways: online, by reading the objects over LDAP with sufficient rights, or offline, from a copy of ntds.dit obtained through a backup, a virtual disk or NTDS.dit extraction.
KDS root keys protect more than gMSAs. The DSInternals documentation lists delegated managed service account passwords, Windows LAPS encrypted passwords, DNSSEC signing keys and other secrets protected with DPAPI-NG to a SID among the data that depends on them.
Prerequisites
- Read access to the root key objects: by default Enterprise Admins, Domain Admins of the forest root, or SYSTEM on a domain controller (including a child domain's controller). Or a copy of a domain controller's database.
- The SID and
msDS-ManagedPasswordIdof each target gMSA, which a low-privileged domain account can read. - For use of the result: network access to the services where the gMSA has rights.
The attack is not a way in. It converts a one-time compromise of Tier 0 into access that survives the cleanup.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
The commands use GoldenGMSA, the tool published with the research.
1. List the gMSAs and their password identifiers
This step needs no special rights. The output gives each account's name, SID, the root key it uses and the Base64 msDS-ManagedPasswordId value.
GoldenGMSA.exe gmsainfo
GoldenGMSA.exe gmsainfo --sid S-1-5-21-1111111111-2222222222-3333333333-1112
GoldenGMSA.exe gmsainfo --domain corp.example.com
2. Dump the KDS root keys
Run as Enterprise Admin or Domain Admin of the forest root, or as SYSTEM on a root domain controller. The output is one Base64 blob per root key.
GoldenGMSA.exe kdsinfo
GoldenGMSA.exe kdsinfo --guid 00000000-0000-0000-0000-000000000000
From SYSTEM on a child domain's controller, --forest names the child domain and the tool also returns the parent's keys:
GoldenGMSA.exe kdsinfo --forest child.corp.example.com
From a database copy, DSInternals reads the root keys offline:
Get-ADDBKdsRootKey -DatabasePath '.\ADBackup\Active Directory\ntds.dit'
3. Compute the password
With privileged access, the tool collects everything itself:
GoldenGMSA.exe compute --sid S-1-5-21-1111111111-2222222222-3333333333-1112
With a previously dumped root key, a low-privileged domain user is enough, because only msDS-ManagedPasswordId is read from the directory:
GoldenGMSA.exe compute --sid S-1-5-21-1111111111-2222222222-3333333333-1112 --kdskey <base64_root_key>
With the identifier supplied as well, nothing is sent to the domain at all:
GoldenGMSA.exe compute --sid S-1-5-21-1111111111-2222222222-3333333333-1112 --kdskey <base64_root_key> --pwdid <base64_managed_password_id>
The result is the gMSA's password, Base64 encoded. Its NT hash is the MD4 digest of the decoded bytes.
4. Authenticate as the gMSA
.\Rubeus.exe asktgt /user:svc-web$ /rc4:<nt_hash> /domain:corp.example.com /ptt
After the next rotation, read the account's new msDS-ManagedPasswordId and repeat step 3 with the same root key.
Impact
The attacker can sign in as any gMSA that derives from the stolen key, for as long as that key is in use. gMSAs commonly run directory synchronization, federation, database, backup and monitoring services, and some hold Tier 0 rights, so the stolen key is often a standing path back to domain administration. It is credential theft that no password reset undoes: resetting administrators, rotating krbtgt twice and rotating the gMSAs all leave it intact.
Recovery is disruptive. Microsoft's procedure creates a new root key and then either forces the gMSAs onto it through an authoritative restore or replaces every gMSA with a new account and updates each service that used the old ones.
OPSEC and artifacts
- Stealing the key from a backup. A root key read out of a domain controller backup, a snapshot or an exfiltrated
ntds.ditnever touches a live domain controller. Microsoft's own guidance states that auditing detects only an online attack on the root key data. The traces are those of the backup system or of the database copy: access to the repository, a shadow copy orntdsutilon a domain controller, a large file leaving the server. - Reading the key online. A read over LDAP is an ordinary query by a privileged account. With an audit entry on the Master Root Keys container, the domain controller writes event 4662 for it; without one, it writes nothing. Domain controllers read the keys under their own computer accounts, so an operator running as SYSTEM on a domain controller blends into that pattern.
- Reading the identifiers. Fetching SIDs and
msDS-ManagedPasswordIdis a low-privileged LDAP search. It can be done long before or after the key theft, and from a different account. - Computing the password. This happens on the attacker's machine and leaves no trace anywhere. No read of
msDS-ManagedPasswordoccurs, so the auditing that catches a gMSA password read stays silent. - Using the password. This is the step that cannot be hidden. The gMSA requests a TGT (event 4768) and logs on (event 4624) from a host that is not one of its service hosts. A request made with the NT hash uses RC4 where the real hosts use AES.
Detection
- Audit reads of the root key. Add an audit entry on
CN=Master Root Keysfor successful reads ofmsKds-RootKeyDataonmsKds-ProvRootKeyobjects, and enable Audit Directory Service Access on domain controllers. Event 4662 then shows each read with the class GUIDaa02fd41-17e0-4f18-8687-b2239649736bas the object type. Any reader that is not a domain controller computer account needs an explanation. The Golden gMSA detection rules implement this. - Watch for the database leaving. Because the offline path is invisible to directory auditing, the detections for NTDS.dit extraction and the access logs of the backup system are part of this detection.
- Baseline gMSA sign-ins. Each gMSA authenticates from a small fixed set of hosts. Alert on TGT requests and logons from anywhere else, and on RC4 requests for gMSA accounts. This is the only signal that covers every way the key can be stolen.
- Reads of gMSA attributes. A single account querying
msDS-ManagedPasswordIdfor all gMSAs, especially an account from another domain, is the preparation step. The gMSA Password Read rules cover the related online read.
// Reads of KDS root key objects by anything that is not a computer account
WindowsEvent
| where Channel == "Security" and EventID == 4662
| extend Actor = tostring(EventData.SubjectUserName),
ObjectType = tostring(EventData.ObjectType),
Target = tostring(EventData.ObjectName)
| where ObjectType has "aa02fd41-17e0-4f18-8687-b2239649736b"
| where Actor !endswith "$"
| project TimeGenerated, Computer, Actor, Target
An administrator listing root keys before creating a gMSA, and assessment tools that browse the configuration partition, produce the same event. Match each one to a change record. After any domain controller compromise, the absence of this event is not evidence that the key is safe.
Mitigation
- Treat KDS root keys as Tier 0 secrets, on a level with the
krbtgtkey. Keep Enterprise Admins and Domain Admins small and protect every domain controller in the forest, including those of child domains. See the Active Directory hardening guide. - Protect backups and virtual disks of domain controllers. They contain the root keys. Restrict who can read, restore or copy them, and log that access.
- Do not widen access to the Group Key Distribution Service container, and review its access control list for added entries.
- Limit what each gMSA can do. A gMSA with domain-wide rights turns a stolen root key into domain control; a gMSA scoped to its service limits the damage. See how to secure Active Directory service accounts and the gMSA guide.
- Add the audit entry on the Master Root Keys container before you need it.
- Choose a shorter password interval for new gMSAs. Microsoft suggests considering 15 days for
ManagedPasswordIntervalInDays, which shortens the recovery window after a compromise. The value cannot be changed after the account is created. - After a domain controller compromise, roll the root key. Follow Microsoft's recovery article: create a new KDS root key (it becomes usable after 10 hours in production), restart the Key Distribution Service on all domain controllers, move or re-create the gMSAs, verify from
msDS-ManagedPasswordIdthat they use the new key, then delete the old key. Microsoft suggests applying this to all domains of the forest when it is unclear what was exposed.
Detection rules for this attack
Log events to collect
FAQ
What is a Golden gMSA attack?
It is the offline computation of gMSA passwords from a stolen KDS root key. A domain controller does not store a gMSA password; it derives it from the root key and from attributes of the account. An attacker who has the root key runs the same derivation on their own machine and gets the same password, for any gMSA that uses that key.
Why does rotating the gMSA password not help?
Each new password is derived from the same root key. The attacker computes the next password exactly as the domain controller does, without contacting it. Access ends only when the gMSAs use a new root key that the attacker has never seen, which is what Microsoft's recovery procedure sets up.
Who can read the KDS root key?
By default only Enterprise Admins, Domain Admins of the forest root and SYSTEM on domain controllers. The key lives in the configuration partition, which replicates to every domain controller in the forest, so SYSTEM on a child domain's controller can read it too. It is also inside every domain controller backup and virtual disk.
How is a Golden gMSA attack detected?
Only the online read of the root key can be logged, and only with an audit entry on the Master Root Keys container: the domain controller then writes event 4662 for the read. A key taken from a backup or a database copy, and the password computation itself, leave no event. What remains visible is the gMSA signing in from a host that does not run its service.
References
- Introducing the Golden GMSA Attack (Semperis, Yuval Gordon)
- How to recover from a Golden gMSA attack (Microsoft Learn)
- GoldenGMSA (Semperis)
- Create the Key Distribution Services KDS Root Key (Microsoft Learn)
- DSInternals: Get-ADDBKdsRootKey
- Unsecured Credentials, T1552 (MITRE ATT&CK)
- OS Credential Dumping: NTDS, T1003.003 (MITRE ATT&CK)
- ms-Kds-Prov-RootKey class (Microsoft Learn)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.