This lab is to abuse weak permissions of Active Directory Discretionary Access Control Lists (DACLs) and Acccess Control Entries (ACEs) that make up DACLs.
Active Directory objects such as users and groups are securable objects and DACL/ACEs define who can read/modify those objects (i.e change account name, reset password, etc).
An example of ACEs for the "Domain Admins" securable object can be seen here:
Some of the Active Directory object permissions and types that we as attackers are interested in:
GenericAll - full rights to the object (add users to a group or reset user's password)
If our controlled user has WriteProperty right on All objects for Domain Admin group:
We can again add ourselves to the Domain Admins group and escalate privileges:
Self (Self-Membership) on Group
Another privilege that enables the attacker adding themselves to a group:
WriteProperty (Self-Membership)
One more privilege that enables the attacker adding themselves to a group:
ForceChangePassword
If we have ExtendedRight on User-Force-Change-Password object type, we can reset the user's password without knowing their current password:
Doing the same with powerview:
Another method that does not require fiddling with password-secure-string conversion:
...or a one liner if no interactive session is not available:
WriteOwner on Group
Note how before the attack the owner of Domain Admins is Domain Admins:
After the ACE enumeration, if we find that a user in our control has WriteOwner rights on ObjectType:All
...we can change the Domain Admins object's owner to our user, which in our case is spotless. Note that the SID specified with -Identity is the SID of the Domain Admins group:
GenericWrite on User
WriteProperty on an ObjectType, which in this particular case is Script-Path, allows the attacker to overwrite the logon script path of the delegate user, which means that the next time, when the user delegate logs on, their system will execute our malicious script:
Below shows the user's delegate logon script field got updated in the AD:
WriteDACL + WriteOwner
If you are the owner of a group, like I'm the owner of a Test AD group:
Which you can of course do through powershell:
And you have a WriteDACL on that AD object:
...you can give yourself GenericAll privileges with a sprinkle of ADSI sorcery:
Which means you now fully control the AD object:
This effectively means that you can now add new users to the group.
Interesting to note that I could not abuse these privileges by using Active Directory module and Set-Acl / Get-Acl cmdlets: