Skip to content

Identity Security: GPO Architecture, Forensics & Abuse

To forensically analyze or defend against GPO abuse, analysts must understand that a GPO is not a single file. It is a virtual object split into two distinct components stored in different locations across the Domain Controllers.

Group Policy Container (GPC)

Stored within the Active Directory LDAP database (ntds.dit). It holds the logical properties of the GPO, including its version, status, and the Access Control Lists (ACLs) that dictate who can modify it.

Group Policy Template (GPT)

Stored on the file system within the SYSVOL share (\\<domain>\SYSVOL\<domain>\Policies\{GUID}). This folder contains the actual physical configuration files, registry policy files (Registry.pol), and scripts that the client machines download and execute.

Client machines process and apply GPOs hierarchically. If conflicts arise, the last policy applied wins. The order is: Local → Site → Domain → Organizational Unit (OU).

2. Forensic Baseline: Auditing the Environment

Section titled “2. Forensic Baseline: Auditing the Environment”

During incident response, distinguishing between legitimate IT configurations and an attacker’s malicious modifications requires establishing a baseline.

  • The Theoretical Baseline (GPMC): Request an HTML report from the Group Policy Management Console (GPMC). This shows the intended configuration across the domain.
  • The Ground Truth (Client-Side): Execute gpresult /h report.html on a compromised endpoint. This reveals the actual Resultant Set of Policy (RSoP) applied to the machine. A discrepancy between the GPMC report and the gpresult output is a critical forensic finding.

Legacy Threat: The cPassword Flaw (CVE-2014-1812)

Section titled “Legacy Threat: The cPassword Flaw (CVE-2014-1812)”

Historically, administrators used Group Policy Preferences (GPP) to push local administrator passwords to workstations. These passwords were stored in the SYSVOL share inside a Groups.xml file, encrypted with an AES key that Microsoft accidentally published on MSDN. Threat actors routinely scan SYSVOL for these files to achieve immediate privilege escalation.

Adversaries abuse GPOs through two primary vectors: directly modifying the GPO via misconfigured permissions, or bypassing permissions via authentication relaying.

Using tools like BloodHound, attackers map the domain to find GPOs where a compromised low-privileged user or group has GenericWrite, GenericAll, or WriteDacl permissions.

Using tools like SharpGPOAbuse, the attacker modifies the GPO to establish persistence across all machines in the OU:

  • Scheduled Tasks: Injecting an immediate scheduled task to download and execute a Cobalt Strike beacon.
  • Local Admin Rights: Pushing a Restricted Groups policy to add the attacker’s domain account to the local Administrators group of every machine.

B. The “GPOddity” Attack (NTLM Relay to LDAP)

Section titled “B. The “GPOddity” Attack (NTLM Relay to LDAP)”

As researched by Synacktiv, GPOddity represents a highly sophisticated attack path exploiting the very nature of GPC and GPT synchronization. If an attacker coerces a machine (e.g., using PetitPotam) to authenticate to an attacker-controlled machine via NTLM, the attacker can Relay the NTLM authentication to the Domain Controller’s LDAP service.

Over LDAP, the attacker modifies the gPCMachineExtensionNames attribute of a GPO applied to the victim machine, instructing it to pull a malicious Group Policy Template (GPT) hosted on a rogue SMB server controlled by the attacker, leading to instantaneous Remote Code Execution (RCE).

Because GPOs are modified legitimately by IT staff, behavioral anomalies are key. The primary artifact for tracking GPO modification on a Domain Controller is Event ID 5136 (A directory service object was modified).

hunt_gpo_modifications.kql
// Detects modifications to Group Policy Objects in Active Directory
IdentityDirectoryEvents
| where ActionType == "Directory Service Object Modified"
| where ObjectType == "Group Policy Object"
// Extract the exact property modified
| extend ModifiedAttribute = tostring(AdditionalFields.ModifiedAttribute)
| extend PreviousValue = tostring(AdditionalFields.PreviousValue)
| extend NewValue = tostring(AdditionalFields.NewValue)
// Filter out expected administrative accounts
| where AccountUpn !in~ ("domain_admin1@corp.local", "svc_gpo_mgmt@corp.local")
| project TimeGenerated, TargetDeviceName, AccountUpn, ObjectName, ModifiedAttribute, NewValue
| sort by TimeGenerated desc
  1. Tiered Administration: GPOs that apply to Tier 0 assets (Domain Controllers) must only be editable by Tier 0 accounts. Ensure that no standard users or helpdesk groups hold GenericWrite permissions over critical GPOs.
  2. Require SMB Signing & LDAP Channel Binding: To neutralize the GPOddity and other NTLM relay attacks against LDAP, enforce LDAP Channel Binding and require SMB signing across the entire domain.
  3. Monitor SYSVOL Integrity: Implement File Integrity Monitoring (FIM) or specialized Sysmon rules on the Domain Controllers to alert on unauthorized file writes inside the \\SYSVOL\...\Policies\ directories.