PWN January 03, 2020

数组下标越界专题

Words count 56k Reading time 51 mins.

一、数组下标越界简介:

栈是由高往低增长的,而数组的存储是由低位往高位存的,如果越界的话,会把当前函数的ebp和下一跳的指令地址覆盖掉,如果覆盖了当前函数的ebp,那么在恢复的时候esp就不能指向正确的...

Read article

PWN January 03, 2020

数组下标越界专题

Words count 56k Reading time 51 mins.

一、数组下标越界简介:

栈是由高往低增长的,而数组的存储是由低位往高位存的,如果越界的话,会把当前函数的ebp和下一跳的指令地址覆盖掉,如果覆盖了当前函数的ebp,那么在恢复的时候esp就不能指向正确的地方,从而导致未可知的情况,如果下一跳的地址也被覆盖掉,那么肯定会导致crash,看一张图:

这样一下看就很明显了,当你把数组的下标越过了最大索引值的时候,所指向的指针就会指向更高地址的栈空间段,所以我们就能够实现任意改写栈空间上的内容,同理,当下标为负数的时候指针会指向更低地址的栈空间段。但是这...

Read article

PWN January 03, 2020

格式化字符串漏洞学习

Words count 37k Reading time 34 mins.

前置知识:

一些小技巧和知识:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
这部分来自icemakr的博客

32



'%{}$x'.format(index) // 读4个字节
'%{}$p'.format(index) // 同上面
'${}$s'.format(index)


'%{}$n'.format(index) // 解引用,...
Read article

PWN January 03, 2020

神奇的gadget

Words count 14k Reading time 12 mins.

一、神奇的gadget:

这个gadget一般存在于__do_global_dtors_aux中,可能是出题人自己写的gadget吧~适用于no leak类型的题目。

1
add [rbp-3Dh],ebx           //当rbp和ebx可控时,我们可以修改rbp-0x3d地址里面内容,一般用于计算真实地址之间的偏移,从而获取想要的真实地址

拿一道题看看吧:

no_leak

先看看保护机制:

got表不可改,NX保护,庆幸的是没有canary保护和pie,比较友好,先看看ida:

1
2
3
4
5
6
7
8
int...
Read article

PWN January 03, 2020

library题解

Words count 49k Reading time 45 mins.

一、题目

library

先checksec下:

除了pie没有开,其他保护都开了,got表不可改,那么只能改malloc_hook和free_hook了,这题ida看下逻辑:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
int __cdecl __noreturn main(int argc, const char **argv, const char...
Read article

PWN January 03, 2020

House of Lor

Words count 6.6k Reading time 6 mins.

一、原理:

先来看下small bin中的源码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
if (in_smallbin_range(nb)) {
// 获取 small bin 的索引
idx = smallbin_index(nb);
// 获取对应 small bin 中的 chunk 指针
bin = bin_at(av, idx);
// 先执行 victim= last(bin...
Read article

PWN January 03, 2020

House of Rabbit

Words count 21k Reading time 19 mins.

一、原理介绍:

1、修改size:

1
2
3
4
5
6
7
8
9
10
11
12
#include "stdio.h"
#include "string.h"
int main()
{
unsigned long* chunk1=malloc(0x40); //0x602000
unsigned long* chunk2=malloc(0x40); //0x602050
malloc(0x10);
free(chunk1);
free(chunk2);
chunk1[-1]=0xa1;
malloc(0x1000);
&...
Read article

PWN January 03, 2020

House of orange

Words count 84k Reading time 1:17

一、第一种类型的原理

House of Orange 的利用比较特殊,首先需要目标漏洞是堆上的漏洞但是特殊之处在于题目中不存在 free 函数或其他释放堆块的函数。我们知道一般想要利用堆漏洞,需要对堆块进行 malloc 和 free 操作,但是在 House of Orange 利用中无法使用 free 函数,因此 House of Orange 核心就是通过漏洞利用获得 free 的效果。如我们前面所述,House of Orange 的核心在于在没有 free 函数的情况下得到一个释放的堆块...

Read article

PWN January 03, 2020

IO_FILE探索

Words count 81k Reading time 1:13

一、IO_File结构体一览

首先看一波源码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
struct _IO_FILE {
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
#define _IO_file_flags _flags

/* The following pointers correspond...
Read article

PWN January 03, 2020

万圣节Pwnhub一道题

Words count 36k Reading time 33 mins.

一、pwnhub

这题感觉挺有意思的 ,思路清晰了,但是过程煎熬了,下面记录下自己经历的事和学到的东西。

保护全开,就不说了直接看看ida:

3个功能,一个malloc、一个free、一个write函数,这里先看下malloc函数:

先申请一个0x10的没用的块用来隔开堆块,再申请不超过0xff的堆块去写内容,然后每一次malloc,num就会加一,这里只能malloc10次,超了就没了,接着看下free函数:

很明显的UAF漏洞,然后只free那个自己申请的内容块,0x10的堆块作为标志...

Read article

PWN January 03, 2020

Pwnable.tw的shellcode系列

Words count 71k Reading time 1:04

这篇博客专门讲shellcode的系列,也作为一个复习内容吧,主要针对的是,各种情况下的绕过shellcode检测:

首先是shellcode的生成,一般2种途径:工具+手撕

这里优先推荐手撕,不然你就是脚本小子,遇到难一点的检测机制,还是会绕不过,从最简单的开始:

一、一般的getshell或者orw出flag

32位下:

1、找准寄存器,确定系统调用的对应值

eax、ebx、ecx、edx (对应的是系统调用号+3个参数)

2、execve(“/bin/sh”,0, 0)的情况:

1
2
3
4
5...
Read article
Load more
0%