Execute /usr/bin/id

Contenu du snippet

Voila un petit script sous linux en asmx86 il reprend l'instruction execve("/usr/bin/id");

suivit de son exécution en C ce qui donne un shellcode :)

Source / Exemple :


// xor   %eax,%eax
// push  %eax
// push  $0x64692f6e
// push  $0x69622f72
// push  $0x73752f2f
// mov   %esp,%ebx
// push  %eax
// mov   %esp,%edx
// push  %ebx
// mov   %esp,%ecx
// mov   $0xb,%al
// int   $0x80

#include "stdio.h"

main()
{
        char shellcode[] = "\x31\xc0\x50\x68\x6e\x2f\x69\x64\x68\x72\x2f\x62\x69"
                           "\x68\x2f\x2f\x75\x73\x89\xe3\x50\x89\xe2\x53\x89\xe1"
                           "\xb0\x0b\xcd\x80";

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

A voir également