前言
这条链子由WJH’s Blog师傅首个发现,经典例题为2021湖湘杯的1解题 House_OF_Emma
适用范围:
glibc2.23-glibc.2.34
使用条件
- 可以任意写一个可控地址(LargeBin Attack、Tcache Stashing Unlink Attack…)
- 可以触发IO流(FSOP、 House of kiwi)
利用原理
在 vtable 的合法范围内,存在一个 _IO_cookie_jumps结构体
具体如下:
static const struct _IO_jump_t _IO_cookie_jumps libio_vtable = {
JUMP_INIT_DUMMY,
JUMP_INIT(finish, _IO_file_finish),
JUMP_INIT(overflow, _IO_file_overflow),
JUMP_INIT(underflow, _IO_file_underflow),
JUMP_INIT(uflow, _IO_default_uflow),
JUMP_INIT(pbackfail, _IO_default_pbackfail),
JUMP_INIT(xsputn, _IO_file_xsputn),
JUMP_INIT(xsgetn, _IO_default_xsgetn),
JUMP_INIT(seekoff, _IO_cookie_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, _IO_file_setbuf),
JUMP_INIT(sync, _IO_file_sync),
JUMP_INIT(doallocate, _IO_file_doallocate),
JUMP_INIT(read, _IO_cookie_read),
JUMP_INIT(write, _IO_cookie_write),
JUMP_INIT(seek, _IO_cookie_seek),
JUMP_INIT(close, _IO_cookie_close),
JUMP_INIT(stat, _IO_default_stat),
JUMP_INIT(showmanyc, _IO_default_showmanyc),
JUMP_INIT(imbue, _IO_default_imbue),
};
尽管 vtable 对具体位置有检测,但是依旧比较宽松,这使得我们可以在一定范围内对 vtable 表的起始位置进行偏移。我们可以通过偏移来调用 vtable 表中的任意函数,而 IO_cookie_jumps 这个虚表中恰好存在几个函数比较特殊可

最低0.47元/天 解锁文章
1093

被折叠的 条评论
为什么被折叠?



