How To

Delegated Managed Service Accounts (dMSA) on Windows Server 2025

On August 12, 2025, Microsoft patched CVE-2025-53779 (CVSS 7.2), the Kerberos flaw Akamai researcher Yuval Gordon had published nearly three months earlier as BadSuccessor. It lived in the delegated managed service account, the account type Windows Server 2025 added to retire service passwords. Before the fix, anyone allowed to create objects in one OU could build a dMSA, link it to a privileged account and inherit its rights. Akamai found non-admins holding that permission in 91% of the environments it examined.

Original content from computingforgeeks.com - post 198822

The patch closes the escalation, but the OU delegations behind it are still in most directories. We migrated a real Windows service from a password account to a dMSA, rolled it back both ways, then audited every OU for the create rights an attacker would want. Every command ran in November 2026 against a Windows Server 2025 domain controller on build 26100.32230, well past the fix, so nothing here relies on an unpatched DC.

What a dMSA replaces and why the old account stays

A legacy service account is a normal user object with a password set to never expire, an SPN or two, and logon rights on the servers that run the service. That password is the exposure. It sits in a runbook, it can be Kerberoasted through the SPN, and it rarely changes because nobody wants to break the service. A dMSA takes its keys from the KDS root key on the domain controller, so the secret rotates on its own and never leaves the DC in a form a person can read.

Where a dMSA differs from a gMSA is the migration path. You do not rewrite the service configuration. You link the old account to the new dMSA, and the Kerberos client on each member server swaps the identity at logon once the migration completes. Microsoft says never to delete the original account, in case you need to revert to it after the migration. The link that drives the swap also points at it, so deleting it breaks the pair. Microsoft’s dMSA setup guide lists the hard requirements, and these are the ones that mattered when we built the lab.

  • At least one writable domain controller runs Windows Server 2025.
  • The forest has a KDS root key that is already effective.
  • The person running the migration is a Domain Admin or Enterprise Admin.
  • Every machine running the service supports dMSA and has dMSA logons enabled by policy. Microsoft warns that machines without dMSA support fail authentication once the old account is disabled. Our member server ran Windows Server 2025.
  • The account being replaced is a user account, not an MSA or gMSA, which cannot migrate.

One more limit is easy to miss until it breaks a service. Microsoft’s overview page says unconstrained delegation stops working once a migration completes. Check the old account’s delegation tab before you start, and move anything that depends on unconstrained delegation to constrained or resource-based delegation first.

Domain controller patch level

Check the build before anything else, because an unpatched Windows Server 2025 DC is still exposed to BadSuccessor no matter how clean your OUs look. MSRC lists two fixed builds for CVE-2025-53779: 26100.4946 from the August 2025 cumulative update KB5063878, and 26100.4851 from the hotpatch KB5064010 on hotpatch-enrolled servers. We read the build from the registry on each Windows Server 2025 domain controller.

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object ProductName, CurrentBuild, UBR

Read UBR as the part after the dot, so our DC reports 26100.32230.

ProductName                               CurrentBuild   UBR
-----------                               ------------   ---
Windows Server 2025 Datacenter Evaluation 26100        32230

If a Windows Server 2025 DC on the normal update channel comes back with a UBR below 4946, or a hotpatch-enrolled one below 4851, patch it before you go further. Older DCs report their own build numbers, so the comparison only means something on 2025 DCs. A domain still on older DCs needs at least one writable Windows Server 2025 DC first, added new or through an in-place upgrade to Windows Server 2025, and a lab can start from a clean Windows Server 2025 install promoted with the AD DS role. Ours runs the domain at the Windows2025Domain functional level as corp.example.com, with DC01 at 192.168.122.10 and the member server APP01 at 192.168.122.20.

The KDS root key

dMSA keys are derived from the KDS root key, so without one New-ADServiceAccount has nothing to derive from. A new key normally waits 10 hours before DCs use it, which lets it replicate first. In a single-DC lab you can backdate it, which is what Microsoft’s setup page shows and what we did.

Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10))
$k = Get-KdsRootKey
$k | Format-List KeyId, EffectiveTime, CreationTime, IsFormatValid
Test-KdsRootKey -KeyId $k.KeyId

Effective time sits 10 hours before creation, and the test returns True.

KeyId         : 86b15e8e-a95d-0132-42d6-180b486e6214
EffectiveTime : 11/28/2026 8:15:03 PM
CreationTime  : 11/29/2026 6:15:05 AM
IsFormatValid : True

True

Do not backdate the key in a domain with more than one DC. A DC that has not received the key yet will fail to compute dMSA passwords, and the service on the member server fails its logon. In production, run Add-KdsRootKey -EffectiveImmediately and wait the 10 hours, or check whether your forest already has a key from earlier gMSA work, because one key serves both.

The legacy service account being retired

A migration test is only useful if a real service uses the old account, so we put a small Windows service called InvSync on APP01. It is a compiled C# ServiceBase that writes its current Windows identity and an LDAP query result to C:\InvSync\invsync.log every 30 seconds, which makes any identity change show up in the log within half a minute. The account it starts as is the kind every domain still has.

New-ADUser -Name svc-legacy -SamAccountName svc-legacy -Path "OU=Service Accounts,DC=corp,DC=example,DC=com" -AccountPassword (ConvertTo-SecureString "Legacy!Svc2019pw" -AsPlainText -Force) -Enabled $true -PasswordNeverExpires $true -ServicePrincipalNames "INVSYNC/app01.corp.example.com","INVSYNC/app01"
Get-ADUser svc-legacy -Properties servicePrincipalName,PasswordNeverExpires,PasswordLastSet | Format-List DistinguishedName,Enabled,PasswordNeverExpires,PasswordLastSet,servicePrincipalName

Two SPNs, a password that never expires, enabled. This is the Kerberoasting target the migration removes.

DistinguishedName    : CN=svc-legacy,OU=Service Accounts,DC=corp,DC=example,DC=com
Enabled              : True
PasswordNeverExpires : True
PasswordLastSet      : 11/29/2026 6:15:28 AM
servicePrincipalName : {INVSYNC/app01, INVSYNC/app01.corp.example.com}

Installing the service with New-Service -Credential CORP\svc-legacy did not start it on our first attempt. Start-Service failed with “Service ‘Inventory Sync (InvSync)’ cannot be started”, and the System log recorded event 7000 with “The service did not start due to a logon failure.” New-Service does not grant the Log on as a service right the way the Services console does. Granting SeServiceLogonRight to CORP\svc-legacy through secedit fixed it, and the log then read running as CORP\svc-legacy | ldap ok.

dMSA logons on the member server

The swap happens in the Kerberos client on the member server, not on the DC, and it is off by default. The Group Policy setting is Computer Configuration\Administrative Templates\System\Kerberos\Enable Delegated Managed Service Account logons. For a single server, the registry value behind it does the same job, so we set it on APP01 in an elevated PowerShell session.

$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Kerberos\Parameters"
if (-not (Test-Path $path)) { New-Item -Path $path -Force | Out-Null }
New-ItemProperty -Path $path -Name DelegatedMSAEnabled -Value 1 -PropertyType DWORD -Force | Out-Null
Get-ItemProperty -Path $path -Name DelegatedMSAEnabled | Format-List DelegatedMSAEnabled

Do not skip the Test-Path guard. New-Item -Force on a registry key that already exists recreates it and drops any values already under it. The value reads back as 1.

DelegatedMSAEnabled : 1

Turn on the Kerberos operational log on the same server too. It is disabled by default, and it is the only place that tells you the client noticed the migration.

wevtutil set-log Microsoft-Windows-Kerberos/Operational /enabled:true
wevtutil get-log Microsoft-Windows-Kerberos/Operational | Select-String "name:|enabled:"

Event Viewer lists this log under Security-Kerberos, but wevtutil takes the channel name shown here.

name: Microsoft-Windows-Kerberos/Operational
enabled: true
  logFileName: %SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-Kerberos%4Operational.evtx

Microsoft’s setup page asks you to restart the services that use the account after the policy change and the link. We rebooted APP01 after the start phase to be safe, and the first 307 and 308 events appeared right after that reboot. If you push the policy by GPO, schedule a reboot with the change window, then check this log before you assume the client has picked up the migration.

Creating the delegated managed service account

Create the dMSA in an OU that only tier-0 admins can write to. Placing it beside the legacy account in OU=Service Accounts keeps the pair together, which helps the audit later, but only if that OU’s permissions are tight. AES256 alone is the right encryption type here, because RC4 is what made the old account cheap to crack, as covered in the Windows Server 2025 Kerberos and NTLM changes. We created ours on DC01.

$params = @{
 Name = "dmsa-invsync"
 DNSHostName = "dmsa-invsync.corp.example.com"
 CreateDelegatedServiceAccount = $true
 KerberosEncryptionType = "AES256"
 Path = "OU=Service Accounts,DC=corp,DC=example,DC=com"
}
New-ADServiceAccount @params
Get-ADServiceAccount dmsa-invsync -Properties objectClass, msDS-DelegatedMSAState, msDS-SupportedEncryptionTypes |
 Format-List DistinguishedName, objectClass, SamAccountName, msDS-DelegatedMSAState, msDS-SupportedEncryptionTypes

The object class confirms it is a dMSA rather than a gMSA, state 0 means it exists but is not linked to anything, and an encryption type of 16 is AES256 only.

New-ADServiceAccount output on a Windows Server 2025 domain controller showing dmsa-invsync created as msDS-DelegatedManagedServiceAccount with state 0

Leave PrincipalsAllowedToRetrieveManagedPassword empty at this point. During a migration each computer that uses the old account writes itself in through the DC, which is more accurate than any list you would type by hand. A standalone dMSA with no predecessor needs it set manually, and so does a host added after Complete, such as a new cluster node, which you add with Set-ADServiceAccount.

Starting the migration writes the link in both directions and moves the dMSA to state 1. Nothing changes for the service yet. It keeps running as svc-legacy while the DC learns which machines use that account.

$params = @{
 Identity = "dmsa-invsync"
 SupersededAccount = "CN=svc-legacy,OU=Service Accounts,DC=corp,DC=example,DC=com"
}
Start-ADServiceAccountMigration @params
Get-ADServiceAccount dmsa-invsync -Properties msDS-DelegatedMSAState, msDS-ManagedAccountPrecededByLink, msDS-GroupMSAMembership, PrincipalsAllowedToRetrieveManagedPassword |
 Format-List Name, msDS-DelegatedMSAState, msDS-ManagedAccountPrecededByLink, PrincipalsAllowedToRetrieveManagedPassword
Get-ADUser svc-legacy -Properties * | Select-Object Name, Enabled, msDS-SupersededServiceAccountState, msDS-SupersededManagedAccountLink, servicePrincipalName | Format-List

Both objects now point at each other, the old account is still enabled and still owns the SPNs, and nobody is allowed to retrieve the dMSA password yet.

Name                                       : dmsa-invsync
msDS-DelegatedMSAState                     : 1
msDS-ManagedAccountPrecededByLink          : CN=svc-legacy,OU=Service
                                             Accounts,DC=corp,DC=example,DC=com
PrincipalsAllowedToRetrieveManagedPassword : {}

Name                               : svc-legacy
Enabled                            : True
msDS-SupersededServiceAccountState : 1
msDS-SupersededManagedAccountLink  : CN=dmsa-invsync,OU=Service Accounts,DC=corp,DC=example,DC=com
servicePrincipalName               : {INVSYNC/app01, INVSYNC/app01.corp.example.com}

That msDS-ManagedAccountPrecededByLink attribute is the one BadSuccessor abused, which is why the ability to create dMSA objects matters so much. After we rebooted APP01 and InvSync logged on again, the Kerberos operational log recorded APP01 adding itself to the dMSA and the client discovering the migration.

TimeCreated : 11/29/2026 7:12:33 AM
Id          : 308
Message     : Adding machine to the Principals Allowed Managed Password attribute of a DMSA
              DC Used: \\DC01
              DMSA Distinguished Name: CN=dmsa-invsync,OU=Service
              Accounts,DC=corp,DC=example,DC=com
              Linked Account: svc-legacy
              Domain Name:  CORP.EXAMPLE.COM
              Previously Authorized: false
              Status: 0x0

TimeCreated : 11/29/2026 7:12:33 AM
Id          : 307
Message     : The Kerberos client has discovered a DMSA migration
              Old Account Name: svc-legacy
              New Account Name: dmsa-invsync$
              Domain Name: CORP.EXAMPLE.COM
              Status: 0x0
              Migration Complete: false

“Previously Authorized: false” on the first 308 and “true” on the one logged at the next service restart is the DC learning the host once and remembering it. When we re-read the dMSA on DC01, PrincipalsAllowedToRetrieveManagedPassword had changed from {} to {CN=APP01,CN=Computers,DC=corp,DC=example,DC=com} without anyone touching it. If a server that runs the service never shows up in that list, it either lacks the dMSA policy or has not authenticated as the old account since the start phase, and completing now would break the service there.

That is why Microsoft’s overview tells you to stay in this phase for at least two ticket lifetimes (14 days) and recommends 28 days. A service that runs once a month, a scheduled task on a forgotten server and a second node in a cluster all need time to authenticate and get recorded. We moved on after one reboot because our lab has one server and one service. Yours should not.

The complete phase switches the identity

Completing the migration moves the SPNs to the dMSA and disables the legacy account. Run it on DC01 only once every host that uses the old account appears in the allowed list.

$params = @{
 Identity = "dmsa-invsync"
 SupersededAccount = "CN=svc-legacy,OU=Service Accounts,DC=corp,DC=example,DC=com"
}
Complete-ADServiceAccountMigration @params
Get-ADServiceAccount dmsa-invsync -Properties msDS-DelegatedMSAState, servicePrincipalName |
 Format-List Name, msDS-DelegatedMSAState, servicePrincipalName
Get-ADUser svc-legacy -Properties msDS-SupersededServiceAccountState, servicePrincipalName |
 Format-List Name, Enabled, msDS-SupersededServiceAccountState, servicePrincipalName

State 2 on both sides, the SPNs have moved, and svc-legacy is disabled with an empty SPN list.

Name                   : dmsa-invsync
msDS-DelegatedMSAState : 2
servicePrincipalName   : {INVSYNC/app01, INVSYNC/app01.corp.example.com}

Name                               : svc-legacy
Enabled                            : False
msDS-SupersededServiceAccountState : 2
servicePrincipalName               : {}

The same value is visible in Active Directory Users and Computers with View > Advanced Features turned on. Open the dMSA’s properties, go to the Attribute Editor tab and find the state attribute.

Attribute Editor for the dmsa-invsync delegated managed service account showing msDS-DelegatedMSAState set to 2 after Complete-ADServiceAccountMigration

Next we restarted the service on APP01 and read both the service configuration and its own log.

InvSync service log on APP01 showing it running as CORP\dmsa-invsync$ while the service still lists CORP\svc-legacy as its logon account

This is the result that surprises people. The service control manager still lists CORP\svc-legacy as the logon account, yet the process now runs as CORP\dmsa-invsync$ and its LDAP bind still works. The Kerberos client does the swap at logon, so leave the service configuration alone. Changing it to the dMSA by hand gains nothing, and it removes the fallback that Undo relies on. The operational log shows the client side of it, event 307 now with “Migration Complete: true” and event 309 fetching the dMSA keys with the machine account.

TimeCreated : 11/29/2026 7:14:35 AM
Id          : 309
Message     : Fetching keys for a DMSA using the machine account
              KDC Used: DC01.corp.example.com
              Domain Name: CORP
              Account Name: dmsa-invsync$
              Fetch Time:  23:59:59.0000 12/28/2026 Z
              Expiration Time: 23:54:59.0000 12/28/2026 Z
              Keys Updated: true
              Ntlm Updated: false
              Status: 0x0

“Ntlm Updated: false” is a useful hint. If the service still authenticates somewhere with NTLM, the dMSA will not cover it, so look for 4776 events that name the old account on the DCs after the switch. Event Viewer on APP01 shows the full sequence across our run, with 307 and 308 at each restart and 309 once the keys come from the DC.

Event Viewer on APP01 showing Security-Kerberos Operational events 307, 308 and 309 for the dmsa-invsync migration

Once the log looks like this on every host, the password of svc-legacy is no longer used by anything. It stays disabled, its SPNs are gone, and Kerberoasting it returns nothing.

Rollback with Undo and Reset

Two cmdlets back out a migration, and they do different things. Undo-ADServiceAccountMigration is described on Microsoft’s page as undoing the migration steps, and on our build it stepped back one phase, returning both accounts from state 2 to state 1 with the old account live again. Reset-ADServiceAccountMigration removes the link entirely. The table maps each state to what we saw in it.

msDS-DelegatedMSAStateMeaningOld accountReached by
0dMSA exists, no linkEnabled, owns SPNsNew-ADServiceAccount, Reset
1Migration started, hosts being learnedEnabled, owns SPNs, service runs as itStart, Undo from 2
2Migration completeDisabled, SPNs moved to the dMSAComplete
3Standalone dMSA (Microsoft’s docs)NoneSet manually, not used here

Undo is the first move if a service breaks after Complete, because it puts the old account back and keeps the link in place, so you can complete again later without starting over. It takes the same parameters on DC01.

$params = @{
 Identity = "dmsa-invsync"
 SupersededAccount = "CN=svc-legacy,OU=Service Accounts,DC=corp,DC=example,DC=com"
}
Undo-ADServiceAccountMigration @params
Get-ADServiceAccount dmsa-invsync -Properties msDS-DelegatedMSAState, msDS-ManagedAccountPrecededByLink, servicePrincipalName |
 Format-List Name, msDS-DelegatedMSAState, msDS-ManagedAccountPrecededByLink, servicePrincipalName
Get-ADUser svc-legacy -Properties msDS-SupersededServiceAccountState, servicePrincipalName |
 Format-List Name, Enabled, msDS-SupersededServiceAccountState, servicePrincipalName

The dMSA drops back to 1 and keeps its link, while svc-legacy is enabled again with both SPNs restored.

Name                              : dmsa-invsync
msDS-DelegatedMSAState            : 1
msDS-ManagedAccountPrecededByLink : CN=svc-legacy,OU=Service Accounts,DC=corp,DC=example,DC=com
servicePrincipalName              : {}

Name                               : svc-legacy
Enabled                            : True
msDS-SupersededServiceAccountState : 1
servicePrincipalName               : {INVSYNC/app01, INVSYNC/app01.corp.example.com}

After a restart, the InvSync log on APP01 read running as CORP\svc-legacy again at 07:15:49, so a service-level rollback takes one restart. Reset is the bigger step, for when you are abandoning this dMSA or starting over.

$params = @{
 Identity = "dmsa-invsync"
 SupersededAccount = "CN=svc-legacy,OU=Service Accounts,DC=corp,DC=example,DC=com"
}
Reset-ADServiceAccountMigration @params
Get-ADServiceAccount dmsa-invsync -Properties msDS-DelegatedMSAState, msDS-ManagedAccountPrecededByLink, PrincipalsAllowedToRetrieveManagedPassword |
 Format-List Name, msDS-DelegatedMSAState, msDS-ManagedAccountPrecededByLink, PrincipalsAllowedToRetrieveManagedPassword
Get-ADUser svc-legacy -Properties msDS-SupersededServiceAccountState, msDS-SupersededManagedAccountLink |
 Format-List Name, Enabled, msDS-SupersededServiceAccountState, msDS-SupersededManagedAccountLink

Both links are cleared, the allowed list is empty again, and both accounts are back at state 0.

Name                                       : dmsa-invsync
msDS-DelegatedMSAState                     : 0
msDS-ManagedAccountPrecededByLink          :
PrincipalsAllowedToRetrieveManagedPassword : {}

Name                               : svc-legacy
Enabled                            : True
msDS-SupersededServiceAccountState : 0
msDS-SupersededManagedAccountLink  : 

Reset throws away the link and the learned host list, so a new Start has to wait out the full learning window again. We then ran Start and Complete a second time to prove the cycle repeats cleanly. It did, with state 2, SPNs on the dMSA, svc-legacy disabled, and InvSync back on CORP\dmsa-invsync$ after one restart.

OU permissions that allow BadSuccessor

The patch fixed the escalation in the KDC, but the condition Akamai described is a permission problem, and permission problems outlive patches. Anyone who can create a dMSA in some OU can create an object whose predecessor link and password retrieval list are theirs to control. After the patch a one-sided link no longer hands them another account’s privileges. Akamai’s follow-up analysis found the KDC now wants a mutual link, so an attacker who controls both a dMSA and a target account can still take that target’s privileges and keys. In practice we read “controls” as write access such as GenericWrite on the target. Akamai’s original write-up found non-admins with dMSA create rights in 91% of the environments it checked. In our experience these grants come from ordinary helpdesk delegations nobody revisited.

Four kinds of grant on an OU let a principal create dMSA objects there, directly or after one more step.

  • CreateChild on all object types, which includes the dMSA class.
  • CreateChild scoped to the msDS-DelegatedManagedServiceAccount class.
  • GenericAll, WriteDacl or WriteOwner, each of which lets the holder grant itself CreateChild.
  • Ownership of the OU by anyone other than the built-in admin groups.

Our script checks every OU for those rights held by anyone outside Domain Admins, Enterprise Admins, Administrators, SYSTEM and Enterprise Domain Controllers. It matches the dMSA schema class GUID 0feb936f-47b3-49f2-9386-1dedc2c23765 and skips inherit-only entries. We saved it as C:\Tools\Find-DmsaCreateRights.ps1, and it runs on a DC or any management host with the AD module.

$domain = Get-ADDomain
$dmsaClass = [guid]'0feb936f-47b3-49f2-9386-1dedc2c23765'
$allObjects = [guid]::Empty
$risky = 'CreateChild|GenericAll|WriteDacl|WriteOwner'
$trusted = @(
    "$($domain.DomainSID)-512",
    "$((Get-ADDomain $domain.Forest).DomainSID)-519",
    'S-1-5-32-544',
    'S-1-5-18',
    'S-1-5-9'
)

function Get-Sid($name) {
    try { (New-Object System.Security.Principal.NTAccount($name)).Translate([System.Security.Principal.SecurityIdentifier]).Value }
    catch { $name }
}

Get-ADOrganizationalUnit -Filter * -Properties nTSecurityDescriptor | ForEach-Object {
    $ou = $_.DistinguishedName
    $sd = $_.nTSecurityDescriptor

    $ownerSid = Get-Sid $sd.Owner
    if ($ownerSid -notin $trusted) {
        [pscustomobject]@{ OU = $ou; Principal = $sd.Owner; Right = 'Owner'; AppliesTo = 'OU' }
    }

    foreach ($ace in $sd.Access) {
        if ($ace.AccessControlType -ne 'Allow') { continue }
        if ($ace.ActiveDirectoryRights -notmatch $risky) { continue }
        if ($ace.PropagationFlags -band [System.Security.AccessControl.PropagationFlags]::InheritOnly) { continue }
        $sid = Get-Sid $ace.IdentityReference.Value
        if ($sid -in $trusted) { continue }
        $rights = $ace.ActiveDirectoryRights.ToString()
        if ($rights -notmatch 'GenericAll|WriteDacl|WriteOwner' -and
            $ace.ObjectType -ne $allObjects -and $ace.ObjectType -ne $dmsaClass) { continue }
        [pscustomobject]@{
            OU        = $ou
            Principal = $ace.IdentityReference.Value
            Right     = $rights
            AppliesTo = $(if ($ace.ObjectType -eq $dmsaClass) { 'dMSA objects' } elseif ($ace.ObjectType -eq $allObjects) { 'all object types' } else { $ace.ObjectType })
        }
    }
}

On our fresh domain the script returned nothing, so the default OUs are clean. To give it something realistic to find, we seeded two delegations that turn up in real directories. The Helpdesk-Tier1 group got “Create all child objects” on a Staging OU, and a single user, jdoe, got the right to create only dMSA objects in Service Accounts.

C:\Tools\Find-DmsaCreateRights.ps1 | Format-Table -AutoSize -Wrap | Out-String -Width 160

Both delegations come back, each with the scope of the right it grants.

Find-DmsaCreateRights.ps1 audit output listing CORP\jdoe and CORP\Helpdesk-Tier1 with CreateChild rights that allow creating dMSA objects

The Helpdesk-Tier1 row is the dangerous one, because “all object types” includes dMSA and nobody who granted it was thinking about service accounts. The jdoe row is narrower but worse in intent, because someone delegated dMSA creation specifically. The same Helpdesk-Tier1 entry looks harmless in the GUI, which is how these grants survive reviews. In ADUC, open the OU’s Properties, then the Security tab, and select the group.

Staging OU Security tab in Active Directory Users and Computers showing Helpdesk-Tier1 allowed to create all child objects
  1. 1Helpdesk-Tier1
  2. 2Create all child objects
  3. 3Remove

Remove can drop the group from the OU in the GUI, but dsacls /R scripts better and works the same across many OUs. It removes every entry the principal has on that object, not only CreateChild, so if the helpdesk legitimately needs to reset passwords in Staging, re-grant that specific right afterwards with dsacls /G. We removed both delegations and re-ran the audit.

dsacls "OU=Staging,DC=corp,DC=example,DC=com" /R "CORP\Helpdesk-Tier1" | Select-Object -Last 1
dsacls "OU=Service Accounts,DC=corp,DC=example,DC=com" /R "CORP\jdoe" | Select-Object -Last 1
$r = C:\Tools\Find-DmsaCreateRights.ps1
if ($r) { $r | Format-Table -AutoSize -Wrap | Out-String -Width 160 } else { 'No non-admin principal can create dMSA objects in any OU.' }

Both removals succeed and the audit comes back empty.

The command completed successfully
The command completed successfully
No non-admin principal can create dMSA objects in any OU.

The script covers OUs, which is where delegations live in most domains. It does not walk containers such as CN=Users or CN=Computers, and it trusts the five well-known admin principals without checking who sits inside those groups. It also checks create rights only, so write access on existing dMSA objects, or on the accounts they could be paired with, needs its own review. Akamai publishes its own audit script in the akamai/BadSuccessor repository if you want a second opinion. Run one of them on a schedule, because a delegation added next quarter undoes today’s cleanup.

Detection with event 5137

Cleaning up permissions stops the next bad grant only if somebody notices it. The second control is an alert every time a dMSA is created, which in most domains should be a rare, planned event. That needs the Directory Service Changes audit subcategory on the DCs plus a SACL that audits creation of the dMSA class, which we added on DC01.

auditpol /set /subcategory:"Directory Service Changes" /success:enable
$dn = (Get-ADDomain).DistinguishedName
$acl = Get-Acl "AD:\$dn" -Audit
$everyone = [System.Security.Principal.SecurityIdentifier]'S-1-1-0'
$dmsaClass = [guid]'0feb936f-47b3-49f2-9386-1dedc2c23765'
$rule = New-Object System.DirectoryServices.ActiveDirectoryAuditRule($everyone, 'CreateChild', 'Success', $dmsaClass, 'All')
$acl.AddAuditRule($rule)
Set-Acl "AD:\$dn" $acl
(Get-Acl "AD:\$dn" -Audit).Audit | Where-Object ObjectType -eq $dmsaClass | Format-List IdentityReference, ActiveDirectoryRights, AuditFlags, ObjectType, InheritanceType

The audit entry lands on the domain root and inherits to every OU.

The command was successfully executed.

IdentityReference     : Everyone
ActiveDirectoryRights : CreateChild
AuditFlags            : Success
ObjectType            : 0feb936f-47b3-49f2-9386-1dedc2c23765
InheritanceType       : All

Treat auditpol as a test only. On a real DC, set the same subcategory in the Default Domain Controllers Policy, or the next policy refresh can overwrite it; our Windows Server 2025 security baseline guide covers where the audit settings live. To prove the rule fires, we created a throwaway dMSA called dmsa-canary, deleted it, then queried the Security log.

Get-WinEvent -FilterHashtable @{LogName='Security'; Id=5137} |
    Where-Object Message -match 'msDS-DelegatedManagedServiceAccount' |
    Select-Object TimeCreated, @{n='Creator';e={$_.Properties[4].Value + '\' + $_.Properties[3].Value}}, @{n='DN';e={$_.Properties[8].Value}} |
    Format-Table -AutoSize | Out-String -Width 160

One row per dMSA created, with the account that created it and where.

Get-WinEvent query returning Security event 5137 for a new msDS-DelegatedManagedServiceAccount object with the creator and DN

The first query, five seconds after the canary was created, found no events at all; the 5137 appeared on the next query. Build a little delay into any test that checks for it. In a SIEM, alert on 5137 where the object class is msDS-DelegatedManagedServiceAccount and the creator is not on your short list of tier-0 admins. Akamai also recommends watching 5136 for writes to the link attributes on both sides, msDS-ManagedAccountPrecededByLink on the dMSA and msDS-SupersededManagedAccountLink on the old account, which needs SACLs for attribute writes alongside this one. A dMSA in state 2 whose predecessor is still enabled is another tell, because a completed migration disables the old account, and so is any link that no planned migration explains. The Windows event IDs cheat sheet lists both alongside the other directory change events.

dMSA security audit checklist

Work through this list on every domain that has, or plans to have, a Windows Server 2025 DC. Each item is a condition you can check with the commands above, and a single failure is enough to stop and fix before migrating more services.

  1. Every Windows Server 2025 domain controller reports build 26100.4946 or later, or 26100.4851 or later on the hotpatch channel.
  2. The KDS root key was created without backdating in any domain with more than one DC.
  3. Find-DmsaCreateRights.ps1, or Akamai’s script, returns no rows for any OU.
  4. The OU holding your dMSAs is writable only by tier-0 administrators.
  5. Each dMSA uses AES256 only, with msDS-SupportedEncryptionTypes set to 16.
  6. Every host that runs a migrated service appears in PrincipalsAllowedToRetrieveManagedPassword before Complete runs.
  7. Each migration stayed in the start phase for at least 14 days, and ideally 28.
  8. Superseded accounts are disabled, have no SPNs and still exist in the directory.
  9. No migrated service depends on unconstrained delegation.
  10. Directory Service Changes auditing is enabled by GPO on every DC, and 5137 for the dMSA class raises an alert.

Items 3 and 10 are the ones to schedule. The rest are true once a migration is done, but delegations creep back as teams change, and the audit script with the 5137 alert is what catches the next Helpdesk-Tier1 grant before an attacker does.

Keep reading

Java4Shell (CVE-2026-114938): Find and Patch Vulnerable JVMs Security Java4Shell (CVE-2026-114938): Find and Patch Vulnerable JVMs UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 Security UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 nginx HTTP/2 RCE CVE-2026-123007: Check, Disable HTTP/2, Patch Security nginx HTTP/2 RCE CVE-2026-123007: Check, Disable HTTP/2, Patch Install Grok Build on Windows 11 (Formerly Cursor) AI Install Grok Build on Windows 11 (Formerly Cursor) WP Rocket CVE-2026-125812: Check, Patch and Hunt Planted Files Security WP Rocket CVE-2026-125812: Check, Patch and Hunt Planted Files How to Use a VPN for Windows in 2024 for Secure Connection Security How to Use a VPN for Windows in 2024 for Secure Connection

Leave a Comment

Press ESC to close