Credentials Hunting

Passwords
Passphrases
Keys

Username

User account

Creds

Users

Passkeys

Passphrases

configuration

dbcredential

dbpassword

pwd

Login

Credentials

Search tool

Lazagne

SessionGopher

EvilTree - Regex

  • Regex to look for passwords: -x ".{0,3}passw.{0,3}[=]{1}.{0,18}"

  • Keywords to look for sensitive info: -k passw,db_,admin,account,user,token

Findstr

Start at C:\Users

Find specific file

dir

Powershell

Cmdkey Saved Credentials

Run as another user

Passwords - Registry

The registry can be searched for keys and values that contain the word "password": reg query HKLM /f password /t REG_SZ /s

If you want to save some time, query this specific key to find admin AutoLogon credentials: eg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\winlogon"

On Kali, use the winexe command to spawn a command prompt running with the admin privileges (update the password with the one you found): winexe -U 'admin%password' //10.10.149.66 cmd.exe

Application Configuration Files

Start at C:\Users

Sensitive IIS information such as credentials may be stored in a web.config file

PowerShell History File

, PowerShell stores command history to the file:

C:\Users\<username>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

One-liner to retrieve the contents of all Powershell history files that we can access as our current user.

We should always recheck these files once we have local admin if our prior access did not allow us to read the files for some users.

PowerShell Credentials

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

Decrypting PowerShell Credentials

In the context of this user or abuse DPAPI

Enumerate shares

Network Shares

Manspider

Snaffler

Netexec

Other place to look

Autologon

Note: If you absolutely must configure Autologon for your windows system, it is recommended to use Autologon.exe from the Sysinternals suite, which will encrypt the password as an LSA secret.

Putty

Passwords in Group Policy in the SYSVOL share -

See Netexec - CME module gpp

NetExec - CME

Passwords in scripts in the SYSVOL share

See:

Password in scripts on IT shares

Passwords in web.config files on dev machines and IT shares

unattend.xml

Search unattend.xml:

Passwords in the AD user or computer description fields

  • See Netexec - CME module users

NetExec - CME

StickyNotes DB Files

Copy the three plum.sqlite* files down to our system and open them with a tool such as DB Browser for SQLite and view the Text column in the Note table with the query select Text from Note;.

With Powershell

Strings

KeePass databases

-> pull hash, crack and get loads of access. See Keepass

Found on user systems and shares

Files such as pass.txt, passwords.docx, passwords.xlsx found on user systems, shares, Sharepoint

Specific file

Find specific file

Other Interesting Files

DPAPI

DPAPI

Firefox

Lazagne

Netexec - CME

module firefox

Metasploit

Chrome

Dictionary Files

Browsers - All

Keepass databases kdbx

Email

Wifi

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.


CME - Interesting SMB modules

NetExec - CME

[*] winscp Looks for WinSCP.ini files in the registry and default locations and tries to extract credentials.

[*] iis Checks for credentials in IIS Application Pool configuration files using appcmd.exe

[*] rdcman Remotely dump Remote Desktop Connection Manager (sysinternals) credentials

Last updated