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
acls-dacls-sacls-aces.mdMarkdown159 lines14.5 KiBsource raw download

title: "ACLs - DACLs/SACLs/ACEs" section: "Windows" sectionSlug: "windows-hardening" sourcePath: "src/windows-hardening/windows-local-privilege-escalation/acls-dacls-sacls-aces.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/windows-local-privilege-escalation/acls-dacls-sacls-aces.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

ACLs - DACLs/SACLs/ACEs#

Access Control List (ACL)#

An Access Control List (ACL) consists of an ordered set of Access Control Entries (ACEs) that dictate the protections for an object and its properties. In essence, an ACL defines which actions by which security principals (users or groups) are permitted or denied on a given object.

There are two types of ACLs:

The process of accessing a file involves the system checking the object's security descriptor against the user's access token to determine if access should be granted and the extent of that access, based on the ACEs.[1]

Key Components#

System Interaction with ACLs#

Each user session is associated with an access token that contains security information relevant to that session, including user, group identities, and privileges. This token also includes a logon SID that uniquely identifies the session.

The Local Security Authority (LSASS) processes access requests to objects by examining the DACL for ACEs that match the security principal attempting access. Access is immediately granted if no relevant ACEs are found. Otherwise, LSASS compares the ACEs against the security principal's SID in the access token to determine access eligibility.[1]

Summarized Process#

ACEs#

There arey three main types of Access Control Entries (ACEs):[1]

Each ACE has four critical components:[1]

  1. The Security Identifier (SID) of the user or group (or their principal name in a graphical representation).
  2. A flag that identifies the ACE type (access denied, allowed, or system audit).
  3. Inheritance flags that determine if child objects can inherit the ACE from their parent.
  4. An access mask, a 32-bit value specifying the object's granted rights.

Access determination is conducted by sequentially examining each ACE until:[1]

Order of ACEs#

The way ACEs (rules that say who can or cannot access something) are put in a list called DACL is very important. This is because once the system gives or denies access based on these rules, it stops looking at the rest.[1]

There is a best way to organize these ACEs, and it is called "canonical order." This method helps make sure everything works smoothly and fairly. Here is how it goes for systems like Windows 2000 and Windows Server 2003:

This setup helps in two big ways:

By doing things this way, the owner of a file or folder can be very precise about who gets access, making sure the right people can get in and the wrong ones can't.

NTFS access control entry ordering diagram

So, this "canonical order" is all about making sure the access rules are clear and work well, putting specific rules first and organizing everything in a smart way.

GUI Example#

Example from here[2]

This is the classic security tab of a folder showing the ACL, DACL and ACEs:

http://secureidentity.se/wp-content/uploads/2014/04/classicsectab.jpg

If we click the Advanced button we will get more options like inheritance:

http://secureidentity.se/wp-content/uploads/2014/04/aceinheritance.jpg

And if you add or edit a Security Principal:

http://secureidentity.se/wp-content/uploads/2014/04/editseprincipalpointers1.jpg

And last we have the SACL in the Auditing tab:

http://secureidentity.se/wp-content/uploads/2014/04/audit-tab.jpg

Explaining Access Control in a Simplified Manner#

When managing access to resources, like a folder, we use lists and rules known as Access Control Lists (ACLs) and Access Control Entries (ACEs). These define who can or cannot access certain data.[1]

Denying Access to a Specific Group#

Imagine you have a folder named Cost, and you want everyone to access it except for a marketing team. By setting up the rules correctly, we can ensure that the marketing team is explicitly denied access before allowing everyone else. This is done by placing the rule to deny access to the marketing team before the rule that allows access to everyone.

Allowing Access to a Specific Member of a Denied Group#

Let's say Bob, the marketing director, needs access to the Cost folder, even though the marketing team generally shouldn't have access. We can add a specific rule (ACE) for Bob that grants him access, and place it before the rule that denies access to the marketing team. This way, Bob gets access despite the general restriction on his team.

Understanding Access Control Entries#

ACEs are the individual rules in an ACL. They identify users or groups, specify what access is allowed or denied, and determine how these rules apply to sub-items (inheritance). There are two main types of ACEs:

Each ACE contains important information like who the rule applies to (using a Security Identifier or SID), what the rule allows or denies (using an access mask), and how it's inherited by other objects.

Key Differences Between ACE Types#

In summary, ACLs and ACEs help define precise access controls, ensuring that only the right individuals or groups have access to sensitive information or resources, with the ability to tailor access rights down to the level of individual properties or object types.

Access Control Entry Layout#

ACE Field Description
Type Flag that indicates the type of ACE. Windows 2000 and Windows Server 2003 support six types of ACE: Three generic ACE types that are attached to all securable objects. Three object-specific ACE types that can occur for Active Directory objects.
Flags Set of bit flags that control inheritance and auditing.
Size Number of bytes of memory that are allocated for the ACE.
Access mask 32-bit value whose bits correspond to access rights for the object. Bits can be set either on or off, but the setting's meaning depends on the ACE type. For example, if the bit that corresponds to the right to read permissions is turned on, and the ACE type is Deny, the ACE denies the right to read the object's permissions. If the same bit is set on but the ACE type is Allow, the ACE grants the right to read the object's permissions. More details of the Access mask appear in the next table.
SID Identifies a user or group whose access is controlled or monitored by this ACE.

Access Mask Layout#

Bit (Range) Meaning Description/Example
0 - 15 Object Specific Access Rights Read data, Execute, Append data
16 - 22 Standard Access Rights Delete, Write ACL, Write Owner
23 Can access security ACL
24 - 27 Reserved
28 Generic ALL (Read, Write, Execute) Everything below
29 Generic Execute All things necessary to execute a program
30 Generic Write All things necessary to write to a file
31 Generic Read All things necessary to read a file

References#