layout: post title: "Software Security Notes 8 Binary modification " date: 2021-3-10 09:00:00 +0800
know where to edit, directly edit using hex editor.
only allows in-place editing. No adding new bytes.
But can rewrite padding bytes, dead code, or unused data.
LD_PRELOAD: specify libraries for the linker to load before.
By appending bytes to the end of the binary.
Create a section header.
Create a program header.
Rename the section name in .shstrtab
Call the injected code.
PT_NOTE header saft to overwrite.
Need to change type to SHT_PROGBITS.
Injected code will run when the program starts.
Replace GOT entry to replace a library call with an injected function.
Only work for library calls.
directly modify direct call instructions.
Position Independent Executables (PIE)