12.07.2015 Views

Bug Hunter Diary

Bug Hunter Diary

Bug Hunter Diary

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

the stack, and execution is redirected to the _init() function. This iswhere rtld gets called to locate the referenced printf() symbol.(gdb) x/2i 0x080483020x8048302 : push 0x100x8048307 : jmp 0x80482ccNow let’s see what happens if printf() gets called a second time.First, I defined a breakpoint just before the second call to printf():(gdb) list 01 #include 23 int4 main (void)5 {6 int i = 16;78 printf ("%d\n", i);9 printf ("%x\n", i);10(gdb) break 9Breakpoint 1 at 0x80483ea: file got.c, line 9.I then started the program:(gdb) runStarting program: /home/tk/BHD/got16Breakpoint 1, main () at got.c:99 printf ("%x\n", i);After the breakpoint triggered, I disassembled the main functionagain to see if the same PLT address was called:(gdb) disassemble mainDump of assembler code for function main:0x080483c4 : push ebp0x080483c5 : mov ebp,esp0x080483c7 : and esp,0xfffffff00x080483ca : sub esp,0x200x080483cd : mov DWORD PTR [esp+0x1c],0x100x080483d5 : mov eax,0x80484d00x080483da : mov edx,DWORD PTR [esp+0x1c]0x080483de : mov DWORD PTR [esp+0x4],edx0x080483e2 : mov DWORD PTR [esp],eax0x080483e5 : call 0x80482fc 0x080483ea : mov eax,0x80484d40x080483ef : mov edx,DWORD PTR [esp+0x1c]Hints for Hunting 159

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!