SSH 22

Checklist

  • Check for SSH version vulnerabilities

  • User enumeration possibilities

  • Verify if host keys match other systems

  • Test if password login is enabled (prompts for a password)

  • nmap -sV --script=ssh-hostkey -p22 10.10.10.10

  • Bruteforce if necessary with CeWL, Hydra, Patator, Crowbar

Commands and Tools

  • Banner Grabbing:

    nc -vn <target_ip> 22
    nmap -sV --script=ssh-hostkey -p22 <target_ip>
  • Nmap SSH Scripts:

    ls -lh /usr/share/nmap/scripts/ssh
    sudo nmap <target_ip> -p 22 -sV --script=ssh-hostkey
  • Key Scanning:

    ssh-keyscan -t rsa -p 22 <target_ip>

Brute Forcing

  • Hydra Brute Force:

    Good password lists:

  • NCRACK:


Private Keys

  • Using Found Private Keys:

  • Generate Private Keys:


System Administration

  • Check SSH Status:

  • Start/Stop/Restart SSH Server:

  • Verify SSH Process and Ports:


Metasploit Modules

  • Enumerate Users:


Exploitation

  • SSH Log Poisoning (Requires RCE Vulnerability):

    1. Log injection:

    2. Injected URL:

  • Remote Code Execution (RCE) via Username:

  • Escape Restricted Shell (Rbash):


Vulnerable Versions


Additional Notes

  • Forcing Specific Authentication Method:

  • Analyze Debug Output:

Last updated