PHP Reverse Shell
Last updated
Was this helpful?
Last updated
Was this helpful?
Just a little refresh on the popular PHP reverse shell script . Credits to the original author!
Works on Linux OS and macOS with /bin/sh
and Windows OS with cmd.exe
. Script will automatically detect an underlying OS.
Works with both ncat
and multi/handler
.
Tested on XAMPP for Linux v7.3.19 (64-bit) with PHP v7.3.19 on Kali Linux v2020.2 (64-bit).
Tested on XAMPP for OS X v7.4.10 (64-bit) with PHP v7.4.10 on macOS Catalina v10.15.6 (64-bit).
Tested on XAMPP for Windows v7.4.3 (64-bit) with PHP v7.4.3 on Windows 10 Enterprise OS (64-bit).
In addition, everything was tested on Docker images with PHP v4.4.0 and with PHP v5.2.17.
Made for educational purposes. I hope it will help!
Process pipes on Windows OS do not support asynchronous operations so stream_set_blocking()
, stream_select()
, and feof()
will not work properly, but I found a workaround.
requires PHP v5.0.0 or greater, mainly because proc_get_status()
is being used.
requires PHP v4.3.0 or greater.
Change the IP address and port number inside the script as necessary.
Copy to your server's web root directory (e.g. to /opt/lampp/htdocs/ on XAMPP) or upload it to your target's web server.
Navigate to the file with your preferred web browser.
Check the based on HTTP POST request.
To set up a listener, open your preferred console on Kali Linux and run one of the examples below.
Set up an ncat
listener:
Set up a multi/handler
module:
Check the based on HTTP GET request. You must your commands.
Check the based on HTTP GET request. You must your commands.
Find out more about PHP obfuscation techniques for older versions of PHP at . Credits to the author!
Check the minified scripts in directory.