finish 8.1.3

This commit is contained in:
firmianay 2018-03-20 12:03:32 +08:00
parent a27e378663
commit 47b4efd4d6
10 changed files with 42 additions and 9 deletions

View File

@ -142,8 +142,9 @@ GitHub 地址https://github.com/firmianay/CTF-All-In-One
* 7.2.x
* [八、学术篇](doc/8_academic.md)
* Return-Oriented Programming
* [8.1 The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86)](doc/8.1_return-into-libc_without_function_calls.md)
* [8.2 Return-Oriented Programming without Returns](doc/8.2_return-oriented_programming_without_returns.md)
* [8.1.1 The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86)](doc/8.1.1_return-into-libc_without_function_calls.md)
* [8.1.2 Return-Oriented Programming without Returns](doc/8.1.2_return-oriented_programming_without_returns.md)
* [8.1.3 Return-Oriented Rootkits: Bypassing Kernel Code Integrity Protection Mechanisms](doc/8.1.3_return-oriented_rootkits.md)
* Reverse Engineering
* [8.3 New Frontiers of Reverse Engineering](doc/8.3_new_frontiers_of_reverse_engineering.md)
* Android Security

View File

@ -1,4 +1,4 @@
# 8.1 The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86)
# 8.1.1 The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86)
## 简介
@ -26,7 +26,7 @@
## 寻找指令序列
为了完成指令序列的构建,首先需要在 libc 中找到一些以 return 指令结尾,并且在执行时必然以 return 结束而不会跳到其它地方的小工具gadgets算法如下
![](../pic/8.1_galileo.png)
![](../pic/8.1.1_galileo.png)
大概就是扫描二进制找到 ret 指令,将其作为 trie 的根节点,然后回溯解析前面的指令,如果是有效指令,将其添加为子节点,再判断是否为 boring如果不是就继续递归回溯。举个例子在一个 trie 中一个表示 `pop %eax` 的节点是表示 `ret` 的根节点的子节点,则这个 gadgets 为 `pop %eax; ret`。如此就能把有用的 gadgets 都找出来。

View File

@ -1,4 +1,4 @@
# 8.2 Return-Oriented Programming without Returns
# 8.1.2 Return-Oriented Programming without Returns
## 简介
@ -41,7 +41,7 @@ blx r5
跳转攻击流程的原理如下图所示:
![](../pic/8.2_rop_without_ret.png)
![](../pic/8.1.2_rop_without_ret.png)
在 x86 上,我们使用一个寄存器 y 保存 trampoline 的地址,那么以间接跳转到 y 结束的指令序列的行为就像是以一个 update-load-branch 指令结束一样。并形成像 ROP 链一样的东西。这种操作在 ARM 上也是类似的。
@ -67,4 +67,4 @@ pop %eax; jmp *(%eax)
下图是一个函数调用的示例:
![](../pic/8.2_function.png)
![](../pic/8.1.2_function.png)

View File

@ -0,0 +1,31 @@
# 8.1.3 Return-Oriented Rootkits: Bypassing Kernel Code Integrity Protection Mechanisms
## 简介
本论文设计并实现了一个能够自动化构建 ROP 指令序列的攻击系统。由于系统使用的指令序列来自内核已有的代码,而不需要进行代码注入,所以能够绕过内核代码完整性保护机制。
## 内核完整性保护机制
#### 内核模块签名
这一机制要求所有内核模块都需要经过数字签名的验证,并拒绝加载验证失败的代码,所以它的有效性在模块加载时体现,可以一定程度上防御代码注入攻击。但这种方法并不能保证已有的内核代码中没有可以利用的漏洞或指令序列。
#### W⊕X
这一机制通过对内存进行可读或可写的标记,能够在运行时防御代码注入攻击。这种机制对于内核的有效性在于,它假设了攻击者会对内核空间的代码进行修改和执行,然而在实践中,攻击者往往先获得用户空间的权限,然后修改虚拟地址中用户空间部分的页面权限。由于页表的不可执行位标记不够精细,所以不可能仅在用户模式下就将页面标记为可执行。于是攻击者可以在用户空间准备好自己的指令,然后让漏洞代码跳转到那里执行。
## 自动化 ROP
基于 ROP 技术,就可以绕过上面的内核完整性保护机制。
内核 ROP 如下图所示:
![](../pic/8.1.3_rop.png)
自动化攻击系统的结构如下图所示:
![](../pic/8.1.3_overview.png)
其中的三个核心组成部分:
- Constructor扫描给定的二进制文件标记出有用的指令序列并自动构建出 gadgets
- Compiler提供了一种专门用于 ROP 的语言,它将 Constructor 的输出和用该语言编写的源文件一起编译,生成程序的最终内存映像
- Loader由于 Compiler 的输出是位置无关的Loader 用于将相对地址解析为绝对地址

View File

@ -4,8 +4,9 @@
链接https://pan.baidu.com/s/1G-WFCzAU2VdrrsHqJzjGpw 密码vhfw
* Return-Oriented Programming
* [8.1 The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86)](doc/8.1_return-into-libc_without_function_calls.md)
* [8.2 Return-Oriented Programming without Returns](doc/8.2_return-oriented_programming_without_returns.md)
* [8.1.1 The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86)](doc/8.1.1_return-into-libc_without_function_calls.md)
* [8.1.2 Return-Oriented Programming without Returns](doc/8.1.2_return-oriented_programming_without_returns.md)
* [8.1.3 Return-Oriented Rootkits: Bypassing Kernel Code Integrity Protection Mechanisms](doc/8.1.3_return-oriented_rootkits.md)
* Reverse Engineering
* [8.3 New Frontiers of Reverse Engineering](doc/8.3_new_frontiers_of_reverse_engineering.md)
* Android Security

View File

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View File

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 181 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

BIN
pic/8.1.3_overview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
pic/8.1.3_rop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB