Is it possible to use a tool like netcat to create a listener on the attacker's device with a specific command that when the target device or machine connects to this IP and port, it runs a bash shell or command (/bin/bash) on the target device?

  • So, with a "certain command" run another command? Why not just run the command you want?
    – schroeder
    Commented Sep 12, 2023 at 20:07
  • 1
    What is the actual distinction between what you want, and a regular reverse shell? Commented Sep 13, 2023 at 1:44

1 Answer 1


First, netcat is just for transport. It sends data from the attacker to the victim, and vice versa. It can execute things locally, but only locally.

To run things on the victim side, the attacker must have command execution there first. Usually, there's a vulnerable application on the victim's side and the attacker exploits it to execute something that starts a shell. It could be a bind shell (the vulnerable application starts a shell and binds it to a port), or a reverse shell (the vulnerable application starts a shell and connects to attacker's system).

After the exploit runs and the direct or reverse connection is established, there's no difference between a reverse or bind shells.

  • Are there any tools out there that can set up a listener and when a victim establishes a connection with the attacker's listener? (like with Social Engineering into tricking the victim to connect to my malicious listener)
    – 19216811
    Commented Sep 13, 2023 at 15:25
  • There's a whole category of software for doing that. There are shellcodes, there are reverse shell connectors, there are custom Powershell scripts. Search around and you will see a lot of examples.
    – ThoriumBR
    Commented Sep 13, 2023 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .