SSH Tunneling Guide Demonstrates Port Forwarding and RDP Pivoting

· Original article ↗

Summary

A lab walkthrough demonstrates SSH local, dynamic, and remote forwarding to reach loopback-bound services and tunnel RDP, including how GatewayPorts can expose a forwarded port across a network. It also recommends controls for limiting and monitoring SSH tunnels.

Key points

  • Demonstrates local SSH forwarding to access an Apache2 service bound to the target's loopback interface.
  • Shows dynamic forwarding with a SOCKS proxy and proxychains to route browser and RDP traffic through an SSH host.
  • Explains remote forwarding to make a Windows RDP service reachable through a pivot host.
  • Shows that enabling GatewayPorts can bind a remote forward to all network interfaces, exposing the forwarded RDP port beyond loopback.
  • Recommends restricting SSH access and forwarding, using key-based authentication and MFA, and keeping GatewayPorts disabled unless needed.
  • Suggests monitoring long-lived SSH sessions, unusual data volumes, and unexpected connection sources.

Article Details

Topic
SSH port forwarding and tunneling techniques for accessing loopback-bound services and RDP through pivot hosts, with mitigation guidance

MITRE ATT&CK

Products

Tools

Related Articles