Add BadSuccessor dMSA Privilege Escalation in Windows 2025 #20472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Posting for visibility. Still very much a work in progress. Will be back in September to complete.
This adds a new module
bad_successorwhich allows metasploit users to create a dMSA account active directory. After the account is created two attributes on the dMSA are updated:msds-managedaccountprecededbylinkis set to the DN of the account you wish to impersonate andmsds-delegatedmsastateis set to2which indicates the dMSA account migration is complete. It is necessary to first create the account and then afterwards update the attributes.This also makes some changes to the
get_ticketmodule and then subsequent libraries it calls in order to facilitate impersonating the dMSA account while dumping theDMSA_KEY_PACKAGEduring the authentication process.##TODOs
get_ticket/tgs_requestis unaffected by this update (clean up the mess I made during testing)msfusercreated a new dMSAmsfuserwas granted Full Control of the object. This won't always be the case. In some scenariosmsfuserwill only be granted Owner and in turn WriteDacl in which case we need to update the security descriptor to allowmsfuserto editmsds-managedaccountprecededbylinkandmsds-delegatedmsastateTesting
Check Method
dMSA Account Creation
Getting a TGS for the account the dMSA "precedes by link" (TODO)
This was working but the day I decided to draft the PR my domain controller decided to stop cooperating. Setting the following datastore options in the get_ticket should work.
First load up
get_ticketand obtain a TGT for the user that created the dMSA:Then using that TGT obtain TGS for the dMSA account
Then get a TGS which can be used to authenticate via psexec as NT AUTHORITY\SYSTEM.