|
|
|
|
|
by eqvinox
741 days ago
|
|
The approach taken there is unfortunately not correct. The existence of sections (and section headers) is completely optional for ELF files; you can have valid executables and libraries without them. `sstrip` [https://github.com/aunali1/super-strip] can be used to generate such files. The correct approach is to process the program headers and find the tail end of anything referenced in PT_LOAD as well as from DT_DYN items. You can combine that with a section based approach; if the file has debug information it won't be covered by program headers and you'd end up cutting it off if going purely by program headers. However, this is technically optional while the program header based approach is really required. |
|
I improved my post (and my carver) by including parsing the program headers as well.
Also, thanks for the suggestion of super-strip. An interesting tool that I will play around with.