$ checksec ret2win32 [*]'/home/giantbranch/Desktop/rop_emporium_all_challenges/level1_ret2win/32/ret2win32' Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x8048000)
接着检查下程序反编译后的伪代码,查看函数大致功能,这里使用它推荐的工具radare2
首先使用以下命令加载分析目标程序:
1 2 3 4 5 6 7 8 9 10 11
$ r2 -A ./ret2win INFO: Analyze all flags starting with sym. and entry0 (aa) INFO: Analyze all functions arguments/locals (afva@@@F) INFO: Analyze function calls (aac) INFO: Analyze len bytes of instructions for references (aar) INFO: Finding and parsing C++ vtables (avrr) INFO: Type matching analysis for all functions (aaft) INFO: Propagate noreturn information (aanr) INFO: Use -AA or aaaa to perform additional experimental analysis -- Do you want to print 333.5K chars? (y/N) [0x08048430]>
{ uint s; sym.imp.memset(&s, 0, 0x20); sym.imp.puts("For my first trick, I will attempt to fit 56 bytes of user input into 32 bytes of stack buffer!"); sym.imp.puts("What could possibly go wrong?"); sym.imp.puts("You there, may I have your input please? And don\'t worry about null bytes, we\'re using read()!\n"); sym.imp.printf(0x80487e8); sym.imp.read(0, &s, 0x38); sym.imp.puts("Thank you!"); return; }