Is double SSH tunneling safe?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I was thinking of a common scenario where there is a station we call
"W" (let's assume it's at work) that does not allow connections from
"home" machines, due to the firewall configuration or what not. At
"home," there are several workstations connected through LAN but only
one has an SSH access to the Internet and the rest can only be reached
through SSH, via other LAN machines. We call the system that has SSH
access from/to Internet "A" and the third machine in the LAN that can
access A or other LAN machines via SSH "B."

So basically we are running SSH server on "W," "A," and "B." We cannot
access W from A (and obviously B). So I use a reverse tunneling to get
access to "W" directly from "B":
  [At W]:
     ssh -f -R 2048:localhost:22 user@host "sleep 60"
  [At A]:
     ssh -f -R 2049:localhost:2048 user@ "sleep 60"
  [From B]:
     ssh -p 2049 localhost

Now, my question, is it safe to operate via double ssh tunneling? Or
whether this procedure makes SSH a bit more unsafer?


Re: Is double SSH tunneling safe?

Quoted text here. Click to load it

I can't think of anything about this arrangement that makes ssh less secure.
Any insecurity comes just from the fact that you're forwarding ports
through the office firewall at work.  You've breached it.  Now anyone who
can connect to A:2048 or B:2049-- whether you, or some other authorized or
unauthorized user of your home LAN-- has a tunnel open into the office LAN.
If someone exploits that tunnel to gain unauthorized entry to the office
LAN, don't be surprised to find yourself out of a job.

One basic precaution in this situation is to set "GatewayPorts no"
in /etc/ssh/sshd_config on A and B.  That way, at least a user on host X
won't be able just to 'telnet B 2049' (assuming your firewall allowed this,
or they got past it); they'd have to first log in to B, then 'telnet
localhost 2049'.

To reply by email, replace "" by ""

Re: Is double SSH tunneling safe?

The scenario above is definitely not free of loop holes and was
presented as a hypothetical scenario. My question was mainly focusing
on the encryption aspect of the ssh (ssh protocols that is) becoming
less secure in SSH-in-SSH connections. Apparently from what I have read
since, this does not hold true and SSH remains secured in such

Thank you

Site Timeline