linuxLinux Local Password Attacks

Overview of Credential Hunting

Credential hunting is a critical phase in penetration testing and privilege escalation, involving systematic exploration of various system sources to uncover sensitive authentication information.

Key Credential Sources

1. File-based Credential Sources

  • Configuration files

  • Databases

  • Notes and scripts

  • Cronjobs

  • SSH Keys

2. Historical Information Sources

  • Command history

  • Bash-related files

  • Log files

3. Memory and Credential Storage

  • System memory

  • Browser credentials

  • Keyrings

Systematic Credential Extraction Methodology

1. Configuration Files Reconnaissance

  • Command for Scanning Configuration Files:

  • Key Search Strategies:

    • Look for files with .conf, .config, .cnf extensions

    • Use grep to search for keywords: user, password, pass

    • Exclude unnecessary system directories

2. Database File Discovery

  • Command for Database File Hunting:

  • Focus Areas:

    • SQL databases

    • .db files

    • Hidden database files

3. SSH Key Exploration

  • Private Key Search:

  • Public Key Search:

4. Comprehensive Log Analysis

  • Log File Scanning Command:

Credential Extraction Tools

1. MimiPenguin

  • Purpose: Memory credential extraction

  • Usage:

2. LaZagne

  • Comprehensive Credential Extraction

  • Command:

  • Supports Extraction From:

    • WiFi

    • Browsers

    • SSH

    • Keyrings

    • Multiple other sources

3. Firefox Decrypt

  • Usage:

Password Cracking Workflow

1. Hash Extraction

  • Use unshadow to combine /etc/passwd and /etc/shadow files

2. Hashcat Cracking Techniques

  • SHA-512 Hash Cracking:

  • MD5 Hash Cracking:

3. John Cracking Techniques

  • SHA-512 Hash Cracking:

Critical Recommendations

  • Always adapt your approach to the specific system environment

  • Understand the system's purpose and network role

  • Be systematic and thorough in your search

  • Respect legal and ethical boundaries during penetration testing

Useful Log Locations

  • /var/log/messages

  • /var/log/syslog

  • /var/log/auth.log

  • /var/log/secure

  • /var/log/faillog

  • MimiPenguin: https://github.com/huntergregal/mimipenguin

  • LaZagne: https://github.com/AlessandroZ/LaZagne

  • Firefox Decrypt: https://github.com/unode/firefox_decrypt