Credential Hunting

Credential Hunting

Search for Passwords

findstr /si password *.xml *.ini *.txt
findstr /s /i cred n:*.*
dir .s *pass* == *.config
dir /s *pass* == *cred* == *vnc* == *.config*

Get-ChildItem -Path C:\ -Include *.kdbx -File -Recurse -ErrorAction SilentlyContinue

Get-ChildItem -Path C:\xampp -Include *.txt,*.ini -File -Recurse -ErrorAction SilentlyContinue

Get-ChildItem -Path C:\Users\<USERNAME>\ -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx,*.vbs -File -Recurse -ErrorAction SilentlyContinue

Get-ChildItem -Path "C:\Users\<USERNAME>" -Recurse -Include *.txt,*.xml,*.ini,*.conf -File -ErrorAction SilentlyContinue | Select-String -Pattern "password|passwd|pass|name|login|user|username"

Saved Credentials

cmdkey /list

Run Commands as Another User

Application Configuration Files

Dictionary Files

Chrome Dictionary Files

Unattended Installation Files

Unattended installation files may define auto-logon settings or additional accounts to be created as part of the installation. Passwords in the unattend.xml are stored in plaintext or base64 encoded.

PowerShell History File

Confirming PowerShell History Save Path

Reading PowerShell History File

We can also use this one-liner to retrieve the contents of all Powershell history files that we can access as our current user.

PowerShell Credentials

PowerShell credentials are often used for scripting and automation tasks as a way to store encrypted credentials conveniently.

Take, for example, the following script Connect-VC.ps1, which a sysadmin has created to connect to a vCenter server easily.

Decrypting PowerShell Credentials

PSCredential Object

Local Administrator Password Solution (LAPS)

Search the Registry for Passwords

Dumping Credentials

Other files

Manually Searching the File System for Credentials

Sticky Notes Passwords

Looking for StickyNotes DB Files

C:\Users<user>\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite

This can also be done with PowerShell using the PSSQLite module.

Internet Information Service (IIS)

## Other Files of Interest

Further Credential Theft

Browser Credentials

We can use a tool such as SharpChrome to retrieve cookies and saved logins from Google Chrome.

Lazagne

When all else fails, we can run the LaZagne tool in an attempt to retrieve credentials from a wide variety of software.

SessionSopher

We can use SessionGopher to extract saved PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP credentials.

We need local admin access to retrieve stored session information for every user in HKEY_USERS, but it is always worth running as our current user to see if we can find any useful credentials.

Windows Autologon

Windows Autologon is a feature that allows a user to configure their Windows operating system to automatically log on to a specific user account, without requiring manual input of the username and password at each startup.

The registry keys associated with Autologon can be found under HKEY_LOCAL_MACHINE in the following hive, and can be accessed by standard users:

The typical configuration of an Autologon account involves the manual setting of the following registry keys:

  • AdminAutoLogon - Determines whether Autologon is enabled or disabled. A value of "1" means it is enabled.

  • DefaultUserName - Holds the value of the username of the account that will automatically log on.

  • DefaultPassword - Holds the value of the password for the user account specified previously.

Putty

For Putty sessions utilizing a proxy connection, when the session is saved, the credentials are stored in the registry in clear text.

Enumerating Sessions and Finding Credentials

Wifi Passwords

If we obtain local admin access to a user's workstation with a wireless card, we can list out any wireless networks they have recently connected to.

Retrieving Saved Wireless Passwords

Last updated