Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

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.

  • dacl
  • active-directory
  • genericall
  • writedacl
On this page 14 sections
  1. ·Why DACL abuse matters
  2. ·Prerequisites
  3. ·Lab setup
  4. 1Read the DACL of Each Target Object
  5. 2Know What Each Right Lets You Do
  6. Locked: Abuse GenericAll: Reset a Password Directly
  7. Locked: Abuse WriteDacl: Grant Yourself Rights First
  8. Locked: Abuse GenericWrite on a Computer: Resource-Based Constrained Delegation
  9. Locked: Abuse GenericAll on a User: Shadow Credentials
  10. Locked: Abuse WriteOwner: Take Ownership, Then Chain Into GenericAll
  11. Locked: Detect and Defend Against DACL Abuse
  12. Locked: Check
  13. Locked: Clean up
  14. 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

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.LOCAL at 10.0.5.10.
  • Other lab hosts: SQL01.CORP.LOCAL (10.0.5.21) and FILE01.CORP.LOCAL (10.0.5.22), two domain-joined servers.
  • Starting credentials: the domain user alice, password LabPass1!, member of the IT-Support group. Grant IT-Support these four ACEs on purpose, so you can practise on each one:
    • GenericAll on the user jsmith
    • WriteDacl on the group Backup Operators
    • GenericWrite on the computer object SQL01$
    • WriteOwner on the computer object FILE01$
  • Attack host: Kali Linux with Impacket, bloodyAD and certipy installed (pip3 install bloodyAD certipy-ad if 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

1

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.10

Example 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.

RightWhat it lets you do
GenericAllFull control. Reset the password, add the object to a group, or write any other attribute.
GenericWriteWrite most attributes. On a computer, this includes msDS-AllowedToActOnBehalfOfOtherIdentity (RBCD) and msDS-KeyCredentialLink (Shadow Credentials).
WriteDaclAdd a new ACE to the object's own DACL. You normally add yourself GenericAll, then use that.
WriteOwnerChange 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.

Related