RE lab 05 - Stack frames 101

Lab files and setup

Download the lab files from here. The archive password is infected.

$ apt-get install gdb git
$ cd
$ git clone https://github.com/longld/peda
$ echo "source ~/peda/peda.py" >> ~/.gdbinit

pwntools documentation

extra gdb commands

gdb-peda$ telescope $rsp 20
0000| 0x7fffffffde70 --> 0x401360 (<__libc_csu_init>:   push   r15)
0008| 0x7fffffffde78 --> 0x7ffff7dea09b (<__libc_start_main+235>:   mov    edi,eax)
0016| 0x7fffffffde80 --> 0x0 
0024| 0x7fffffffde88 --> 0x7fffffffdf58 --> 0x7fffffffe2a2 ("/ctf/unibuc/curs_re/curs_"...)
0032| 0x7fffffffde90 --> 0x100040000 
0040| 0x7fffffffde98 --> 0x401208 (<main>:  push   rbp)
0048| 0x7fffffffdea0 --> 0x0 
0056| 0x7fffffffdea8 --> 0xe2f3fe41bf131724 
0064| 0x7fffffffdeb0 --> 0x4010c0 (<_start>:    xor    ebp,ebp)
0072| 0x7fffffffdeb8 --> 0x7fffffffdf50 --> 0x1 
0080| 0x7fffffffdec0 --> 0x0 
0088| 0x7fffffffdec8 --> 0x0 
0096| 0x7fffffffded0 --> 0x1d0c013e24d31724 
0104| 0x7fffffffded8 --> 0x1d0c117cd9751724 
0112| 0x7fffffffdee0 --> 0x0 
0120| 0x7fffffffdee8 --> 0x0 
0128| 0x7fffffffdef0 --> 0x0 
0136| 0x7fffffffdef8 --> 0x7fffffffdf68 --> 0x7fffffffe2d1 ("CLUTTER_IM_MODULE=xim")
0144| 0x7fffffffdf00 --> 0x7ffff7ffe190 --> 0x0 
0152| 0x7fffffffdf08 --> 0x7ffff7fe44b6 (<_dl_init+118>:    cmp    ebx,0xffffffff)

Task 1: stack-buffer overflow into data

The correct password has length 12345
Unauthorized!

Task 2: stack-buffer overflow into ret addr

Task 3: stack-buffer overflow protection

Task 4 (bonus): complex riddle