bkerler/exploit_me
GitHub: bkerler/exploit_me
面向ARM/ARM64平台的CTF风格漏洞利用学习项目,涵盖29种漏洞技术的渐进式实战教程。
Stars: 1068 | Forks: 151
# exploit_me
## 极易受攻击的 ARM/ARM64[AARCH64] 应用程序(CTF 风格的漏洞利用教程,可移植到其他平台)
(c) B.Kerler 2018-2020
## 缘由:
我的一些朋友问我,是否可以针对过去几年在现实世界中看到的 ARM/ARM64[AARCH64]/其他平台上的漏洞利用情况,做一些示例。
所以,出于培训目的,我想:为什么不呢 :)
## 当前漏洞:
```
Level 1: Integer overflow
Level 2: Stack overflow
Level 3: Array overflow
Level 4: Off by one
Level 5: Stack cookie
Level 6: Format string
Level 7: Heap overflow
Level 8: Structure redirection / Type confusion
Level 9: Zero pointers
Level 10: Command injection
Level 11: Path Traversal
Level 12: Return oriented programming (ROP)
Level 13: Use-after-free
Level 14: Jump oriented programming (JOP)
Level 15: Stable format-string write
Level 16: Double free
Level 17: Signedness bug
Level 18: Integer multiplication overflow
Level 19: Null pointer bug
Level 20: Uninitialized memory read
Level 21: Out-of-bounds read
Level 22: TOCTOU path race
Level 23: Insecure temporary file / symlink attack
Level 24: Environment variable injection
Level 25: Unsafe parser / deserialization
Level 26: Filtered command injection / quoting bypass
Level 27: Heap metadata corruption
Level 28: ROP-style function-pointer control flow
Level 29: Dangling stack pointer
```
## 在 Debian/Ubuntu 系统上安装:
下载仓库
```
git clone https://github.com/bkerler/exploit_me
```
在主机(Ubuntu)上安装所需的工具
```
~$ cd exploit_me
~/exploit_me $ ./script/setup.sh
```
## 使用提示:
- 查看 hints.txt 作为入门。
- 测试是否正常运行:
*** 32 位:
$ ./bin/exploit
*** 64 位:
$ ./bin/exploit64
- 调试会话示例:
$ sudo ./scripts/disableaslr.sh
(禁用 aslr,如果你想获得更多乐趣,请不要运行)
(当前的 exploit 目录中需要 Path Traversal 漏洞所需的路径 dir1/dir2)
在第一个终端:
*** 32 位:
$ ./bin/arm exploit [关卡密码] [选项] &
$ gdb-multiarch ./exploit
pwndbg> set architecture arm
你也可以在 .gdbinit 中添加 architecture,如 "set architecture arm"
*** 64 位:
$ ./arm64 exploit64 [关卡密码] [选项] &
$ gdb-multiarch ./exploit64
pwndbg> set architecture aarch64
你也可以在 .gdbinit 中添加 architecture,如 "set architecture aarch64"
*** .gdbinit 示例
set endian little
#set architecture arm
#set architecture aarch64
target remote :1234
- GDB 基础:
使用
"si" 单步进入函数或
"so" 单步跳过函数,
"info functions" 打印所有函数,
"p [function]" 打印函数地址和信息(如果符号存在),
"b [function]"(例如:"b main" 设置断点,"b *0x1234" 在地址 0x1234 处设置断点,
"c" 继续运行程序,
"x/[dwords]x" 打印偏移量,例如 "x/4x 0x1234",以及
"x/[dwords]x $reg" 打印寄存器内容,例如 "x/4x $sp"。
使用 pwndbg,你可以使用
"rop" 列出 rop gadgets,例如 "rop --grep 'pop {r3'" 列出将值从栈弹出到 r3 的 gadgets。
详情请见 https://github.com/pwndbg/pwndbg/blob/dev/FEATURES.md !
- 当你成功利用漏洞后,你会看到下一关的密码。
因此,如果 level2 的密码是 "Level2":
*** 32 位:
$ ./bin/exploit Level2
*** 64 位:
$ ./bin/exploit64 Level2
- 给作弊者或想在缺乏指令知识的情况下进行理解的人:
请查看 solutions/solutions.txt 和 src/exploit.cpp 中的源代码
- 还有更多可能的解决方案,甚至可以使用 rop chains,而不仅仅是我提供的示例解决方案
- 控制台会打印一些提示(信息泄露),通常你是看不到这些的,但这些能让初学者更容易上手,这也是我添加它们的原因
## 待办事项:
- 当我看到其他漏洞或有空闲时间时(例如多线程漏洞),我会将其添加进来。但如果你想添加一些,我很乐意提供帮助!
## 给 ARM 逆向初学者的一些建议:
- 在这里学习一些 ARM 汇编基础和 Shellcode 知识:https://azeria-labs.com/
- 阅读 Billy Ellis 的《Beginner's Guide to Exploitation on ARM》一书以及他的 YouTube 教程视频
- 阅读“ARM exploitation for IoT”博客系列第 1 - 3 部分 https://quequero.org/category/security/
- 阅读 Tobias Klein 的《A Bug Hunter's Diary》一书
- 阅读 ARMv8 (AARCH64) Opcode 手册:https://www.element14.com/community/servlet/JiveServlet/previewBody/41836-102-1-229511/ARM.Reference_Manual.pdf
## 许可证:
MIT 许可证
(随意分享、修改和使用,但请注明原作者!)
标签:ARM架构, Go语言工具, UML, Web报告查看器, 二进制安全, 云资产清单, 安全教程, 应用安全, 逆向工具, 逆向工程