1. Resources
  2. Identity Threats
  3. Active Directory

Group Policy Object (GPO) Abuse

Also known as: GPO abuse, Group Policy modification, Malicious GPO, GPO immediate scheduled task, WriteGPLink abuse

An attacker who can edit a Group Policy Object, or link one to an OU, makes every computer and user in its scope run their commands, add their account to local Administrators, or grant them user rights.

Platform
Active Directory
Impact
Critical
Last updated
Attack difficulty
Medium
Detection difficulty
Medium
Privileges required: Specific rights or roles
Edit rights on a GPO that is linked to the targets (GenericAll, GenericWrite, WriteDacl, WriteOwner or SYSVOL write), or write access to gPLink on an OU, domain or site.
What the attacker gains
Code execution as SYSTEM or local administrator rights on every computer in the GPO's scope. With a GPO that reaches domain controllers, the domain.
Threat groups
APT41Cinnamon TempestIndrik SpiderStorm-0501VOID MANTICOREAPT-C-36APT28APT29APT3APT32APT33APT37APT38APT39and 46 more in MITRE ATT&CKGroups that MITRE ATT&CK records using T1484.001, T1053.005, T1037.001, T1037.003, T1098.007.

How it works

Group Policy is the configuration channel of Active Directory. A Group Policy Object (GPO) has two parts:

  • a directory object of class groupPolicyContainer under CN=Policies,CN=System,<domain DN>, which carries the display name, the version number, the list of client-side extensions to run, and the security descriptor;
  • a folder in SYSVOL, \\corp.example.com\SYSVOL\corp.example.com\Policies\{GUID}, which holds the settings as files.

A GPO applies where it is linked. The link is stored in the gPLink attribute of a site, the domain or an organizational unit, and every computer and user below that container processes the GPO unless security filtering, a WMI filter or blocked inheritance excludes them.

The Group Policy client on each computer runs as SYSTEM. It downloads the files and hands them to client-side extensions that create scheduled tasks, set local group membership, assign user rights, register scripts, install services and write registry values. Whoever controls the content of a GPO therefore controls what SYSTEM does on every computer in scope, without ever connecting to those computers.

There are two ways in:

  • Edit rights on a GPO that is already linked to the targets. The attacker adds a setting to it.
  • Link rights on a container. The attacker links a GPO they control (one they created or can edit) to an OU that holds the targets. Write access to gPLink on the OU is enough.

Settings that attackers add

  • Immediate scheduled task (Machine\Preferences\ScheduledTasks\ScheduledTasks.xml): runs a command as SYSTEM at the next policy refresh.
  • Local administrator (Machine\Microsoft\Windows NT\SecEdit\GptTmpl.inf, [Group Membership], or Preferences\Groups\Groups.xml): puts an account in local Administrators on every computer in scope.
  • Startup or logon script (Machine\Scripts\Startup, User\Scripts\Logon and scripts.ini): runs at the next restart as SYSTEM, or at the next logon as the user.
  • User rights assignment (GptTmpl.inf, [Privilege Rights]): grants a privilege such as SeDebugPrivilege or SeEnableDelegationPrivilege to an account.
  • Service configuration, registry values, software installation and security options work the same way.

A client only processes a setting when the GPO's versionNumber in the directory and Version in GPT.ini have increased and the matching extension GUID is listed in gPCMachineExtensionNames or gPCUserExtensionNames. Tools update all three; a hand edit of SYSVOL that misses one is ignored.

Prerequisites

One of the following, held directly or through a group:

  • GenericAll, GenericWrite, WriteDacl, WriteOwner or ownership on the GPO object, or the "Edit settings" delegation that the Group Policy Management Console grants.
  • Write access to the GPO's SYSVOL folder.
  • WriteProperty on gPLink (schema GUID f30e3bbe-9ff0-11d1-b603-0000f80367c1) on an OU, the domain or a site, plus a GPO the attacker can edit. Members of Group Policy Creator Owners can create GPOs and edit their own.

And the GPO must reach something useful: the link scope has to contain the target computers or users, and filtering must not exclude them.

Any domain user can read GPOs, links and their permissions:

Get-GPO -All | Select-Object DisplayName, Id, GpoStatus, ModificationTime, Owner
Get-GPInheritance -Target 'OU=Servers,DC=corp,DC=example,DC=com'
Get-GPPermission -Name 'Server Baseline' -All | Select-Object Trustee, Permission, Inherited

PowerView gives the same view without the Group Policy module, and the raw ACL shows who holds the link right on an OU:

Get-DomainGPO | Select-Object DisplayName, Name, gPCFileSysPath, WhenChanged

$gPLinkGuid = [guid]'f30e3bbe-9ff0-11d1-b603-0000f80367c1'
(Get-Acl -LiteralPath 'AD:\OU=Servers,DC=corp,DC=example,DC=com').Access | Where-Object {
  ($_.ActiveDirectoryRights -band [System.DirectoryServices.ActiveDirectoryRights]::WriteProperty) -and
  ($_.ObjectType -eq $gPLinkGuid -or $_.ObjectType -eq [guid]::Empty)
} | Select-Object IdentityReference, AccessControlType, ActiveDirectoryRights, IsInherited

BloodHound models these as GenericAll, GenericWrite, WriteDacl, WriteOwner and Owns edges to the GPO, GPLink from the GPO to its containers, and WriteGPLink to the container.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

The example assumes alice can edit the GPO Server Baseline, which is linked to the OU that holds SRV01.

1. Link a controlled GPO (link-right variant only)

With the link right on an OU and a GPO under the attacker's control:

New-GPLink -Name 'Workstation Updates' -Target 'OU=Servers,DC=corp,DC=example,DC=com' -LinkEnabled Yes

2. Add the malicious setting

SharpGPOAbuse edits the SYSVOL files and updates the version number and extension list in one step.

Immediate scheduled task that runs as SYSTEM on every computer in scope:

.\SharpGPOAbuse.exe --AddComputerTask --TaskName 'Update Check' `
  --Author 'CORP\Administrator' --Command 'cmd.exe' `
  --Arguments '/c whoami > C:\Windows\Temp\gpo-task.txt' `
  --GPOName 'Server Baseline' --Domain 'corp.example.com' --DomainController 'DC01.corp.example.com'

The --Author value is only text in the task definition; it gives the task no rights.

Local administrator:

.\SharpGPOAbuse.exe --AddLocalAdmin --UserAccount 'alice' `
  --GPOName 'Server Baseline' --Domain 'corp.example.com' --DomainController 'DC01.corp.example.com'

This writes a [Group Membership] line of the form *S-1-5-32-544__Members = *<SID>. That line is a replacement list: when a computer applies it, every member of local Administrators that is not on the line is removed, except the built-in Administrator. Domain Admins lose their local administrator rights on those hosts, which breaks management and gets noticed. If the GPO already has a [Group Membership] section the tool stops unless --Force is given, in which case it appends the account to the existing line.

Startup script (computer context) or logon script (user context):

.\SharpGPOAbuse.exe --AddComputerScript --ScriptName 'startup.bat' `
  --ScriptContents '@echo off & whoami > C:\Windows\Temp\gpo-startup.txt' `
  --GPOName 'Server Baseline' --Domain 'corp.example.com' --DomainController 'DC01.corp.example.com'

.\SharpGPOAbuse.exe --AddUserScript --ScriptName 'logon.bat' `
  --ScriptContents '@echo off & whoami > %TEMP%\gpo-logon.txt' `
  --GPOName 'Server Baseline' --Domain 'corp.example.com' --DomainController 'DC01.corp.example.com'

User right:

.\SharpGPOAbuse.exe --AddUserRights --UserRights 'SeTimeZonePrivilege' `
  --UserAccount 'alice' --GPOName 'Server Baseline' `
  --Domain 'corp.example.com' --DomainController 'DC01.corp.example.com'

A [Privilege Rights] line is also a complete list, so the accounts that held the right before lose it when the policy applies. Substituting SeDebugPrivilege, SeBackupPrivilege or SeEnableDelegationPrivilege turns this into a privilege escalation.

3. Wait for the refresh

Computers refresh policy in the background every 90 minutes with a random offset; domain controllers refresh every 5 minutes. An attacker with a session on a target can force it:

gpupdate /force
gpresult /scope computer /R
net localgroup Administrators

Scripts run at the next restart or logon, not at refresh. A user right appears in the account's token at its next logon.

Impact

One edit reaches every computer or user in the GPO's scope at once. The attacker gets SYSTEM on member servers and workstations, harvests the credentials stored and used there, and moves on; this is privilege escalation and lateral movement at the scale of an OU.

The scope decides the severity. A GPO linked to the Domain Controllers OU or to the domain root, such as the Default Domain Controllers Policy or the Default Domain Policy, gives SYSTEM on domain controllers and with it the domain. Ransomware operators use the same mechanism in the last stage of an intrusion: a GPO that disables security tools and a scheduled task that starts the encryptor on every machine.

The settings also persist. A scheduled task or local group member that the policy created stays on the computer after the GPO is cleaned, until someone removes it there.

OPSEC and artifacts

  • Editing an existing GPO instead of creating one. A new GPO and a new link are two more directory changes. Editing a GPO that already reaches the targets changes only its versionNumber and extension attributes, recorded as event 5136 on the groupPolicyContainer object when a SACL covers it. A link change is a 5136 for gPLink on the container.
  • Version number jump. Every tool increments versionNumber and GPT.ini. A GPO whose version changed with no change record is visible in any baseline.
  • SYSVOL writes. The new or changed file (ScheduledTasks.xml, GptTmpl.inf, scripts.ini, a script file) stays in SYSVOL and replicates to every domain controller. With Detailed File Share auditing the write request is event 5145 on the domain controller, with the attacker's account and address.
  • Narrow scope and quick removal. Operators add security filtering for one computer, or remove the setting after the first refresh. The removal is another directory and SYSVOL change, and what the policy did on the target remains.
  • On the target: the task. An immediate task is registered and run by the Group Policy client. Event 4698 records the task and its XML when Audit Other Object Access Events is on, followed by process creation (4688) under the Task Scheduler service.
  • On the target: the group. A local Administrators change is event 4732, and the removal of the previous members is 4733. The replacement semantics make this loud.
  • Policy processing. The Group Policy operational log on the target lists the GPOs applied in each cycle, and gpresult shows the winning GPO for each setting.

Detection

  • GPO object changes. Event 5136 on groupPolicyContainer objects by an account that does not administer Group Policy, outside a change window. The GPO modified detection rules cover the directory side.
  • Link changes on sensitive containers. A 5136 for gPLink on the domain root, the Domain Controllers OU or a server OU.
  • SYSVOL file writes. Event 5145 with a write access mask on ScheduledTasks.xml, GptTmpl.inf, Groups.xml, scripts.ini or files under Scripts, from a workstation address. Legitimate edits come from the management hosts of a few administrators.
  • User rights delivered by policy. A new holder of a sensitive privilege. See the sensitive user right assigned rules.
  • Effects on endpoints. The same new scheduled task (4698) or the same local Administrators change (4732) appearing on many computers within one refresh interval.
  • Permission changes on GPOs. A new edit delegation, or an ownership change, on a GPO is often the step before the abuse. Event 4662 records the WRITE_DAC access when a SACL covers the object.
// Changes to GPO objects and GPO links
SecurityEvent
| where EventID == 5136
| where EventData has "groupPolicyContainer" or EventData has "gPLink"
| project TimeGenerated, Computer, Account, EventData
| order by TimeGenerated desc

Legitimate Group Policy administration produces the same events. The useful discriminators are the actor, the source host, the change calendar and the content of the changed file.

Mitigation

  • Restrict who can edit GPOs. Review the delegation of every GPO and remove edit rights, GenericAll, GenericWrite, WriteDacl, WriteOwner and ownership held by groups outside the team that manages policy. GPOs linked to the domain root and to Domain Controllers are Tier 0 objects and need Tier 0 editors only.
  • Restrict who can link. Review WriteProperty on gPLink and broad write grants on OUs, the domain object and sites. OU delegations for helpdesk tasks often include it by accident.
  • Keep Group Policy Creator Owners small, and check the ownership of the GPOs its members created.
  • Protect SYSVOL. The NTFS permissions of each policy folder should match the GPO's delegation. Look for folders that are writable by wider groups.
  • Audit. Enable Directory Service Changes with SACLs on the Policies container and on OUs, and Detailed File Share on domain controllers. The Active Directory audit policy guide has the settings.
  • Baseline and review. Keep backups of all GPOs and compare version numbers, links and file hashes on a schedule. The gpresult and RSoP audit guide shows how to verify what actually applies to a computer.
  • Administer policy from Tier 0. Edit GPOs only from privileged access workstations, as described in the Active Directory hardening guide.
  • Recover on both sides. Restore the GPO from a known-good backup and remove the link, then clean the computers that applied it: remove the task, script and service, and restore the full local Administrators membership and user rights lists, because the policy replaced them.

Detection rules for this attack

Log events to collect

FAQ

What permissions are needed to abuse a GPO?

Either the right to edit a GPO that is already linked to the targets, or the right to link a GPO to their OU. Edit rights come from the GPO's Edit settings delegation, GenericAll, GenericWrite, WriteDacl or WriteOwner on the GPO object, or write access to its SYSVOL folder. The link right is write access to the gPLink attribute of the OU, domain or site.

How fast does a malicious GPO take effect?

Computers and users refresh policy in the background every 90 minutes with a random offset of up to 30 minutes, and domain controllers every 5 minutes. An immediate scheduled task runs at that next refresh. Startup scripts wait for a restart and logon scripts for the next logon.

Is membership in Group Policy Creator Owners enough?

Not by itself. Members can create GPOs and edit the ones they created, but a new GPO does nothing until it is linked. The attacker also needs write access to gPLink on a container that holds the targets, or an existing link to a GPO they own.

How do you detect GPO abuse?

Audit changes to groupPolicyContainer objects and to the gPLink attribute (event 5136), and file writes under SYSVOL Policies (event 5145), especially ScheduledTasks.xml, GptTmpl.inf, Groups.xml and scripts.ini. On the targets, event 4698 records the task that the policy registers and 4732 the local group change.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.