angr符号执行用例解析——ais3_crackme

本文介绍了一个简单的二进制文件ais3_crackme的破解过程,通过使用angr工具,分析二进制文件,寻找正确密钥,最终成功破解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

源码及二进制文件链接:https://github.com/angr/angr-doc/tree/master/examples/ais3_crackme

这次的用例非常简单,也非常基础(也是唯一一个,我自己能做出来的)。

执行这个二进制文件 ./ais3_crackme

输出: You need to enter the secret key!

看来需要参数,随便输入个123: ./ais3_crackme 123

输出:You need to enter the secret key!

所以我们的目的就是输入一个正确的key,得到成功的返回结果,这个key就是最后的flag了。

把ais3_crackme拖到IDA中,分析一下(记得用64位的IDA分析这个文件):

查看字符串:


看到了,Correct!... 再看下调用它的地址:


调用地址是0x400602,下一条指令的地址是0x400607,所以我们目标就是让程序执行到0x400607。

现在就知道如何使用angr了,就是让程序接收一个符号输入,找到从入口点到地址0x400607的路径,求解满足这个路径的符号值就可以啦。

代码如下:

import angr
import claripy

b=angr.Project('ais3_crackme') # load the binary file
argv=claripy.BVS('argv1',100*8) # create a symbol variable
# get the state of entry point
s=b.factory.entry_state(args=['./c',argv]) # the ./c is needed, without it will wrong maybe is related with the input format
sm=b.factory.simulation_manager(s) # init the simulation manager from the entry state
sm.explore(find=0x4006F0) # execute and  find the path to 0x
found=sm.found[0]
solution=found.solver.eval(argv,cast_to=str)
print repr(solution)

solution=solution[:solution.find("\x00")] # because the argv is too long, we need split the result
print solution

运行后输出结果:

ais3{I_tak3_g00d_n0t3s}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值