Information*/알면도움됨

gdb-peda heap plugin install

ch4rli3kop 2018. 2. 8. 15:50
반응형

기존 gdb-peda 만으로는 heap 영역을 보기가 조금 까다롭다.


요즘 시대가 어느 때인데, 걍 편하게 명령어 하나만 뚝딱하면 heap_info, malloc_state 등을 촤락 보여주는 기능이 존재해야 함은 당연한 거다!


그리하야 선지자들께서 해당 명령어들을 구현해놓은 plugin들을 개발하셨는데, 여러 plugin들 중

개인적으로  https://github.com/scwuaptx/Pwngdb를 추천한다.


설치 방법은 README에 나와있듯 다음과 같다.

cd ~/
git clone https://github.com/scwuaptx/Pwngdb.git
cp ~/Pwngdb/.gdbinit ~/


자세한 사항은 역시 README 참고.

요로코롬 예쁘게 나오면서 exploit에 편리한 기능이 굉장히 많!

gdb-peda$ heapinfo
(0x20)     fastbin[0]: 0x0
(0x30)     fastbin[1]: 0x0
(0x40)     fastbin[2]: 0x0
(0x50)     fastbin[3]: 0x0
(0x60)     fastbin[4]: 0x0
(0x70)     fastbin[5]: 0x0
(0x80)     fastbin[6]: 0x0
(0x90)     fastbin[7]: 0x0
(0xa0)     fastbin[8]: 0x0
(0xb0)     fastbin[9]: 0x0
                  top: 0x55771758d800 (size : 0x20800)
       last_remainder: 0x0 (size : 0x0)
            unsortbin: 0x55771758d2e0 (size : 0x420)
(0x70)   tcache_entry[5](1): 0x55771758d7a0 --> 0x7fae6a04c8e8


gdb-peda$ magic
========== function ==========
system:0x4f440
execve:0xe4e30
open:0x10fc40
read:0x110070
write:0x110140
gets:0x800b0
setcontext+0x35:0x520a5
========== variables ==========
__malloc_hook(0x3ebc30)             : 0x0000000000000000
__free_hook(0x3ed8e8)               : 0x0000000000000000
__realloc_hook(0x3ebc28)            : 0x00007fae69cf7790
stdin(0x3ec850)                     : 0x00007fae6a04aa00
stdout(0x3ec848)                    : 0x00007fae6a04b760
_IO_list_all(0x3ec660)              : 0x00007fae6a04b680
__after_morecore_hook(0x3ed8e0)     : 0x0000000000000000


gdb-peda$ parseheap
addr                prev                size                 status              fd                bk               
0x602000            0x0                 0x410                Used                None              None
0x602410            0x0                 0x410                Used                None              None
0x602820            0x0                 0x60                 Used                None              None
0x602880            0x0                 0x60                 Freed                0x0              None

왠만한 heap 문제 볼 때, heapinfo과 parseheap만 있어도 충분하다.



반응형