Skip to content

CyberKareem/reverseshell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Enhanced PHP Reverse Shell (Evolution of PentestMonkey)

Overview

This repository contains an upgraded version of the classic PentestMonkey PHP Reverse Shell. While the original is a staple in the security community, modern environments require more resilience and better process handling.

This version introduces several key enhancements designed for authorized penetration testing and Red Team engagements.

Improvements & Enhancements

Compared to the 2007 original, this script includes:

  • Persistence Loop: Added a reconnection logic that attempts to "call home" at a defined interval if the connection is dropped or the listener is not yet active.
  • Background Execution: Utilizes ignore_user_abort(true) and set_time_limit(0) to ensure the shell continues running even if the initial HTTP request times out.
  • Optimized I/O Redirection: Simplified descriptor handling by passing the socket directly to proc_open, reducing overhead and improving stability.
  • OS Awareness: Basic logic to detect the host OS and toggle between /bin/sh and cmd.exe.
  • Reduced Signature: Removed verbose headers and optimized code structure to lower the "loudness" of the script against basic static analysis.

Usage

  1. Configure: Open the script and edit the $ip and $port variables to match your listener.
  2. Listener: Start your listener (e.g., nc -lvnp 1234).
  3. Execute: Upload to the target server and execute via a web browser or CLI: php reverse.php.
  4. TTY Upgrade: Once connected, it is highly recommended to upgrade to a full TTY:
    python3 -c 'import pty; pty.spawn("/bin/bash")'
    # Then background with Ctrl+Z, and run:
    stty raw -echo; fg

Disclaimer

This tool is intended for educational purposes and authorized security auditing only. Unauthorized access to computer systems is illegal. The author (cyberkareem) accepts no liability for any misuse or damage caused by this tool.

License

This project is a derivative of the original PentestMonkey script and is licensed under the GPL v2. See the script headers for full license details.

About

Reverse shells

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages