Skillfade Logo

Post Eploitation Loot - Finding Credentials

⏳ 9 min read

Table of Contents

    Cybersecurity Illustration

    I could smell the copper in the air, wires humming beneath synthetic neon light, the constant electric thrum of servers breathing like beasts in a cage. I was inside the guts of the network, drift-walking among switches, routers, firewalls, VPN endpoints. Somewhere in a forgotten directory, credentials glowed like a jackpot in a slot machine. That’s where I was headed.

    Boot prints sparkled on login shells, memory pages flickered with secrets. An IDS whispered in binary. My fingertips itched for hashes, plaintext, encrypted blobs I could crack. In that concrete corridor of racks and blinking LEDs I knew: once you have a toehold, finding credentials is one of the richest scores. But the scope is treacherous and nuanced: misstep and alarms will wake.


    Hunting Credentials: A Hands-On Guide

    Below you will find structured workflows and checklists to guide your post-exploitation credential gathering. Always operate in legally authorised labs or engagements.


    1. Reconnaissance: Locating Credential Stores

    Step-by-step:

    1. Enumerate user accounts and group memberships.
      - On Linux: getent passwd, getent group.
      - On Windows: whoami /all, net user /domain.
    2. Find configuration files that may contain plaintext credentials.
      - Search web apps: config.php, settings.yml, .env, application.properties.
      - Look into service directories: /etc/, /opt/, C:\Program Files\….
    3. Scan for credential caches or database files.
      - SQLite, MySQL .cnf, PostgreSQL pg_hba.conf, .ppk keys, SSH private keys.
    4. Dig into memory and pagefile/swap to find credentials in memory.
      - Tools such as mimikatz on Windows, gcore or proc-dump on Linux.

    Checklist:

    • [ ] User‐lists enumerated
    • [ ] Configuration files located
    • [ ] Service credentials discovered
    • [ ] Private keys or certificates found
    • [ ] Memory and swap inspected

    2. Password Hashes and Offline Cracking

    Step-by-step:

    1. Dump password hashes.
      - Windows: reg save of SAM and SYSTEM then secretsdump.py from Impacket.
      - Linux: Extract /etc/shadow, /etc/passwd with root privilege.
    2. Transfer hashes to your local system for cracking.
    3. Use tools like john, hashcat, oclHashcat with wordlists and rules. Focus common hash types: NTLM, LM, bcrypt, SHA variants.
    4. Hydrate salts and slow algorithms by GPU if possible. Prioritize weak or reused passwords.

    Warning: Tools and snippets here may be considered offensive or adversarial. Use only in controlled and authorised environments.

    bash
    # Linux hash dump
    sudo cp /etc/shadow ~/loot/shadow.dump
    sudo cp /etc/passwd ~/loot/passwd.dump
    
    bash
    # Cracking with John the Ripper
    john --wordlist=/usr/share/wordlists/rockyou.txt --format=sha512crypt ~/loot/shadow.dump
    

    Checklist:

    • [ ] Hash dumps extracted
    • [ ] Hash file integrity checked
    • [ ] Appropriate cracking tool selected
    • [ ] Wordlists and rules in place
    • [ ] Progress monitored (time, success rates)

    3. Pass-the-Hash, Pass-the-Ticket, Kerberoasting

    Step-by-step:

    1. Pass-the-Hash (PTH)
      - On a compromised Windows host, collect NTLM hash.
      - Use tools like pth-winexe, wmiexec.py, Impacket to authenticate with hash without knowing the password.

    2. Pass-the-Ticket (PTT)
      - Dump Kerberos ticket cache: klist or mimikatz.
      - Import and reuse service tickets for lateral movement.

    3. Kerberoasting
      - Identify service principal names (SPNs) in AD.
      - Request service tickets, save them, extract them, crack offline.

    Checklist:

    • [ ] NTLM hashes captured
    • [ ] SPNs enumerated
    • [ ] Tickets dumped
    • [ ] Tickets cracked or reused
    • [ ] Lateral access confirmed

    4. SSH Keys, Certificate Stores and Privilege Escalation

    Step-by-step:

    1. Search home directories for SSH private keys: ~/.ssh/id_rsa, ~/.ssh/id_ed25519.
    2. Inspect certificate stores on Windows: certlm.msc, certmgr.msc.
    3. Look for code signing or deployment certificates.
    4. If privileged, use SSH agent forwarding or impersonation.

    Code Snippet for SSH Key Search on Linux:

    bash
    # Warning: use only in authorised lab environments
    find /home -type f \( -name "id_rsa" -o -name "identity" \) -exec ls -l {} \;
    

    Checklist:

    • [ ] Private keys located
    • [ ] Permissions verified (are the keys readable?)
    • [ ] Certificates checked for private part
    • [ ] Agent or forwarding possibilities explored
    • [ ] Privilege escalated via key reuse or cert trust

    5. Memory Forensics and Live System Extraction

    Step-by-step:

    1. Dump process memory of services likely to hold credentials (e.g. browser, VPN client, web server).
      - On Linux: gcore, proc-dump on specific PIDs.
      - On Windows: mimikatz, procdump.
    2. Extract credentials from dumps. Look for patterns: password=, passwd, pwd, token=, base64 blobs.
    3. Examine pagefile or swap for residue.

    Checklist:

    • [ ] Processes of interest identified
    • [ ] Memory dumps obtained
    • [ ] Strings or patterns searched
    • [ ] Swap/pagefile processed
    • [ ] Secret artifacts extracted

    Mini-Lab: Putting It All Together

    In a virtual lab, build a small AD network with one domain controller and two member hosts. Plant credentials in configuration files, set up one service using Kerberos (with SPNs), and install SSH on the Linux host with a private key. Perform:

    • Hash dumping from Linux and Windows
    • Kerberoasting and cracking service tickets
    • Searching for SSH keys and certs
    • Memory forensics on a process hosting credentials

    Record every step. Time each phase. Observe systems generate logs and responses.


    Actionable Takeaways

    • Every file system and process may hold credentials; configuration files and memory are gold mines.
    • Hashes are not dead; PTH, PTT and offline cracking still yield movement.
    • SSH keys and certs often overlooked yet powerful vectors.
    • Memory forensics is powerful but noisy; you need precision tools and pattern recognition.

    Post-Exploitation Loot: Finding Credentials , A Step-by-Step Guide


    Aim

    To equip you with practical skills for discovering credentials during the post-exploitation phase, enabling you to locate and extract sensitive authentication material from compromised systems in a focused, efficient and ethical manner.


    Learning outcomes

    By the end of this guide you will be able to:

    • Identify typical storage locations and formats for credentials on Windows, Linux and macOS systems.
    • Use command-line tools and scripting to locate clear-text passwords, hashes, tokens or keys.
    • Extract credentials securely and responsibly, understanding legal and ethical boundaries.
    • Apply automated and manual techniques for credential discovery in real-world post-exploitation scenarios.

    Prerequisites

    To follow this guide you will need:

    • A test lab or sandbox environment (virtual machines) running Windows, Linux or macOS.
    • Administrator or root access on the target system, or the equivalent level of privilege.
    • Tools such as grep, find, strings, PowerShell, Python 3, and optionally credential-dumping tools (e.g. Mimikatz for Windows).
    • Basic familiarity with shell scripting, file system layout, privilege escalation and process listing.

    Step-by-Step Instructional Guide

    1. Survey credential stores and configuration files

    • On Linux/macOS, search common configuration directories for files with credential info:
    bash
      find /etc -type f \( -iname "*.conf" -o -iname "*.ini" -o -iname "*.env" \) -exec grep -H -R "password\|passwd\|secret\|key" {} \;
    
    • On Windows, inspect web-config files, .config-format application files, or .ini and .env equivalents, for lines containing password, Pwd, Secret, Key.

    2. Extract credentials from memory and running processes

    • On Linux, use tools such as grep and strings against process memory or /proc/<pid>/mem (if permitted):
    bash
      sudo strings /proc/$(pgrep <service_name>)/mem | grep -i "password"
    
    • On Windows with PowerShell, list running processes and dump memory segments (requires privilege). Example to list credentials in process command-line:
    powershell
      Get-Process | Where-Object { $_.Path } | ForEach-Object {
        try {
          $cmd = ($_ | Select-Object -ExpandProperty StartInfo).Arguments
          if ($cmd -match "password|pwd|secret") {
            Write-Output "Process $($_.Id): $cmd"
          }
        } catch { }
      }
    

    3. Find password hashes and cached credentials

    • On Linux systems using /etc/shadow and /etc/passwd:
    bash
      sudo unshadow /etc/passwd /etc/shadow > combined.txt
    

    Review hashes in combined.txt for cracking or offline analysis.

    • On Windows, using built-in tools or scripts retrieve cached credentials or hashes. For example, use PowerShell to dump SAM database (administrator privilege needed):
    powershell
      reg save HKLM\SAM C:\Temp\SAM
      reg save HKLM\System C:\Temp\System
    

    Then extract and decode hashes using appropriate third-party tools.

    4. Harvest tokens, certificates and keys

    • Search for SSH private keys on Linux/macOS:
    bash
      find /home -type f -iname "id_rsa" -o -iname "*.pem" -exec ls -l {} \;
    
    • On Windows, inspect certificate stores via PowerShell:
    powershell
      Get-ChildItem -Path Cert:\LocalMachine\My
      Get-ChildItem -Path Cert:\CurrentUser\My
    
    • Extract private keys where accessible. Backup or export with care, e.g.:
    powershell
      $cert = Get-ChildItem Cert:\LocalMachine\My\<Thumbprint>
      Export-Pkcs12 -Cert $cert -FilePath C:\Temp\cert.pfx -Password (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force)
    

    5. Automate discovery with scripting

    • Example Python script scanning for credential-like strings in text files under a given directory:
    python
      import os
      import re
    
      pattern = re.compile(r"(?:password|pwd|secret|key)\s*[:=]\s*.+", re.IGNORECASE)
      for root, dirs, files in os.walk("/etc"):
          for fname in files:
              path = os.path.join(root, fname)
              try:
                  with open(path, "r", encoding="utf-8", errors="ignore") as f:
                      for lineno, line in enumerate(f, 1):
                          if pattern.search(line):
                              print(f"{path}:{lineno}: {line.strip()}")
              except:
                  continue
    
    • Save this as cred_finder.py and run with elevated privileges to scan sensitive directories.

    6. Validate, protect and exfiltrate responsibly

    • Once credentials are found, verify them (where legal and appropriate) using safe methods, such as attempting SSH login to a non-production server.
    • Remove or neutralise any credentials exposed by your own actions to avoid unintended leakage in your lab.
    • Log findings responsibly; redact sensitive content when documenting.

    Use these steps in your hands-on environments to practise safe, practical credential discovery.

    I saw the firewall blink red, I saw VPN tunnels pulse, I felt credentials shimmering in base64, NTLM, plaintext. The hunt never ends but once you taste the looted secret you know what to look for next time, where to prick the vein of trust in the network. In the neoned wires of servers you carry the smell of passwords, tickets, hashes you cracked. You are both the predator and the technician. Remain curious, stay dangerous, respect the codes.