Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 834a80f

Browse files
Set explicit LDAP SecurityMask settings
Changed the LDAP SecurityMasks settings so that you can change the Owner/DACL if you only have WriteOwner/WriteDacl permissions on the object (Default SecurityMasks is "Owner, Group, Dacl")
1 parent bd6fe64 commit 834a80f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Recon/PowerView.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6588,6 +6588,7 @@ Set the owner of 'dfm' in the current domain to 'harmj0y' using the alternate cr
65886588
try {
65896589
Write-Verbose "[Set-DomainObjectOwner] Attempting to set the owner for '$Identity' to '$OwnerIdentity'"
65906590
$Entry = $RawObject.GetDirectoryEntry()
6591+
$Entry.PsBase.Options.SecurityMasks = 'Owner'
65916592
$Entry.PsBase.ObjectSecurity.SetOwner($OwnerIdentityReference)
65926593
$Entry.PsBase.CommitChanges()
65936594
}
@@ -7206,6 +7207,7 @@ https://social.technet.microsoft.com/Forums/windowsserver/en-US/df3bfd33-c070-4a
72067207
ForEach ($ACE in $ACEs) {
72077208
Write-Verbose "[Add-DomainObjectAcl] Granting principal $($PrincipalObject.distinguishedname) rights GUID '$($ACE.ObjectType)' on $($TargetObject.Properties.distinguishedname)"
72087209
$TargetEntry = $TargetObject.GetDirectoryEntry()
7210+
$TargetEntry.PsBase.Options.SecurityMasks = 'Dacl'
72097211
$TargetEntry.PsBase.ObjectSecurity.AddAccessRule($ACE)
72107212
$TargetEntry.PsBase.CommitChanges()
72117213
}

0 commit comments

Comments
 (0)