I have a problem rewriting ELF binary to add an additional loadable segment for add.c code.

I have problem working with https://pdfhost.io/v/U@uP1+nCY_Compact_Control_Flow_Integerity_in_Linuxpdf.pdf

Note that in the readelf report , especially the Section to Segment mapping , the right side (modified ELF) still does not have an additional loadable segment (called as .mysection)

Note: I am using 010Editor together with ELF.bt which I believe that this 010 editor software is already using elfutils library

1 Answer 1


I think that if you want to inject code in an elf, the best way would be to resize your second PT LOAD where the will be your loadable data, add execution permissions and inject your code at the end of the data in order to hook your elf and, at the end of this "stub" jump at the original entry point.

If you want to have an example, you can look at the code of my tool: AD_1DA which allow you to inject some asm code in an elf from an executable nasm binary (and do some other obfuscation/metamorphic stuff).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.