当前位置:网站首页>Angr (IV) -- angr_ ctf
Angr (IV) -- angr_ ctf
2022-07-25 10:20:00 【c1rcl3】
adopt angr_ctf be familiar with angr How to use
Reference link :
bilibili - angr Symbol execution
04
1. Direct download angr_ctf Provided ELF Executable file 04_angr_symbolic_stack
2. use IDA Static analysis , It can be found that the key logic of the program is handle_user in

Program call scanf Read two unsigned integers (unsigned int) Go to the stack , Then call complex_function0 and complex_function1 Process the two parameters separately , Finally, make logical judgment , Output Good Job or Try again.
3. Write a script to solve the program output Good Job Input corresponding to , You can specify symbols to execute from handle_user Function call scanf Method starts after reading the input , The stack needs to be deployed .
import angr
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("./04")
start_addr = 0x8048697
init_state = p.factory.blank_state(addr=start_addr)
padding_size = 8
init_state.stack_push(init_state.regs.ebp)
init_state.regs.ebp = init_state.regs.esp
init_state.regs.esp -= padding_size
pass1 = init_state.solver.BVS('pass1', 32)
pass2 = init_state.solver.BVS('pass2', 32)
init_state.stack_push(pass1)
init_state.stack_push(pass2)
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]
res1 = found_state.solver.eval(pass1)
res2 = found_state.solver.eval(pass2)
print("{} {}".format(res1, res2))4. Run the script to see the results

5. Verify the correctness of the results
![]()
05
1. Direct download angr_ctf Provided ELF Executable file 05_angr_symbolic_memory
2. use IDA Static analysis

Program call scanf Read 4 individual 8 Byte string into the specified memory , And then to 32 Bytes are processed one by one , Finally, judge by string comparison , Output Good Job or Try again.
3. Write a script to solve the program output Good Job Input corresponding to , You can specify the symbol to execute the slave call scanf Method starts after reading the input , Memory needs to be deployed .
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("./05")
start_addr = 0x8048601
init_state = p.factory.blank_state(addr=start_addr)
p1 = claripy.BVS('p1', 64)
p2 = claripy.BVS('p2', 64)
p3 = claripy.BVS('p3', 64)
p4 = claripy.BVS('p4', 64)
p1_addr = 0xA1BA1C0
p2_addr = 0xA1BA1C8
p3_addr = 0xA1BA1D0
p4_addr = 0xA1BA1D8
init_state.memory.store(p1_addr, p1)
init_state.memory.store(p2_addr, p2)
init_state.memory.store(p3_addr, p3)
init_state.memory.store(p4_addr, p4)
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]
res1 = found_state.solver.eval(p1, cast_to=bytes).decode()
res2 = found_state.solver.eval(p2, cast_to=bytes).decode()
res3 = found_state.solver.eval(p3, cast_to=bytes).decode()
res4 = found_state.solver.eval(p4, cast_to=bytes).decode()
print(res1)
print(res2)
print(res3)
print(res4)4. Run the script to see the results

5. Verify the correctness of the results
![]()
边栏推荐
- PyTorch 对 Batch 中每个样本计算损失 Loss for each sample
- 【专栏】RPC系列(理论)-夜的第一章
- Yiwen society, three necessary packet capturing tools for hackers
- 贪吃蛇小游戏
- 升级 GLIBC 2.29 checking LD_LIBRARY_PATH variable... contains current directory error 解决方案
- 多线程——死锁和synchronized
- NPM details
- 二、unittest框架主要做什么
- Swing component Icon
- Erlang (offline deployment)
猜你喜欢

IDEA整体字体大小修改

Angr(二)——angr_ctf

Number theory -- negative Radix conversion

mysql 解决不支持中文的问题

JS encryption parameter positioning

PyTorch 对 Batch 中每个样本计算损失 Loss for each sample

message from server: “Host ‘xxx.xxx.xxx.xxx‘ is not allowed to connect to this MySQL server“

静态路由的配置(以华为eNSP为例)

关于slf4j log4j log4j2的jar包配合使用的那些事

UE4 LoadingScreen动态加载启动动画
随机推荐
Attention is all you need 论文精读笔记 Transformer
shortest-unsorted-continuous-subarray
Exception handling exception
The way of code neatness -- hit the pain point directly
力扣刷题组合问题总结(回溯)
几个常用的网络诊断命令
安装mysql时,string the service 安装失败>mysql80启动失败
Multithreading -- callable interface, lambda
NPM details
Detailed explanation of chrome developer tools
Virtual private line network deployment
广度优先遍历(图和二叉树的层序遍历相关问题)
Round to the nearest
mysql 解决不支持中文的问题
Angr(七)——angr_ctf
复现 ASVspoof 2021 baseline RawNet2
Output stream in io stream
The ultimate summary of jsonobject parsing JSON format
Small knowledge of common classes
Angr(二)——angr_ctf