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 credentialsUser-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_IPwith passwordL0vey0u1!Objective: Find the password of user "Will"
Systematic Approach
Common Discovery Patterns
Password in bash history - Previous commands containing Will's password
Configuration files - Application configs with embedded credentials
Text files - Documentation or note files with passwords
Environment variables - Process environment containing credentials
Memory extraction - Running processes with cached passwords
π‘ Key Takeaways for Linux Credential Hunting
File system is king - Linux stores most credentials in plain text files
History tells stories - Command history often contains credentials
Environment variables - Modern applications use env vars for secrets
SSH keys everywhere - Private keys are common and valuable
Log files reveal secrets - Applications often log credential errors
Container secrets - Docker/K8s environments have new credential stores
Process memory - Running applications may have credentials in memory
Configuration diversity - Every application has its own config format
HTB Academy methodology - Systematic file extension searches are highly effective
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