IO File Attack
IO FILE 和 相关攻击本文有部分来自ctf-wiki 感谢师傅们!
结构123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566struct _IO_FILE { int _flags; /* High-order word is _IO_MAGIC; rest is flags. */#define _IO_file_flags _flags /* The following pointers correspond to the C++ streambuf protocol. */ /* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */ char* _IO_read_ptr; /* Current read pointer */ char* _IO_read_end; ...
Large bin attack
Large Bin Attack
大小超过0x400
结构与unsorted bin 基本相同,多bk_next_size & fd_next_size
指向大小相对大或者小的堆块。
Large Bin 没有固定大小,有固定大小范围。
DEMO来自how2heap,这是一整个exp,接下来我会分开做解释
12345678910111213141516171819202122232425262728293031// gcc large_bin_attack.c -o large_bin_attack -g#include <stdio.h>#include <stdlib.h>int main(){ unsigned long stack_var1 = 0; unsigned long stack_var2 = 0; unsigned long *p1 = malloc(0x320); malloc(0x20); unsigned long *p2 = malloc(0x400); mal ...
House Of Orange + Unsorted Bin Attack
House Of Orange + Unsorted Bin Attack什么是 House Of Orange?
Make something out of nothing首先 假设我们的堆布局如下:
12graph TBA(Chunk)-.-B(Top Chunk)
而且 我们知道 如果此时的Chunk存在堆溢出状况 我们就可以覆盖Top chunk 的 Prev-Size 和 Size 位
知道了这些,我们就可以堆Top-chunk的源码进行分析了
Sources有关Top-chunk的分割 在glibc源码中有说明(glibc 2.29) 使用Top-chunk的前提是bin中没用合适使用的bin的情况下
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 ....... use_top: /* If large enough, split off the chunk ...
pico22-writeup
0x01 前言这次有幸参加了 Carnegie Mellon University,也就是卡巴梅隆大学的Pico CTF 截止到现在,3月21号,目前本人战绩如下:
主题来说,这次CTF的难度没有很高,Pwn系列题目没有堆题,主要是考察选手栈的升入理解,以及GDB动态能力;有幸帮助队伍解开了Forensics两道高分题,WEB一道高分题其实不是很难,哈哈
Binary ExploitationBasic-file exp1234567if ((entry_number = strtol(entry, NULL, 10)) == 0) { puts(flag); fseek(stdin, 0, SEEK_END); exit(0);}
完全的签到,输入的entry == 0直接打印flag
Buffer overflow zero因为程序堆溢出做出了检查,如果检查到溢出,就打印flag
1signal(11, (__sighandler_t)sigsegv_handler); // --> puts(flag);
直接溢出即可;
Buffer overf ...
Tcache_stuff
Tcache Source Bit-By-Bit本文章会对Tcache Bin在Glibc 2.29源码上的操作分析。
Tcache Struct首先,我们需要知道,在Glibc 2.29下 Tcache bin 是主要由这两个结构体控制的 分别是tcache_entry和tcache_perthread_struct:
tcache_entry需要注意的是,在Glibc2.29中加入了Key值,可以帮助判断Double Free
123456typedef struct tcache_entry{ struct tcache_entry *next; /* This field exists to detect double frees. */ struct tcache_perthread_struct *key;} tcache_entry;
tcache_entry结构体是用于连接在free状态下的chunk的结构体,拥有一个next指针,会指向下一个大小相同的Free Chunk
需要注意的是这里的 next 指向 chunk 的 user ...
pico-filtered-shellcode
0x01 题目解析废话不多说,我们直接看题,URL:https://play.picoctf.org/practice/challenge/184?category=6&page=1emmm,根据题目名称可以知道,这是一道和shellcode有关系的题目,满猜是什么变种题?有一个Fun文件,我们打开并且使用ida反编译康康:1234567891011121314151617181920int __cdecl main(int argc, const char **argv, const char **envp){ char v4[1000]; // [esp+1h] [ebp-3F5h] BYREF _DWORD code[3]; // [esp+3E9h] [ebp-Dh] *(&code[1] + 1) = &argc; setbuf(stdout, 0); LOBYTE(code[1]) = 0; puts("Give me code to run:"); code[0] = fgetc(stdin); whi ...
RV110W 漏洞复现
大家好 这里是Retr0mous~ 最近不知道从哪开始入门了iot方面的兴趣 最近百忙之中准备抽出时间来做一个路由器Pwn的漏洞 如果想要从mips架构开始 可以去看知世师傅的视频 连接在这:https://www.bilibili.com/video/BV1PE411E7Sz
Mips基础关于mips架构 这里有几个需要注意的点:
寄存器和指针有 RA GP SP 分别是返回地址 全局变量 栈顶指针
Mips没有 栈底指针 需要通过SP指针
Mips架构在调用函数会把返回地址存入t9寄存器中 后赋值给RA
当本函数是叶子函数的时候,ra寄存器是不会入栈的;非叶子函数的时候,ra寄存器入栈,有可以通过栈溢出来劫持控制流的机会
叶子与非叶子函数这里 我们会提到一个叶子函数非叶子函数的概念 我们举个例子123456789101112#include <stdio.h>int add(int arg1,int arg2){ int sum = arg1 + arg2; return sum; }int main(){ int ...
Retxx 解析
其实 这周末我原本是不想写文章的 主要是放假了但是 我想往常一样登录了百度站长。。。。我去!!!!! 我的文章被索引了!!!!所以呢 我决定多更新点文章出来 而且最近不是有人说看不懂吗 我觉得更新一些可以让人懂的一些东西但是今天 我还决定把Ret2讲完本次教学节选于星梦安全团队在Bilibili上发表的视频部分转载于https://www.anquanke.com/post/id/205858#h2-2
url为 https://www.bilibili.com/video/BV1Uv411j7fr?p=9
所有内容作者手打(除了一些代码部分)如有错误请指出如有侵权请联系本文作者
本次题目的下载链接:题目.rar
0x01 什么是ret2xx在此本文中 RET2xxx泛指的是ret2text, ret2shellcode, ret2syscall,ret2libc,ret2csu 其中 ret2代表着因为中的”return to” 的谐音也就是我们可以从字面意思上知道 我们会利用类似我们上节课学到的利用eip指针的方法 来获取到权限 而其中 有很多种方法来做到
ROP123456 ...