Practice library / Active Directory and Windows attacks
Lab · Hard · 2 hoursFree account
DACL Attacks in Active Directory
GenericAll, WriteDacl, WriteOwner and RBCD abuse to escalate quietly in an AD lab domain.
On this page 14 sections
- ·Why DACL abuse matters
- ·Prerequisites
- ·Lab setup
- 1Read the DACL of Each Target Object
- 2Know What Each Right Lets You Do
- Locked: Abuse GenericAll: Reset a Password Directly
- Locked: Abuse WriteDacl: Grant Yourself Rights First
- Locked: Abuse GenericWrite on a Computer: Resource-Based Constrained Delegation
- Locked: Abuse GenericAll on a User: Shadow Credentials
- Locked: Abuse WriteOwner: Take Ownership, Then Chain Into GenericAll
- Locked: Detect and Defend Against DACL Abuse
- Locked: Check
- Locked: Clean up
- Locked: Next lab
Discretionary Access Control Lists on AD objects decide who can reset a password, change group membership or set up delegation. One misplaced GenericAll or WriteDacl right on a sensitive object gives a standard user a quiet path to Domain Admin. Here you abuse GenericAll, WriteDacl and WriteOwner to reset a password, plant Shadow Credentials and set up Resource-Based Constrained Delegation in an isolated AD lab.
What You'll Learn
- Read the DACL of a user, group and computer object and name the ACEs on it
- Explain what GenericAll, GenericWrite, WriteDacl and WriteOwner each let you do
- Abuse GenericAll to reset a password and, separately, to plant Shadow Credentials
- Abuse WriteDacl to grant yourself rights, and WriteOwner to take ownership first
- Abuse GenericWrite on a computer object to set up Resource-Based Constrained Delegation
- Name the event ID and the attribute a defender watches for each attack in this lab
Why DACL abuse matters
Every object in Active Directory carries a DACL: a list of access control entries (ACEs) that say who can do what to that object. A help desk tool needs to reset passwords, so someone grants a help desk group GenericAll on user accounts. A deployment script needs to add computers to a group, so someone grants it WriteDacl on an OU. Each grant is reasonable on its own. Chained together, they often reach Domain Admin without a single exploit and without touching Kerberos.
This lab assumes you already hold valid credentials for a low-privilege domain user. You find the dangerous ACEs that user already has, then abuse each one in turn.
Prerequisites
- Active Directory Basics. You must be comfortable with LDAP enumeration, Kerberoasting and
crackmapexecagainst a domain controller. - AD Enumeration with BloodHound. This lab abuses ACEs that BloodHound finds for you; read its output before you start.
- AD Enumeration with PowerView is not required, but it gives you a Windows-side way to read the same DACLs this lab reads from Kali.
Lab setup
KaliRange hosts no targets, no virtual machines and no lab files. Build and run this domain on your own machine; the domain, addresses and accounts below are the example values of this lab. Replace them with your own.
- Domain:
CORP.LOCAL, an isolated lab domain. Never run any command in this lab against a real organisation's domain. - Domain controller:
DC01.CORP.LOCALat10.0.5.10. - Other lab hosts:
SQL01.CORP.LOCAL(10.0.5.21) andFILE01.CORP.LOCAL(10.0.5.22), two domain-joined servers. - Starting credentials: the domain user
alice, passwordLabPass1!, member of theIT-Supportgroup. GrantIT-Supportthese four ACEs on purpose, so you can practise on each one:GenericAllon the userjsmithWriteDaclon the groupBackup OperatorsGenericWriteon the computer objectSQL01$WriteOwneron the computer objectFILE01$
- Attack host: Kali Linux with Impacket,
bloodyADandcertipyinstalled (pip3 install bloodyAD certipy-adif they are missing).
Build such a domain from free, legal parts: an evaluation copy of Windows Server from the Microsoft Evaluation Center (180 days), in virtual machines on your own computer, joined into one domain with the ACEs above set by hand in Active Directory Users and Computers. Take a snapshot of each virtual machine before Step 1, so you can go back.
Authorized lab only. Run every command in this lab only against your own CORP.LOCAL domain. Every password, hash and hostname here is a lab value. Never point these commands at a domain you do not own or do not have written authorisation to test.
Step 1: Read the DACL of Each Target Object
List the ACEs that alice already holds
Read the DACL of jsmith, Backup Operators and the two computer objects with dacledit.py in read mode. Confirm the four ACEs from the lab setup before you abuse any of them.
dacledit.py -action read -target 'jsmith' 'corp.local/alice:LabPass1!' -dc-ip 10.0.5.10
dacledit.py -action read -target 'Backup Operators' 'corp.local/alice:LabPass1!' -dc-ip 10.0.5.10
dacledit.py -action read -target 'SQL01$' 'corp.local/alice:LabPass1!' -dc-ip 10.0.5.10
dacledit.py -action read -target 'FILE01$' 'corp.local/alice:LabPass1!' -dc-ip 10.0.5.10Example output (the jsmith target, shortened):
[*] DACL for jsmith
[*] ACE[0]
ACE type : ACCESS_ALLOWED_ACE
Access mask : 0xf01ff (Full Control)
Trustee (SID) : IT-SUPPORT (S-1-5-21-...-1601)
[*] ACE[1]
ACE type : ACCESS_ALLOWED_ACE
Access mask : 0x20094 (ReadProperty, ListChildren, ReadControl)
Trustee (SID) : Domain Users (S-1-5-21-...-513)Why it matters. 0xf01ff is the access mask for GenericAll. IT-Support has it on jsmith, so anyone in that group, including alice, has full control of that account. Repeat the read for the other three targets. Confirm WriteDacl on Backup Operators, GenericWrite on SQL01$ and WriteOwner on FILE01$ the same way, by their access mask.
Step 2: Know What Each Right Lets You Do
Before you abuse anything, match each right you found in Step 1 to what it allows.
| Right | What it lets you do |
|---|---|
GenericAll | Full control. Reset the password, add the object to a group, or write any other attribute. |
GenericWrite | Write most attributes. On a computer, this includes msDS-AllowedToActOnBehalfOfOtherIdentity (RBCD) and msDS-KeyCredentialLink (Shadow Credentials). |
WriteDacl | Add a new ACE to the object's own DACL. You normally add yourself GenericAll, then use that. |
WriteOwner | Change the object's owner to a principal you control. An owner can grant itself WriteDacl even with no other right. |
AllExtendedRights (User-Force-Change-Password) | Reset a user's password without knowing the current one. |
Self (validated write on member) | Add yourself as a member of a group, without needing GenericWrite on the group. |
BloodHound labels edges with these same names: GenericAll, GenericWrite, WriteDacl, WriteOwner, AddSelf, ForceChangePassword. The AD Enumeration with BloodHound lab finds these edges for a whole domain in one collection run, instead of one object at a time.
Sign in to continue
9 more sections are for signed-in members. It is free: sign in with Google.