当前位置:网站首页>Angr(八)——angr_ctf
Angr(八)——angr_ctf
2022-07-25 09:27:00 【c1rcl3】
通过angr_ctf熟悉angr的使用方法
参考链接:
12
1. 直接下载angr_ctf提供的ELF可执行文件12_angr_veritesting
2. 用IDA静态分析

main函数中调用scanf函数读取长度为32字节的字符串输入到起始地址为buffer[3]的内存空间中,逐个比较buffer[i + 3]和complex_function(75, i + 93)。
3. 编写脚本求解程序输出Good Job时对应的输入,可以通过veritesting缓解路径爆炸
import angr
import claripy
def isGood(state):
return b'Good Job.' in state.posix.dumps(1)
def isBad(state):
return b'Try again.' in state.posix.dumps(1)
p = angr.Project("./12")
init_state = p.factory.entry_state()
sm = p.factory.simulation_manager(init_state, veritesting=True)
sm.explore(find=isGood, avoid=isBad)
for i in range(0, len(sm.found)):
found_state = sm.found[i]
print(found_state.posix.dumps(0))4. 运行脚本查看结果

5. 检查结果的正确性
![]()
13
1. 直接下载angr_ctf提供的ELF可执行文件13_angr_static_binary
2. 用IDA静态分析

函数逻辑比较简单,与前面几例的也比较类似,这里不再赘述。
3. 编写脚本求解程序输出Good Job时对应的输入,由于该程序是静态链接的,故对于scanf、printf、puts等函数,angr不会自动将其hook,替换成angr自己实现的函数,而是进行符号执行。为了避免路径爆炸和过多的开销,可以手动hook
import angr
import claripy
def isGood(state):
return b'Good Job.' in state.posix.dumps(1)
def isBad(state):
return b'Try again.' in state.posix.dumps(1)
p = angr.Project("./13")
init_state = p.factory.entry_state()
printf_addr = 0x804ED40
scanf_addr = 0x804ED80
puts_addr = 0x804F350
strcmp_addr = 0x805B450
libc_start_main_addr = 0x8048D10
p.hook(printf_addr, angr.SIM_PROCEDURES['libc']['printf']())
p.hook(scanf_addr, angr.SIM_PROCEDURES['libc']['scanf']())
p.hook(puts_addr, angr.SIM_PROCEDURES['libc']['puts']())
p.hook(strcmp_addr, angr.SIM_PROCEDURES['libc']['strcmp']())
p.hook(libc_start_main_addr, angr.SIM_PROCEDURES['glibc']['__libc_start_main']())
sm = p.factory.simulation_manager(init_state)
sm.explore(find=isGood, avoid=isBad)
for i in range(0, len(sm.found)):
found_state = sm.found[i]
print(found_state.posix.dumps(0))4. 运行脚本查看结果

5. 验证结果的正确性
![]()
边栏推荐
猜你喜欢

See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent

nodejs链接mysql报错:ER_NOT_SUPPORTED_AUTH_MODEError: ER_NOT_SUPPORTED_AUTH_MODE

JS uses requestanimationframe to detect the FPS frame rate of the current animation in real time

Use and principle of rest

字典树的使用

Duplicate SSL_ Anti spoofing, spoofing attacks and deep forgery detection using wav2vec 2.0 and data enhanced automatic speaker authentication

DHCP的配置(以华为eNSP为例)

升级 GLIBC 2.29 checking LD_LIBRARY_PATH variable... contains current directory error 解决方案

UE4 LoadingScreen动态加载启动动画

文件的上传功能
随机推荐
Wechat applet jumps to other applets
IO流中的输入流
IO流中的输出流
UE4 框架介绍
Duplicate SSL_ Anti spoofing, spoofing attacks and deep forgery detection using wav2vec 2.0 and data enhanced automatic speaker authentication
Summary of most consistency problems
Redis和MongoDB的区别
数论--负进制转换
yarn速查手册
pnpm简述
Input stream in io stream
@Import,Conditional和@ImportResourse注解
emmet语法速查 syntax基本语法部分
message from server: “Host ‘xxx.xxx.xxx.xxx‘ is not allowed to connect to this MySQL server“
VS Code 连接远程 Jupyter 服务器
链表相关(设计链表及环链表问题)
js数字千位分割的常用方法
Chrome开发者工具详解
Swing的组件图标
See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent