Grunt's personal blog

this is my personal blog for my hacking stuff, my degree stuff, etc

View on GitHub

Resumen de Técnicas de Cifrado de Payloads

Cifrar payloads es una técnica fundamental en malware para evadir detección estática, dificultar el análisis y mantener el código ofuscado hasta el momento de ejecución.

📌 Objetivos comunes:


1. 🧪 XOR Encryption

✨ Características:

🔧 Implementaciones vistas:

// XOR con clave de 1 byte
p[i] = p[i] ^ key;

// XOR con clave dinámica
p[i] = p[i] ^ (key + i);

// XOR con array de clave
p[i] = p[i] ^ key[i % key_size];

✅ Ventajas:

❌ Desventajas:


2. RC4 Encryption

✨ Características:

🔧 Implementaciones vistas:

Método 1: RC4 manual (con estructura Rc4Context)

Método 2: SystemFunction032 (WinAPI, Advapi32.dll)

typedef NTSTATUS (NTAPI *fnSystemFunction032)(USTRING* Data, USTRING* Key);

Método 3: SystemFunction033

✅ Ventajas:

❌ Desventajas:


3. AES Encryption

✨ Características:

🔧 Implementaciones vistas:

🔹 Con WinAPI (bcrypt):

Usa funciones como:

🔹 Con Tiny-AES-C:

✅ Ventajas:

❌ Desventajas:


🧮 Complejidad Temporal

Algoritmo Complejidad Temporal
XOR O(n)
RC4 O(n)
AES O(n)

Nota: n = tamaño del payload en bytes. Todos procesan byte a byte o bloque a bloque.


🧠 Conclusión y Recomendaciones

Objetivo Mejor opción
Ofuscar una string o dato pequeño XOR con clave variable
Cifrar shellcode sin depender de WinAPI Tiny-AES con padding
Cifrar payloads con APIs nativas AES con bcrypt (WinAPI)
Evadir detección de funciones criptográficas RC4 con SystemFunction033
Código muy compacto y rápido RC4 o XOR

Códigos