GoldenGMSA Attack
If we discover a gMSA account in a parent domain we can compromise it from the child domain with the GoldenGMSA tool and obtain its password.
For the attack to work we need the following rights:
Membership in the
Enterprise Adminsgroup in forest root domainMembership in the
Domain Adminsgroup in forest root domainAccess to a domain controller as
NT/AUTHORITY SYSTEM
These will be used to read a list of attributes from the msKds-ProvRootKey objects in CN=Master Root Keys,CN=Group Key Distribution Service,CN=Services,CN=Configuration,DC=domain,DC=com of the parent domain.
cnmsKds-SecretAgreementParammsKds-RootKeyDatamsKds-KDFParammsKds-KDFAlgorithmIDmsKds-CreateTimemsKds-UseStartTimemsKds-VersionmsKds-DomainIDmsKds-PrivateKeyLengthmsKds-PublicKeyLengthmsKds-SecretAgreementAlgorithmID
Fortunately the GoldenGMSA tool makes the process totally automatic and will fetch the needed attributes if ran in the appropriate context.
Online Attack & Computation
The online attack queries the parent domain to obtain the gMSA's SID and uses it to calculate the password by querying both domains.
From a SYSTEM shell we'll execute the tool
Once the SID is found we can use it to compute the gMSA account's password
Offline Attack & Computation
The offline attack fetches the SID and msds-ManagedPasswordID from the parent domain, the kdsinfo from the child domain and uses calculates the password for the gMSA account by manually supplying the KDS Key and account SID.
Now we should have a base64-encoded password, to convert it to a RC4 / NTLM hash we can use the following script
With the hash we're able to request a TGT as the gMSA account
Last updated