🐘 PHP Web Shells

πŸ”Ž Overview

  • PHP (Hypertext Preprocessor) is the most widely used server-side language (78.6% of web servers).

  • PHP processes requests like login forms server-side (e.g., login.php on rConfig).

  • PHP web shells exploit file upload vulnerabilities to achieve remote command execution or reverse shells.


πŸ§ͺ Hands-On: Gaining a PHP Web Shell (rConfig v3.9.6)

🧠 Objective

Upload a malicious PHP file disguised as an image to exploit rConfig's file upload mechanism, then use it as a browser-accessible shell.


βœ… Step 1: Access rConfig and Navigate to Vendor Upload

  1. Login to rConfig

    • Credentials: admin:admin

  1. Navigate to: Devices > Vendors > Add Vendor

  1. Choose File Upload for "Vendor Logo".


βœ… Step 2: Prepare Your PHP Web Shell

πŸ“ Tool used: WhiteWinterWolf's PHP Web Shellarrow-up-right

πŸ’‘ Either download or paste the code into a file:

🧼 Best practice:

  • Remove author comments and ASCII art to avoid detection by AV.


Bypassing Filetype:

βœ… Step 3: Launch Burp Suite and Intercept the Upload

  1. Open Burp Suite

  2. Set browser proxy settings:

    • IP: 127.0.0.1

    • Port: 8080

  1. Intercept HTTP traffic.

  1. Go back to rConfig, click β€œBrowse” and select connect.php, then click β€œSave.”

βœ… Step 4: Modify the Intercepted POST Request in Burp

Once the POST request containing the file upload is intercepted:

Change:

To:

πŸ“Œ This bypasses rConfig’s image file-type filter.

  1. Click β€œForward” twice in Burp Suite to submit the request.


βœ… Step 5: Confirm File Upload Was Successful

Look for:

πŸ–ΌοΈ If the file type wasn't recognized, it may display a generic image icon β€” that’s okay.


βœ… Step 6: Access the Web Shell

Navigate to or right click on the newly added image

πŸ”§ You now have a web shell interface that lets you run system commands via the browser.

πŸ“ Commands entered here execute on the underlying Linux OS.


πŸ” Additional Notes

  • This shell is non-interactive (no TTY).

  • Useful for:

    • Enumeration

    • Dropping reverse shells

    • Uploading more payloads

Last updated