intmenu(){puts("\n***********************");puts("Welcome to the magic book world!");puts("***********************");puts("1.create a book");puts("2.show the content");puts("3.throw a book");puts("4.write something on the book");puts("5.exit the world");returnprintf("Your choice: ");}
我们可以发现add功能
intadd(){int result;// eaxint size;// [rsp+Ch] [rbp-14h]int v2;// [rsp+10h] [rbp-10h]int v3;// [rsp+14h] [rbp-Ch]unsigned __int64 v4;// [rsp+18h] [rbp-8h]
v4 =__readfsqword(0x28u);printf("Give me a book ID: ");__isoc99_scanf("%d",&v2);printf("how long: ",&v2);__isoc99_scanf("%d",&size);
result = v2;if( v2 >=0){
result = v2;if( v2 <=49){if( size <0|| chunk[v2]){
result =puts("too large!");}else{
v3 = v2;
chunk[v3]=malloc(size);::size[v3]= size;
result =puts("Done!\n");}}}return result;}
libc : Print the base address of libc
ld : Print the base address of ld
codebase : Print the base of code segment
heap : Print the base of heap
got : Print the Global Offset Table infomation
dyn : Print the Dynamic section infomation
findcall : Find some function call
bcall : Set the breakpoint at some function call
tls : Print the thread local storage address
at : Attach by process name
findsyscall : Find the syscall
fmtarg : Calculate the index of format string
You need to stop on printf which has vulnerability.
force : Calculate the nb in the house of force.
heapinfo : Print some infomation of heap
heapinfo (Address of arena)
default is the arena of current thread
If tcache is enable, it would show infomation of tcache entry
heapinfoall : Print some infomation of heap (all threads)
arenainfo : Print some infomation of all arena
chunkinfo: Print the infomation of chunk
chunkinfo (Address of victim)
chunkptr : Print the infomation of chunk
chunkptr (Address of user ptr)
mergeinfo : Print the infomation of merge
mergeinfo (Address of victim)
printfastbin : Print some infomation of fastbin
tracemalloc on : Trace the malloc and free and detect some error .
You need to run the process first than tracemalloc on, it will record all of the malloc and free.
You can set the DEBUG in pwngdb.py , than it will print all of the malloc and free infomation such as the screeshot.
parseheap : Parse heap layout
magic : Print useful variable and function in glibc
fp : show FILE structure
fp (Address of FILE)
fpchain: show linked list of FILE
orange : Test house of orange condition in the _IO_flush_lockp
orange (Address of FILE)
glibc version <= 2.23
安装教程:
cd ~/
git clone https://github.com/scwuaptx/Pwngdb.git
cp ~/Pwngdb/.gdbinit ~/
然后再安装pwndbg
安装教程:
git clone https://github.com/pwndbg/pwndbg
cd pwndbg
./setup.sh
然后开始开始编辑
$ vim ~/.gdbinit
source ~/pwndbg/gdbinit.py
#source ~/peda/peda.py
source ~/Pwngdb/pwngdb.py
source ~/Pwngdb/angelheap/gdbinit.py
define hook-run
python
import angelheap
angelheap.init_angelheap()
end
end