Reputation: 63
If we have a following situation:
[laptop] ---- [host1] ---- [host2] ----[target]
where host1 is reachable from the my laptop machine, host2 from host1 and the target from host2 only. We have ssh credentials to both host1 and host2.
We can use the dynamic port forwarding with the following command:
ssh -N -D 127.0.0.1:8282 host1_account@host1
and that will basically create a SOCKS4 that we can use with proxychains so that command will work from the kali device:
proxychains ssh host2_account@host2
How we can make a similar (additional?) dynamic tunnel from host2 to target?
Upvotes: 5
Views: 2210
Reputation: 48572
Make sure you're on OpenSSH 7.3 or later, and use SSH's ProxyJump feature: ssh -J host1_account@host1 -D 127.0.0.1:8282 host2_account@host2
. That will give you an SSH session on host2, and 127.0.0.1:8282 will proxy traffic out through host2.
Upvotes: 7