博客
关于我
angr学习笔记(3)
阅读量:347 次
发布时间:2019-03-04

本文共 1087 字,大约阅读时间需要 3 分钟。

ANGR系列

ANGR是一个强大的反调试工具,能够帮助开发者在逆向工程过程中更高效地分析程序行为。本文将通过实际案例,展示如何利用ANGR进行漏洞挖掘和验证。

代码1

以下是利用ANGR进行基本漏洞挖掘的代码示例:

```pythonimport angrpp = angrp.Project("00_angr_find")init_state = p.factory.entry_state()sm = p.factory.simulation_manager(init_state)sm.explore(find=0x08048678, avoid=0x08048666)found_state = sm.found[0]print(found_state.posix.dumps(0))print(found_state.posix.dumps(1))```

代码中,`sm.explore`方法用于在程序中搜索特定地址空间中的目标地址(`find`),同时避免进入某些特定地址空间(`avoid`)。`found_state`即为触发漏洞的状态,其`posix.dumps`方法用于dump相关内存内容。

代码2

下面是对漏洞有效性验证的代码示例:

```pythonimport angrpp = angrp.Project("00_angr_find")init_state = p.factory.entry_state()sm = p.factory.simulation_manager(init_state)

def is_good(state):return b'Good Job' in state.posix.dumps(1)

def is_bad(state):return b'Try again' in state.posix.dumps(1)

sm.explore(find=is_good, avoid=is_bad)found_state = sm.found[0]print(found_state.posix.dumps(0))print(found_state.posix.dumps(1))

在本代码中,`is_good`和`is_bad`函数分别检查程序输出中特定字符串的存在情况。`sm.explore`根据条件筛选出符合预期的漏洞状态。

验证

通过上述代码示例,可以验证漏洞的有效性。首先,运行漏洞挖掘脚本,找到触发漏洞的路径;其次,通过验证函数确保漏洞确实带来预期的效果;最后,输出相关内存内容以确认漏洞的存在。

转载地址:http://itve.baihongyu.com/

你可能感兴趣的文章
Python:datetime tzinfo 时区名称文档
查看>>
Python:deepcopy(list) vs new_list = old_list[:]
查看>>
Python:Google API - 从消息中获取 mimeTypes
查看>>
Python:Google API - 从消息中获取 mimeTypes
查看>>
Python:subprocess.call,stdout to file,stderr to file,在屏幕上实时显示stderr
查看>>
Python:TypeError:无法连接“str“和“int“对象
查看>>
Python:XPath 在 ElementTree 中不可用
查看>>
Python:从 FTP 服务器下载文件
查看>>
python:从列表中创建元组列表
查看>>
Python:从嵌套列表中删除重复项
查看>>
Python:从间隔映射到值
查看>>
Python:使用 shell=False 的子进程调用不起作用
查看>>
Python:修改 PATH 环境变量的平台无关方式
查看>>
Python:假与 0
查看>>
Python:函数使用
查看>>
Python:函数进阶
查看>>
Python:在整数的二进制表示中查找最长的二进制间隙
查看>>
Python:如何从二进制转换为 base 64 并返回?
查看>>
Python:如何以非阻塞方式读取子进程的标准输出
查看>>
Python:如何使用 plotly 制作阴影区域或交替背景颜色?
查看>>