chevron_left chevron_right
Login Register invert_colors photo_library
The Discord has been disabled - read about it here, check out our IRC here, and if you're upgraded check here.
Thread Rating:
  • 0 Vote(s) - 0 Average


filter_list Can you expand the size of a section in ELF?
Author
Message
Can you expand the size of a section in ELF? #1
Hello everybody, I studied a time ago the ELF file format and now I got back into it. The question that raises in my head is the next: Can you make a section larger than it is (e.g the .text section).
I know that it might be some ways around this but I'm not pretty sure how to do it. I think that this kind of operation against a binary can be really tedious, and probably I'm going to need to recompile it or patch it.
Because if I change something directly in memory without repatching some offsets, sizes, etc. the sections will not be loaded correctly by the loader.

The main goal is to do all of this by mapping the binary in memory with a C++ program, increase the size of the .text section, and repatch the stuff needed so the binary can run normally.
Any help, ideas, clarification or discussion on this subject will be much appreciated. Cheers !
[Image: iQDVDdD.gif]

Reply

RE: Can you expand the size of a section in ELF? #2
LD_PRELOAD at runtime?

https://www.youtube.com/watch?v=iFXUnCGIrcc

Reply

RE: Can you expand the size of a section in ELF? #3
(12-30-2018, 05:15 PM)sunjester Wrote: LD_PRELOAD at runtime?

https://www.youtube.com/watch?v=iFXUnCGIrcc
Not really I was wondering if you can change the size of a section (e.g .data, .text) dynamically. Let's say the .text section has a size of 1024 bytes and I want to increase that to 2048 bytes dynamically. Therefore, I think I need to repatch the binary somehow because if I only change that in the ELF header the loader will get confused.
[Image: iQDVDdD.gif]

Reply






Users browsing this thread: 1 Guest(s)