
Sickle - Kit de desarrollo de payloads

Sickle es una herramienta que desarrollé originalmente para ayudarme a ser más eficaz, tanto en el desarrollo como en la comprensión de shellcode. Sin embargo, a lo largo de su desarrollo y uso, ha evolucionado hasta convertirse en un kit de desarrollo de payloads. Aunque los módulos actuales están orientados mayormente al ensamblador, esta herramienta no se limita al shellcode.
Actualmente, Sickle puede ayudar con lo siguiente.
Sickle admite la generación de shellcode mediante el Keystone Engine. Debido a que esta es una funcionalidad recientemente añadida, la compatibilidad de payloads es limitada. Sin embargo, el objetivo es añadir una reverse shell básica para cada arquitectura y plataforma.

Sickle incluye un módulo de "diffing" diseñado inicialmente para analizar stubs de shellcode. El modo "asm" original realiza diffs de desensamblado lineal tanto a nivel de lenguaje ensamblador como de opcodes, por separado.

Además, Sickle ofrece varios modos para realizar diffs, lo que lo hace útil más allá del desarrollo de shellcode.

Una tarea común que quizás realices a menudo es probar tu shellcode. Este proceso normalmente implica los siguientes pasos:
Aunque estos pasos pueden parecer menores, pueden llegar a consumir mucho tiempo cuando se hacen repetidamente. Sickle simplifica el proceso envolviendo automáticamente el shellcode para pruebas rápidas, y el módulo "run" actualmente es compatible con sistemas Windows y Unix.

Sickle también puede convertir un archivo binario en opcodes extraídos (shellcode) y luego traducirlos a instrucciones de máquina (ensamblador). Ten en cuenta que este proceso solo funciona con archivos binarios sin procesar y actualmente realiza el desensamblado de forma lineal mediante Capstone.

En el ejemplo mostrado arriba, el módulo "disassemble" desensambla una reverse shell diseñada por Stephen Fewer a ensamblador.
La extracción de shellcode fue el primer módulo, o más bien, la funcionalidad principal de Sickle, ya que los opcodes se interpretan de manera diferente según el wrapper utilizado. JavaScript, por ejemplo, no almacena ni interpreta el shellcode de la misma manera que lo haría un programa en C.

Quizás la mayor inspiración para esto fue msfvenom.
Aunque es menos común en exploits de 64 bits, puede haber casos en los que un exploit restrinja el uso de ciertos caracteres. Aquí es donde el módulo "pinpoint" destaca, ya que identifica y resalta directamente las instrucciones de ensamblador responsables de los caracteres no válidos identificados.

Originalmente, esta herramienta comenzó como un único script grande. Sin embargo, a medida que evolucionaba, me encontraba teniendo que reaprender el código con cada actualización. Para solucionarlo, Sickle ahora sigue un enfoque modular, lo que permite añadir nuevas funcionalidades con un tiempo mínimo dedicado a reaprender el diseño de la herramienta.
$ sickle-pdk -l
Shellcode Ring Description
--------- ---- -----------
windows/x64/virtualalloc_exec_tcp 3 A lightweight stager that connects to a handler via TCP over IPv4 to receive and execute shellcode
windows/x64/egghunter 3 Egghunter based on Hell's Gate and NtProtectVirtualMemory
windows/x64/virtualalloc_exec_https 3 A lightweight stager that connects to a handler over HTTPS to receive and execute shellcode
windows/x64/exec 3 Executes a command on the target host
windows/x64/reflective_pe_loader 3 Stageless Reflective PE Loader that takes an x64 binary and executes it in memory
windows/x64/shell_reverse_tcp 3 Reverse Shell via TCP over IPv4 that provides an interactive cmd.exe session
windows/aarch64/shell_reverse_tcp 3 Reverse Shell via TCP over IPv4 that provides an interactive cmd.exe session
windows/x86/shell_reverse_tcp 3 Reverse shell via TCP over IPv4 that provides an interactive cmd.exe session
windows/x64/kernel_token_stealer 0 Token stealing shellcode for privilege escalation
windows/x64/kernel_sysret 0 Generic method of returning from kernel space to user space
windows/x64/kernel_ace_edit 0 SID entry modifier for process injection
windows/x86/kernel_token_stealer 0 Token stealing shellcode for privilege escalation
linux/x64/memfd_reflective_elf_tcp 3 Staged Reflective ELF Loader via TCP over IPV4 which executes an ELF from a remote server
linux/aarch64/memfd_reflective_elf_tcp 3 Staged Reflective ELF Loader via TCP over IPv4 which executes an ELF from a remote server handler
linux/aarch64/shell_reverse_tcp 3 Reverse Shell via TCP over IPv4 that provides an interactive /bin/sh session
linux/x86/execve 3 Executes a shell session such as /bin/sh
linux/x86/shell_reverse_tcp 3 Reverse shell via TCP over IPV4 that provides an interactive /bin/sh session
Architectures
-------------
aarch64
x64
x86
Modules Description
------- -----------
disassemble Simple linear disassembler for multiple architectures
handler Module for handling payload distribution and session management
asm_shell Interactive assembler and disassembler
diff Bytecode diffing module for comparing two binaries (or shellcode)
pinpoint Highlights opcodes within a disassembly to identify instructions responsible for bad characters
run Wrapper used for executing bytecode (shellcode)
format Converts bytecode into a respective format (activated anytime '-f' is used)
badchar Produces a set of all potential invalid characters for validation purposes
Format Description
------ -----------
perl Format bytecode for Perl
python Format bytecode for Python
hex_space Format bytecode in hex, seperated by a space
nasm Format bytecode for NASM
java Format bytecode for Java
javascript Format bytecode for Javascript (Blob to send via XHR)
escaped Format bytecode for one-liner hex escape paste
rust Format bytecode for a Rust application
uint8array Format bytecode for Javascript as a Uint8Array directly
bash Format bytecode for bash script (UNIX)
powershell Format bytecode for Powershell
cs Format bytecode for C#
dword Format bytecode in dword
c Format bytecode for a C application
raw Format bytecode to be written to stdout in raw form
ruby Format bytecode for Ruby
num Format bytecode in num format
hex Format bytecode in hex
python3 Format bytecode for Python3
Este enfoque permite que cada módulo genere documentación detallada sobre su funcionalidad.
$ sickle-pdk -m run -i
Usage information for run
Name: Shellcode Runner
Module: run
Architecture: Multi
Platform: Multi
Ring: 3
Author(s):
wetw0rk
Tested against:
Linux
Windows
Module Description:
Executes bytecode from a binary file (-r) or a payload module (-p) under the context
of the currently running operating system and architecture. Meaning if you are
running on AARCH64 bytecode will be interpreted as such and if you're on x64 it will
interpret it as x64 respectively.
Example:
/usr/local/bin/sickle-pdk -m run -r shellcode
Este enfoque también incluye documentación para los stubs de shellcode.
$ sickle-pdk -p windows/x64/egghunter -i
Usage information for windows/x64/egghunter
Name: Windows (x64) Hell's Gate based Egghunter
Module: windows/x64/egghunter
Architecture: x64
Platform: windows
Ring: 3
Author(s):
hvictor
Tested against:
Windows 11 (10.0.26100 N/A Build 26100)
Argument Information:
Name Description Optional
---- ----------- --------
TAG Egg (provide 4 bytes) yes
Module Description:
This egghunter iterates virtual memory addresses and before searching for the egg, it
performs a NtProtectVirtualMemory system call. This system call is similar to
VirtualProtect, and is parameterized to set the memory to be scanned to READ, WRITE,
EXECUTE. This way, when the egg is found, the shellcode after it is guaranteed to be
executable.
Example:
/usr/local/bin/sickle-pdk -p windows/x64/egghunter TAG=w00t