Angr 核心概念及模块解读

文章首发于 先知社区 前言 最近在学习 angr, 发现网上教程大部分都是简单介绍几个顶层接口,或者使用 angr 来解题,比较杂,而且很多接口已经丢弃。所以准备写 angr 系列的教程,同时当作个人学习的记录。 本文主要对 angr一些概念和接口进行介绍,更像是简略版的说明文档。文章略长,可以选择感兴趣的章节阅读。 希望通过这篇教程各位可以对 angr 的使用有整体的认识,快速上手 angr并利用它进行二进制分析和研究。对细节感兴趣的同学就可以查文档和看源码。 安装教程略去,按照文档安装即可。 顶层接口 首先简单介绍一下 angr 的几个顶层接口,我们会在下面章节中进一步介绍这些接口。 使用 angr 第一件事就是加载二进制文件,在 angr 中,基本上所有的对象操作都依赖于已有的 Project 。 >>> import angr >>> proj = angr.Project('/bin/true') 以下是 angr 对 Project 类的说明。 This is the main class of the angr module. It is meant to contain a set of binaries and the relationships between them, and perform analyses on them....

stack pivot

xctf16_b0verflow checksec: [*] '/home/yuuoniy/MY-AEG/nightmare/modules/17-stack_pivot/xctf16_b0verflow/b0verflow' Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x8048000) RWX: Has RWX segments Obviously, there is a stack overflow, while the overflow buffer only is 18 byte. as a result, we could utilize stack pivot technique. we could place our shellcode on string s, then jump to here. so we need a jmp gadget. and hint() has this! (we could also use tool to find it)...

chunk extend

题目: HITCON Trainging lab13 程序分析: create : 长度没有进行检测,如果为负数,会导致任意长度堆溢出漏洞 edit :存在 off-by-one 漏洞 利用思路 利用 Off-by-one 漏洞覆盖下一个 chunk 的 size 字段 申请伪造的chunk大小,造成 overlapping, 修改关键指针 要注意因为 chunk0 大小是 0x18,会用到 chunk1 的 pre_size 部分。 然后溢出的时候刚好可以覆盖到 nextchunk 的 size 部分。 然后堆布局基本是这样的: chunk1 info(0x20) | chunk1 | chunk2 info | chunk2 所以我们 chunk1 溢出修改的是 chunk2 info 的 size, 然后这个 chunk 就会覆盖到 chunk2 的信息, 从而我们可以修改 chunk2 信息,可以用来 leak info, 修改 got 表。 内存变化 这个覆盖了 size 后的 layout...