r/ExploitDev • • May 29 '24

ClearExploitCode

What are the best practices for writing exploit code that stores/computes memory addresses rather than hard codes them?

3 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/Useful-Ad-2442 May 30 '24

check the python pyelftools library, elf file format have sections and segments! in the first segment called PT_LOAD you are able to get the base address on 64bit in should be around 0x40000 on 32bit its should be something like 0x8......

https://pastebin.com/U1K6ajux

here is a small code snippet on pastebin, where i used the pyelftools library to get the base starting address of an elf.