Credential Hunting in Linux

🎯 Overview

Linux credential hunting focuses on discovering credentials stored in configuration files, history files, environment variables, and system logs after gaining access to a Linux system. Linux systems often contain:

  • SSH private keys and certificates

  • Database connection strings in application configs

  • API keys and tokens in environment files

  • Service account credentials in systemd units

  • Application passwords in configuration files

  • Command history with embedded credentials

  • Container secrets and orchestration configs

"In Linux environments, credentials are often stored in plain text configuration files, making systematic file hunting extremely effective."

🧠 Linux-Specific Credential Locations

System Configuration Directories

/etc/                    # System-wide configuration files
/etc/passwd              # User account information  
/etc/shadow              # Password hashes (requires root)
/etc/sudoers             # Sudo configuration
/etc/crontab             # Scheduled tasks with potential credentials
/etc/fstab               # Filesystem mounts (SMB/NFS credentials)
/etc/network/interfaces  # Network configuration
/etc/wpa_supplicant/     # WiFi credentials

User-Specific Locations

Application-Specific Paths

🎯 HTB Academy Enhanced Techniques

HTB Academy File Extension Search Method

One-liner approach for systematic file discovery by extension:

HTB Academy Log Analysis Method

Targeted log file analysis for authentication and credential events:

πŸ” File System Search Techniques

1. Find Command - File Discovery

2. Grep Command - Content Searching

3. Advanced Search Patterns

πŸ“‚ Specific Configuration File Hunting

SSH Configuration and Keys

Database Configuration Files

Web Application Configurations

πŸ•°οΈ History File Analysis

Command History Files

Application History Files

🌐 Environment Variables and Process Analysis

Environment Variable Hunting

Service and Daemon Analysis

πŸ“Š Log File Analysis

System Logs

Application-Specific Logs

πŸ”§ Linux-Specific Tools and Techniques

1. Mimipenguin - Linux Memory Credential Extraction

Mimipenguin extracts credentials from:

  • GNOME Keyring

  • VSFTPd processes

  • Apache2 processes

  • SSH agent processes

  • IRSSI IRC client

  • Various system processes

2. LaZagne for Linux

3. Firefox Decrypt - Browser Credential Extraction

Firefox credential files:

4. LinPEAS (Linux Privilege Escalation Awesome Scripts)

5. Custom Linux Credential Scripts

🐳 Container and Orchestration Credential Hunting

Docker Credential Hunting

Kubernetes Credential Hunting

πŸ” Memory and Process Credential Extraction

Process Memory Analysis

System Memory Analysis

πŸ“‹ Systematic Linux Credential Hunting Checklist

Phase 1: Initial Reconnaissance

Phase 2: File System Discovery

Phase 3: Content Analysis

Phase 4: History and Environment

Phase 5: Application-Specific Hunting

πŸ›‘οΈ Detection Evasion for Linux

Stealth Techniques

Cleanup Commands

🎯 HTB Academy Lab Example

Lab Scenario

  • Target: SSH access to Linux system

  • Initial Access: ssh kira@TARGET_IP with password L0vey0u1!

  • Objective: Find the password of user "Will"

Systematic Approach

Common Discovery Patterns

  1. Password in bash history - Previous commands containing Will's password

  2. Configuration files - Application configs with embedded credentials

  3. Text files - Documentation or note files with passwords

  4. Environment variables - Process environment containing credentials

  5. Memory extraction - Running processes with cached passwords

πŸ’‘ Key Takeaways for Linux Credential Hunting

  1. File system is king - Linux stores most credentials in plain text files

  2. History tells stories - Command history often contains credentials

  3. Environment variables - Modern applications use env vars for secrets

  4. SSH keys everywhere - Private keys are common and valuable

  5. Log files reveal secrets - Applications often log credential errors

  6. Container secrets - Docker/K8s environments have new credential stores

  7. Process memory - Running applications may have credentials in memory

  8. Configuration diversity - Every application has its own config format

  9. HTB Academy methodology - Systematic file extension searches are highly effective

  10. Memory-based tools - Mimipenguin complements file-based searches


This comprehensive guide covers Linux credential hunting techniques for post-exploitation scenarios and penetration testing engagements, enhanced with HTB Academy specific methods and tools.

Last updated