结论: No canary + No PIE + NX → 典型的 ret2win 或 ROP 题。
0x02 逆向分析
WorkBuddy 自动用 objdump 反编译关键函数:
main (0x401293):
1 2 3 4 5 6
puts("Stack overflow is a powerful art!") puts("In this MoeCTF,I will show you the charm of PWN!") puts("You need to understand the structure of the stack first.") puts("Then how many bytes do you need to overflow the stack?") scanf("%d", &var) overflow(var)
overflow (0x4011df):
1 2 3 4 5 6 7
char buf[8]// rbp-0x8 if (arg <= 7) { puts("Come on, you can't even fill up this array?") return } read(0, buf, arg)// 🚩 8字节缓冲区,arg可控 → 栈溢出 puts("OK,I receive your byte.and then?")
Stack overflow is a powerful art! In this MoeCTF,I will show you the charm of PWN! You need to understand the structure of the stack first. Then how many bytes do you need to overflow the stack? OK,I receive your byte.andthen? Congratulations! You got the secret! flag{qqqqqq111111qqqqqqqok!!!} 用户id=0(root) 组id=0(root) 组=0(root)
Flag: flag{qqqqqq111111qqqqqqqok!!!}
0x06 总结
步骤
耗时
工具
搜索文件 & 信息收集
~5s
Kali MCP + file + checksec
逆向分析
~10s
objdump
Exploit 编写 & 调试
~30s
pwntools
获取 Flag
~1s
system(“/bin/sh”)
整个过程从输入”做pwn题”到拿到 flag 大约 1 分钟。WorkBuddy 自动完成了文件定位、安全检测、反编译分析、后门发现、payload 构造、远程执行、flag 提取的完整流程。