~/hunting-windows

Hunting (Windows)

CPTS Notes3 min read

TL;DR

Users and apps leave passwords in plain files, config, and insecure credential stores. Hunting is searching the host for them by keyword. Dumping the credential stores is the sibling job in Looting (Windows).

Base the search on what the box is for. An IT admin’s workstation holds connection configs and saved sessions a kiosk never would, so the machine’s role tells you where to look.

What to search for

The same handful of terms surface most credentials:

password passwd pwd cred credential key
user username login connectionString secret

Search the filesystem

findstr searches file contents across many types at once:

findstr /SIM /C:"password" *.txt *.ini *.cfg *.config *.xml *.ps1 *.yml

/S recurses subdirectories, /I ignores case, /M prints only the filenames that match, and /C: takes the search string. PowerShell does the same with native cmdlets:

Get-ChildItem -Recurse -Include *.txt,*.ini,*.config,*.xml,*.ps1 -ErrorAction SilentlyContinue | Select-String -Pattern "password"

With a GUI session, Windows Search also indexes file contents and settings for a quick keyword pass.

Pull from apps with LaZagne

Browsers and sysadmin tools store credentials, often reversibly. LaZagne decrypts them from dozens of applications. Transfer the standalone LaZagne.exe to the target, then run every module:

LaZagne.exe all # run all modules
LaZagne.exe all -vv # same, verbose, to see each app it checks
Module Pulls from
browsers Saved logins in Chromium, Firefox, Edge, and others
sysadmin Config files for WinSCP, OpenVPN, and similar tools
windows LSA secrets, Credential Manager, and cached creds
mails Outlook and Thunderbird mailboxes
wifi Saved WiFi passwords
memory KeePass and LSASS in memory

Browsers are the richest target: they store site logins reversibly for the logged-on user, so the browsers module often returns plaintext.

High-value spots

Some locations pay off often enough to check on every host:

  • SYSVOL share on a DC: GPP Groups.xml with a cpassword, and credentials hardcoded in logon scripts. Decrypt the cpassword with gpp-decrypt from SMB.
  • unattend.xml, sysprep.xml, and web.config: deployment and app files that keep service-account passwords.
  • AD description fields on user and computer objects, where admins sometimes park a password.
  • KeePass databases (.kdbx): crack the master password in Protected files, then every stored credential opens.
  • Named files such as pass.txt, passwords.docx, and passwords.xlsx on user profiles, shares, and SharePoint.

A credential found here often works on other hosts and services, so test every one across the network.