Lab
SSH enumeration lab. The goal is to read the SSH server's version and banner, list its supported algorithms and host key, work out the authentication method for two users, and pull a flag with an Nmap SSH script.
Tasks
- What is the version of SSH server.
- Fetch the banner using netcat and check the version of SSH server.
- Fetch pre-login SSH banner.
- How many "encryption_algorithms" are supported by the SSH server.
- What is the ssh-rsa host key being used by the SSH server.
- Which authentication method is being used by the SSH server for user "student".
- Which authentication method is being used by the SSH server for user "admin".
- Fetch the flag from /home/student/FLAG by using nmap ssh-run script.
Find SSH Version with Nmap
A version and OS scan against port 22 gives the SSH server version.
nmap -sV -O -p22 192.102.62.3
Banner Grabbing with Netcat
Connecting with netcat prints the banner, which also carries the version.
nc 192.102.62.3 22
Fetch Pre-Login SSH Banner
Find Encryption Algorithm's with Nmap
The ssh2-enum-algos script lists every algorithm the server offers, including the encryption algorithms.
nmap -p22 192.102.62.3 --script=ssh2-enum-algos
Find SSH Host Key with Nmap
nmap -p22 192.102.62.3 --script=ssh-hostkey --script-args ssh_hostkey=full
Find Authentication Method for Student with Nmap
nmap -p22 192.102.62.3 --script=ssh-auth-methods --script-args="ssh.user=student"
Find Authentication Method for Admin with Nmap
nmap -p22 192.102.62.3 --script=ssh-auth-methods --script-args="ssh.user=admin"