Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved heap exploration #137

Closed
Grazfather opened this issue Apr 11, 2017 · 8 comments
Closed

Improved heap exploration #137

Grazfather opened this issue Apr 11, 2017 · 8 comments

Comments

@Grazfather
Copy link
Collaborator

  • heap next or heap chunk next (and prev)
    • Basically will follow FD/BK for freed chunks. For in-use chunks heap next should instead add size
      • Should we distinguish between moving between free blocks and inuse blocks?
    • Needs to maintain a 'last viewed chunk'. Should be wiped out when the process is restarted, or at least when a new binary is loaded.
  • Make chunk viewing look more like a C structure.
    • Could we leverage the dt command?
@hugsy
Copy link
Owner

hugsy commented May 2, 2017

Can also mix features with :

Already a lot of overlap / primitives are there in GEF.

@hugsy hugsy added this to the BlackHat Arsenal 2017 milestone Jun 4, 2017
@iromise
Copy link

iromise commented Nov 20, 2017

Curious about this Enhanced Feature still on the way?

@Grazfather
Copy link
Collaborator Author

@iromise
Copy link

iromise commented Nov 21, 2017

so we just use the repo you mention?

@Grazfather
Copy link
Collaborator Author

You could use that for now, it would be interesting to improve it. I haven't tried it.

@iromise
Copy link

iromise commented Nov 21, 2017

ok, thanks.

@hugsy
Copy link
Owner

hugsy commented Nov 21, 2017

Before BlackHat I firmly intended to integrate those projects directly, only to find that their approach is (just like PEDA) very NOT Pythonic (massive use of gdb.execute(), using regexp for parsing etc.) So it had to be done in a cleaner/more efficient way to be able to work transparently on all GDB releases and on all archs GEF supports, which required to much work at that time.

FWIW gef already implements many of the commands from those tools, and the rest will probably come when I have a chance^Htime to re-work on the heap again.

Otherwise, feel free to implement it in as an external script if you want , we do love Pull Requests 😄

@hugsy hugsy removed this from the BlackHat Arsenal 2017 milestone Feb 20, 2018
@hugsy hugsy added this to In progress in New features integration Feb 20, 2018
@hugsy hugsy changed the title Feature: Improved heap exploration Improved heap exploration Feb 23, 2018
@hugsy hugsy self-assigned this Feb 23, 2018
@hugsy
Copy link
Owner

hugsy commented Feb 24, 2018

Commit e750c8d introduces a new subcommand heap set-arena that allows to set a custom address for the main_arena. This useful when libc6-dbg is not installed.

Commit f1f47f8 enumerates all chunks via a new subcommand heap chunks. It also accepts an argument which is the base address of the first chunk to enumerate:

gef➤  heap chunks 0x0000555555775000                                     
Chunk(addr=0x555555775010, size=0x250, flags=PREV_INUSE)                                                                                                                                          
Chunk(addr=0x555555775260, size=0x230, flags=PREV_INUSE)   
Chunk(addr=0x555555775490, size=0x80, flags=PREV_INUSE)    
Chunk(addr=0x555555775510, size=0x410, flags=PREV_INUSE)   
Chunk(addr=0x555555775920, size=0x206f0, flags=PREV_INUSE)  ←  top chunk

After documenting and adding unit tests for those, I will close this ticket unless you have more (specific) ideas of new features to implement. GEF now includes more heap related functionalities than angelheap (plus they are all portable).

Cheers

@hugsy hugsy moved this from In progress to Testing in New features integration Feb 24, 2018
@hugsy hugsy closed this as completed Feb 25, 2018
@hugsy hugsy moved this from Testing to Done in New features integration Feb 25, 2018
SakiiR pushed a commit to SakiiR/gef that referenced this issue Jul 1, 2019
SakiiR pushed a commit to SakiiR/gef that referenced this issue Jul 1, 2019
SakiiR pushed a commit to SakiiR/gef that referenced this issue Jul 1, 2019
SakiiR pushed a commit to SakiiR/gef that referenced this issue Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants