Giter Site home page Giter Site logo

wh1sk3y3 / php-reverse-shell Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ivan-sincek/php-reverse-shell

0.0 0.0 0.0 228 KB

PHP reverse shell script. Works on Linux OS, macOS, and Windows OS.

License: GNU General Public License v2.0

PHP 100.00%

php-reverse-shell's Introduction

PHP Reverse Shell

Just a little refresh on the popular PHP reverse shell script pentestmonkey/php-reverse-shell. 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 nouphet/docker-php4 with PHP v4.4.0 and steeze/php52-nginx 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.

How to Run

/src/php_reverse_shell.php requires PHP v5.0.0 or greater, mainly because proc_get_status() is used.

/src/php_reverse_shell_older.php requires PHP v4.3.0 or greater.

Change the IP address and port number inside the scripts as necessary.

Copy /src/php_reverse_shell.php 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 simple PHP web shell based on HTTP POST request.

Check the simple PHP web shell based on HTTP GET request. You must URL encode your commands.

Check the simple PHP web shell v2 based on HTTP GET request. You must URL encode your commands.

Find out more about PHP obfuscation techniques for older versions of PHP at lcatro/PHP-WebShell-Bypass-WAF. Credits to the author!


Check the minified scripts in /src/minified/ directory.

Set Up a Listener

To set up a listener, open your preferred console on Kali Linux and run one of the examples below.

Set up ncat listener:

ncat -nvlp 9000

Set up multi/handler listener:

msfconsole -q

use exploit/multi/handler

set PAYLOAD windows/shell_reverse_tcp

set LHOST 192.168.8.185

set LPORT 9000

exploit

Images

Ncat

Figure 1 - Ncat

Script Dump

Figure 2 - Script's Dump

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.