π‘οΈSSHuttle Pivoting
π Module Overview
Purpose: Automated SSH pivoting with transparent traffic routing Tool: sshuttle - Python-based SSH tunnel manager Key Feature: Automatic iptables configuration (no proxychains needed) Protocol: SSH-only (no TOR/HTTPS proxy support) Advantage: Direct tool usage without proxy configuration
1. Introduction to sshuttle
What is sshuttle?
Language: Python-based networking tool
Function: Automated SSH pivot with transparent routing
Mechanism: Creates iptables rules for traffic redirection
Scope: SSH tunneling only (no other protocols)
Philosophy: "VPN over SSH" approach
sshuttle vs Traditional Methods
Aspect
sshuttle
SSH + proxychains
Setup
Single command
SSH tunnel + proxychains config
iptables
Automatic
Manual/none
Application Support
All TCP traffic
SOCKS-aware only
Transparency
Completely transparent
Requires proxy awareness
Performance
High (kernel-level)
Lower (userspace proxy)
Protocol Support
SSH only
SSH/SOCKS/HTTP/TOR
Key Advantages
No proxychains configuration required
Automatic iptables management for routing
Transparent operation - tools work normally
Kernel-level routing - better performance
Simple command syntax - easy to use
Limitations
SSH-only protocol support
No TOR/HTTPS proxy integration
Requires root privileges for iptables
TCP traffic only (no UDP support with default method)
Python dependency required
2. Installation and Setup
Installing sshuttle
Ubuntu/Debian Systems
Alternative Installation Methods
Verification
3. Basic sshuttle Usage
Network Topology
Basic Command Syntax
Expected Connection Output
iptables Rules Creation
4. Direct Tool Usage (No Proxychains)
Transparent nmap Scanning
Direct Tool Benefits
5. Advanced sshuttle Options
Authentication Methods
Password Authentication
Key-based Authentication
Multiple Network Routing
DNS Routing
Advanced Options
6. HTB Academy Lab Exercise
Lab Challenge
Task: "Try using sshuttle from Pwnbox to connect via RDP to the Windows target (172.16.5.19) with 'victor:pass@123'"
Complete Solution
Step 1: Install sshuttle (if needed)
Step 2: Establish sshuttle Tunnel
Step 3: Verify Network Routing
Step 4: RDP Connection
Step 5: Verification and Cleanup
Step 6: Submit Answer
7. sshuttle vs Other Pivoting Methods
Comprehensive Comparison
Method
Setup Complexity
Tool Transparency
Performance
Protocol Support
sshuttle
Low (single command)
High (fully transparent)
High (kernel-level)
SSH only
SSH + proxychains
Medium (config files)
Medium (SOCKS-aware)
Medium (userspace)
Multiple protocols
Meterpreter
High (payload + handler)
Low (manual forwarding)
Medium
Multiple protocols
Socat
Medium (multiple commands)
Low (manual setup)
High
Any TCP/UDP
Plink + Proxifier
High (Windows GUI config)
High (app-specific)
Medium
Windows-centric
When to Use sshuttle
β SSH access available to pivot host β Transparent tool usage required β Multiple tools need network access β Performance is critical (kernel routing) β Simple setup preferred over complex configurations
When NOT to Use sshuttle
β No SSH access (use Meterpreter/Socat) β UDP traffic required (use SSH local forwards) β TOR/HTTP proxy needed (use proxychains) β Windows-only environment (use Plink) β Stealth operation (iptables changes detectable)
8. Troubleshooting sshuttle
Common Issues and Solutions
Permission Denied Errors
SSH Authentication Failures
Network Routing Issues
iptables Cleanup Problems
9. Advanced Scenarios
Multiple Pivot Chains
Persistent sshuttle Service
sshuttle with SSH Tunnels
10. Performance and Monitoring
Performance Optimization
Traffic Monitoring
Resource Usage
11. Security Considerations
Operational Security
iptables Modifications - detectable by system administrators
Process Visibility - sshuttle processes visible in ps output
Network Traffic - SSH connections to pivot hosts logged
DNS Queries - may leak information if --dns used
Root Privileges - requires elevated access
Detection Mitigation
Cleanup Procedures
12. Integration with Other Tools
Metasploit Integration
Nmap Advanced Usage
Custom Applications
References
HTB Academy: Pivoting, Tunneling & Port Forwarding - Page 9
sshuttle GitHub: Official Repository
sshuttle Documentation: ReadTheDocs
Man Page:
man sshuttlePython SSH Tunneling: SSH Tunnel Techniques
Last updated