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

main函数调用scanf读取16字节的字符串输入至缓冲区buffer,然后调用complex_function函数对输入进行处理。最后调用check_equals_AUPDNNPROEZRJWKB完成逐字符的字符串比较,并根据结果相应输出。
3. 编写脚本求解程序输出Good Job时对应的输入,为了避免字符串比较函数造成路径爆炸,可以避免对check部分的逻辑进行符号执行
import angr
import claripy
p = angr.Project("./08")
start_addr = 0x8048625
check_addr = 0x8048565
init_state = p.factory.blank_state(addr=start_addr)
pass_addr = 0x804A050
pass = claripy.BVS('pass', 16 * 8)
init_state.memory.store(pass_addr, pass)
sm = p.factory.simulation_manager(init_state)
sm.explore(find=check_addr)
for i in range(0, len(sm.found)):
found_state = sm.found[i]
target = "AUPDNNPROEZRJWKB".encode()
param1 = pass_addr
param2 = 16
bvt = found_state.memory.load(param1, param2)
found_state.add_constraints(bvt == target)
res = found_state.solver.eval(pass, cast_to=bytes).decode()
print(res)4. 运行脚本查看结果
![]()
5. 检查结果的正确性
![]()
09
1. 直接下载angr_ctf提供的ELF可执行文件09_angr_hooks
2. 用IDA静态分析

main函数逻辑可以分为两部分:
第一部分:首先读取一个16字符的字符串至缓冲区buffer中,之后调用complex_function函数对buffer中的内容进行逐字符处理,最后将处理后的buffer中的内容与password缓冲区中的字符串进行比较。
第二部分:再次读取一个16字符的字符串至缓冲区buffer中,之后调用complex_function函数对password中的内容进行逐字符处理,最后将处理后的password中的内容与buffer中的字符串进行比较。
3. 编写脚本求解程序输出Good Job时对应的输入,为了避免字符串比较函数造成路径爆炸,可以对check函数进行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("./09")
check_addr = 0x80486B3
skip_size = 5
init_state = p.factory.entry_state()
@p.hook(check_addr, length=skip_size)
def check_hook(state):
pass_addr = 0x804A054
pass_size = 0x10
bvt = state.memory.load(pass_addr, pass_size)
target = "XYMKBKUHNIQYNQXE".encode()
state.regs.eax = claripy.If(target == bvt, claripy.BVV(1, 32), claripy.BVV(0, 32))
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("{}".format(found_state.posix.dumps(0)))4. 运行脚本查看结果

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

力扣刷题组合问题总结(回溯)

VLAN的配置及其应用(以华为eNSP为例)

CentOS install redis

复现 ASVspoof 2021 baseline RawNet2

将 conda 虚拟环境 env 加入 jupyter kernel

UE4 窗口控制(最大化 最小化)

emmet语法速查 syntax基本语法部分

Configuring ROS development environment with vscode: Causes and solutions to the problem of ineffective code modification

文件的上传功能

复现 SSL_Anti-spoofing, 使用 wav2vec 2.0 和数据增强的自动说话人认证的欺骗攻击与深度伪造检测
随机推荐
File upload function
VoxCeleb1 数据集下载
Simple addition calculator
Round to the nearest
Use of dictionary tree
ROS distributed operation -- launch file starts nodes on multiple machines
链表相关(设计链表及环链表问题)
JS uses requestanimationframe to detect the FPS frame rate of the current animation in real time
Subtotal of rospy odometry sinkhole
21. Merge Two Sorted Lists
OSPF协议的配置(以华为eNSP为例)
Common methods of nodejs version upgrade or switching
安装 oh my zsh
NPM details
复现 ASVspoof 2021 baseline RawNet2
多线程——Callable接口,lambda
微信小程序跳转其他小程序
构建 Dompteur 容器问题小记
贪吃蛇小游戏
Summary of most consistency problems