🦦
Otter's Notes
  • Introduction
  • Articles
    • Dumping data from the Microsoft Recall folder
    • Gaining persistence on Windows with Time Providers
    • Reverse engineering LSASS to decrypt DPAPI keys
    • Intro to Hypervisor Implants
    • In-depth Windows Telemetry
  • Notes
    • Active Directory
      • Active Directory Structure
      • Active Directory Terminology
      • Active Directory Objects
      • Active Directory Groups
      • Active Directory Functionality
      • Active Directory Protocols
      • Active Directory Rights and Privileges
      • Security in Active Directory
      • Users and Machine Accounts
      • NTLM
      • LDAP
      • Making a Target User List
      • Enumerating & Retrieving Password Policies
      • Enumerating Security Controls
      • Examining Group Policy
      • GPOs
      • LAPS
      • LLMNR & NBT-NS Poisoning
      • LOLBIN Enumeration
    • AAD
      • Useful Links
      • Overview of Azure & M365
      • Enumerate Users and Domains
      • Post-exploitation Reconnaissance
      • OAuth 2.0 Abuse
      • Abusing Device Code Authentication
      • Abusing Cloud Administrator Role
      • Abusing User Administrator Role
      • AAD Federated Backdoor
      • Service Principal Abuse
      • Compromising Azure Blobs and Storage Accounts
      • Malicious Device Join
      • Disabling Auditing (Unified Audit Logs)
      • Spoofing Azure Sign-In Logs
      • Registering Fake Agents for Log Spoofing
      • Pass the PRT
      • Pass the Cookie
      • Abusing Managed Identities
      • Virtual Machine Abuse
      • Attacking Key Vaults
    • Forest Trust Abuse
      • Parent-Child Trust Abuse
      • One-Way Inbound Trust Abuse
      • Foreign Group Membership
      • Foreign ACL Principals
      • SID History
      • SID Filter Bypass
      • Intra-Forest Attacks
        • Configuration Naming Context Replication
        • ADCS NC Replication Attack
        • GPO On-Site Attack
        • GoldenGMSA Attack
        • DNS Trust Attack
      • Cross-Forest Attacks
        • Trust Account Attack
        • Abusing SQL Linked Servers
        • Abusing PAM Trusts
    • Kerberos
      • Overview of Kerberos Authentication
      • Silver Tickets
      • Golden Tickets
      • Diamond Tickets
      • Kerberoasting
      • AS-REPRoasting
      • Resource-Based Constrained Delegation
      • Constrained Delegation
      • Unconstrained Delegation
      • S4U2Self & S4U2Proxy
      • Golden Certificates
    • DACL Abuse
      • DACL Overview
      • DACLs Enumeration
      • AddMembers
      • GPO Attacks
      • Granting Rights and Ownership
      • Logon Scripts
      • NoPAC
      • Password Abuse
      • SPN Jacking
      • Shadow Credentials
      • Targeted Kerberoasting
    • ADCS
      • Introduction to ADCS
      • ESC1
      • ESC2
      • ESC3
      • ESC4
      • ESC5
      • ESC6
      • ESC7
      • ESC8
      • ESC9
      • ESC10
      • ESC11
      • Certificate Mapping
    • PowerShell
      • PowerShell Basics
      • PowerShell Remoting
      • Alternate PowerShell Hosts
      • PowerShell Pipeline Runners
      • PowerShell Code Signing
      • Scriptblock Logging
      • PowerShell CLM
      • AMSI
      • PowerShell Reflection
      • WMI - Windows Management Instrumentation
      • Interfacing with AD
      • PowerShell Snippets
        • Bypass application whitelisting and CLM with runscripthelper and WMI
        • Create fake PowerShell logs
        • Enumerate AD ACLs
        • Enumerate WMI events
        • Enumerate Domain Trusts
        • Enumerate change metadata
        • Enumerate non-signed service binaries
        • Enumerate with GPOs
        • Find signed alternate PowerShell hosts
        • Get AMSI module
        • Group processes by user with WMI
        • Hide processes from Get-Process
        • Malware re-purposing with PowerShell reflection
        • Monitor PowerShell hosts with WMI
        • PowerShell reflection offensive use-case
        • Query PowerShell alternative hosts with WMI
        • Retrieve file certificate
        • Search LDAP for misconfigurations
        • Sign custom code with PowerShell
        • WMI service creation
        • Weak folder permission enumeration
    • AWS
      • AWS Organizations
      • AWS Principals
    • Binary Exploitation
      • Environment setup for Browser Exploitation
      • Browser Overview and Components
    • Kernel Development
      • Windows
        • Configuring a VM for driver development
Powered by GitBook
On this page
  1. Notes

DACL Abuse

PreviousGolden CertificatesNextDACL Overview

Last updated 8 months ago

Within the Windows security ecosystem, tokens identify the security context of a process or a thread and security descriptors contain the security information associated with an object. To achieve Confidentiality, many operating systems and directory services utilize access control lists (ACLs): a mechanism that implements access control for a system resource by enumerating the system entities that are permitted to access the resource and stating, either implicitly or explicitly, the access modes granted to each entity.

Access control policies dictate what types of access are permitted, under what circumstances, and by whom. The four general categories of access control policies are:

  • DAC - Discretionary access control: controls access based on the requestor's identity and access rules stating what requestors are allowed to do. It is discretionary because an entity might have access rights that permit it, by its own volition, to enable another entity to access some resource

  • MAC - Mandatory access control: the entity having access to a resource may not, just by its own volition, enable another entity to access that resource

  • RBAC - Role-based access control

  • ABAC - Attribute-based access control

Windows is an example of a DAC operating system, which utilizes Discretionary access control lists or DACLs. witch are part of the bigger picture of security descriptors.

Security Descriptors

In Windows, every object (also known as ) has a security descriptor data structure that specifies who can perform what actions on the object.

typedef struct _SECURITY_DESCRIPTOR {
  BYTE                        Revision;
  BYTE                        Sbz1;
  SECURITY_DESCRIPTOR_CONTROL Control;
  PSID                        Owner;
  PSID                        Group;
  PACL                        Sacl;
  PACL                        Dacl;
} SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;

Only four of the seven members of the SECURITY_DESCRIPTOR struct matter to us for the exploitation of DACLs.

The security descriptor is a binary data structure that can contain six main fields:

  • Revision Number: the SRM (Security Reference Monitor) version of the security model used to create the descriptor

  • Control Flags: optional modifiers that define the behavior/characteristics of the security descriptor

  • Owner SID: the object's owner SID

  • Discretionary access control list: specifies who has what access to the object - throughout the DACL Attacks mini-modules, our primary focus will be abusing and attacking these

  • System access control list or SACL: specifies which operations by which users should be logged in the security audit log and the explicit integrity level of an object

We are interested in the Control, Owner, Sacl and Dacl fields.

A security descriptor can be one of two forms:

  • absolute security descriptors: contain pointers to the information, as in the SECURITY_DESCRIPTOR struct above, and these are the ones that we will encounter when interacting with Windows objects, whether AD ones or not

Self-relative security descriptors are not very different: instead of storing pointers, they store the actual data of a security descriptor in a contiguous memory block -these are meant to store a security descriptor on a disk or transmit it over the wire

Control Field

Flag
Hexadecimal Representation

0x0100

0x0400

0x0008

0x0004

0x1000

0x0002

0x0001

0x0200

0x0800

0x0008

0x0010

0x2000

0x8000

These binary flags can be added to represent any combinations - for example, if the value of Control is 0x8014, it signifies the presence of the SE_DACL_PRESENT, SE_SACL_PRESENT, and SE_SELF_RELATIVE flags.

Owner Field

The Owner and Group members contain a pointer to the Security Identifier of the object's owner and primary group, respectively. Object owners are always granted full control of the security descriptor, as they are granted the access rights RIGHT_WRITE_DAC (WriteDacl) and RIGHT_READ_CONTROL (ReadControl) implicitly.

SACL and DACL Fields

In Windows, SACL (System access control list) and DACL (Discretionary access control lists) are the two types of access control lists (ACLs), each consisting of a header and zero or more access control entries (ACEs). (Throughout security literature, when the term ACL is used, it usually refers to DACL, especially for Windows systems.)

typedef struct _ACL {
  BYTE AclRevision;
  BYTE Sbz1;
  WORD AclSize;
  WORD AceCount;
  WORD Sbz2;
} ACL;

Generic and Object-specific ACEs

An ACE contains a set of user rights and a SID that identifies a principal for whom the rights are allowed, denied, or audited

typedef struct _ACE_HEADER {
  BYTE AceType;
  BYTE AceFlags;
  WORD AceSize;
} ACE_HEADER;

but the most important are the following

ACE
Implication

Allows a particular security principal (user or group) to access an Active Directory object, such as a user account or group. An Access Allowed ACE specifies which permissions the security principal can perform on the object, such as read, write, or modify.

A specific type of Access Allowed ACE that is applied to an object and grants access to the object itself and any child objects it contains. An Access Allowed Object ACE can grant a security principal the necessary permissions to access an object and its child objects without applying separate ACEs to each child object.

Denies a particular security principal access to an Active Directory object, such as a user account or group. An Access Denied ACE specifies which permissions the security principal is not allowed to perform on the object, such as read, write, or modify.

A specific type of Access Denied ACE that is applied to an object and restricts access to the object itself and any child objects it contains. An Access Denied Object ACE prevents a security principal from accessing an object and its child objects without having to apply separate ACEs to each child object.

  • ObjectType: A GUID containing a type of child object, a property set or property, an extended right, or a validated write

  • InheritedObjectType: Specifies the type of child object that can inherit the ACE

  • Flags: Indicates whether the members ObjectType and InheritedObjectType are present via a set of bit flags

Interpret Access Masks

How do we interpret access masks and their bits?

  • Generic access rights bits

Display Name
Common Name
Hexadecimal Value
Interpretation

GenericAll

GA/RIGHT_GENERIC_ALL

0x10000000

Allows creating or deleting child objects, deleting a subtree, reading and writing properties, examining child objects and the object itself, adding and removing the object from the directory, and reading or writing with an extended right. This is equivalent to the object-specific access rights bits (DE | RC | WD | WO | CC | DC | DT | RP | WP | LC | LO | CR | VW) for AD objects.

GenericExecute

GX/RIGHT_GENERIC_EXECUTE

0x20000000

Allows reading permissions on and listing the contents of a container object. This is equivalent to the object-specific access rights bits (RC | LC) for AD objects.

GenericWrite

GW/RIGHT_GENERIC_WRITE

0x40000000

Allows reading permissions on this object, writing all the properties on this object, and performing all validated writes to this object. This is equivalent to the object-specific access rights bits (RC | WP | VW) for AD objects.

GenericRead

GR/RIGHT_GENERIC_READ

0x80000000

  • Standard Access Rights Bits

Display Name
Common Name
Hexadecimal Value
Interpretation

WriteDacl

WD/RIGHT_WRITE_DAC

0x00040000

Allows modifying the object's security descriptor's discretionary access-control list (DACL).

WriteOwner

WO/RIGHT_WRITE_OWNER

0x00080000

Allows modifying the object's security descriptor's owner. A user can only take ownership of an object but cannot transfer ownership of an object to other users.

ReadControl

RC/RIGHT_READ_CONTROL

0x00020000

Allows reading the data from the object's security descriptor, however, this does not include the data of the SACL.

Delete

DE/RIGHT_DELETE

0x00010000

Allows deleting the object.

  • Object-specific Access Rights Bits

Common Name
Hexadecimal Value
Interpretation

CR/RIGHT_DS_CONTROL_ACCESS

0x0000100

WP/RIGHT_DS_WRITE_PROPERTY

0x00000020

Allows writing properties of the object. The ObjectType member of an ACE can contain a GUID that identifies a property set or an attribute. If ObjectType does not contain a GUID, the ACE controls the right to write all object's attributes.

VW/RIGHT_DS_WRITE_PROPERTY_EXTENDED

0x00000008

  • Extended (Object-specific) Access Rights

Display Name
Common Name
Rights-GUID Value
Interpretation

User-Force-Change-Password

00299570-246d-11d0-a768-00aa006e0529

DS-Replication-Get-Changes

1131f6aa-9c07-11d1-f79f-00c04fc2dcd2

Required to replicate changes from a given NC (Naming Context). To perform a DCSync attack, this extended right and DS-Replication-Get-Changes-All are required.

DS-Replication-Get-Changes-All

1131f6ad-9c07-11d1-f79f-00c04fc2dcd2

Allows the replication of secret domain data. To perform a DCSync attack, this extended right and DS-Replication-Get-Changes are required.

  • Validated Writes

Display Name
Common Name
Rights-GUID Value
Interpretation

Self-Membership

bf9679c0-0de6-11d0-a285-00aa003049e2

Allows editing the member attribute, therefore enabling setting membership of groups.

Validated-SPN

f3a64788-5306-11d1-a9c5-0000f80367c1

Allows editing the Service Principal Name (SPN) attribute.

Group SID: the object's primary group SID - only the subsystem utilized this member (before being ), and most AD environments now ignore it

The Control member is of type , a 16-bit set of bit flags that qualify the meaning of a security descriptor or its components. The value of Control, when retrieved with the function , can include a combination of 13 bits flags:

A contains ACEs that dictate the types of access attempts that generate audit records in the security event log of a domain controller; therefore, a SACL allows administrators to log access attempts to securable objects. There are two types of ACEs within a SACL, system audit ACEs and system audit-object ACEs.

While a DACL holds ACEs that dictate what principals have control rights over a specific object. Internally within Windows, a DACL consists of an followed by an ordered list of zero or more ACEs (the same applies to SACLs). Below is the struct definition of an ACL (recognizing these struct definitions will help us later on when viewing a security descriptor from the kernel's point of view):

In a DACL, there can be nine types of ACEs, each having the struct ACE_HEADER as a member, in addition to the member (which is of type and defines the standard, specific, and generic rights) and SidStart (which holds the first 32 bits of the trustee's SID):

Some ACEs include the keyword Object, these are used only within Active Directory. In addition to the members of generic ACEs structure, object-specific ACEs contain the members:

We mentioned that all ACE data structures (such as ) contain the Mask member, which is of type ACCESS_MASK: a 32-bit value that specifies the allowed or denied rights to manipulate an object

Allows reading permissions on this object, reading all the properties on this object, listing this object name when the parent container is listed, and listing the object's contents if it is a . This is equivalent to the object-specific access rights bits (RC | LC | RP | LO) for AD objects.

Allows performing an operation controlled by a . The ObjectType member of an ACE can contain a GUID that identifies the control access right. If ObjectType does not contain a GUID, the ACE controls the right to perform all control access right controlled operations associated with the object. Also referred to as AllExtendedRights, especially when ObjectType does not contain a GUID.

Allows performing an operation controlled by a access right. The ObjectType member of an ACE can contain a GUID that identifies the validated write. If ObjectType does not contain a GUID, the ACE controls the rights to perform all validated write operations associated with the object. Also referred to as Self.

Allows a user's account password to be reset without knowing the old one. This is in contrast to , which does require knowing the old password.

securable objects
Windows POSIX
discontinued
absolute or self-relative
SECURITY_DESCRIPTOR_CONTROL
GetSecurityDescriptorControl
SACL
ACL
Mask
ACCESS_MASK
Access Allowed
Access Denied
Access Allowed Object
Access Denied Object
Access Allowed Callback
Access Denied Callback
Access Allowed Object Callback
Conditional Claims
object-specific ACEs
ACCESS_ALLOWED_ACE
SE_DACL_AUTO_INHERIT_REQ
SE_DACL_AUTO_INHERITED
SE_DACL_DEFAULTED
SE_DACL_PRESENT
SE_DACL_PROTECTED
SE_GROUP_DEFAULTED
SE_OWNER_DEFAULTED
SE_SACL_AUTO_INHERIT_REQ
SE_SACL_AUTO_INHERITED
SE_SACL_DEFAULTED
SE_SACL_PRESENT
SE_SACL_PROTECTED
SE_SELF_RELATIVE
ACCESS_ALLOWED_ACE
ACCESS_ALLOWED_OBJECT_ACE
ACCESS_DENIED_ACE
ACCESS_DENIED_OBJECT_ACE
container
control access right
validated write
Reset Password
User-Change-Password
Replicating Directory Changes
Replicating Directory Changes All
Add/Remove self as member
Validated write to service principal name