当前位置:网站首页>Angr (V) - angr_ ctf
Angr (V) - 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
06
1. Direct download angr_ctf Provided ELF Executable file 06_angr_symbolic_dynamic_memory
2. use IDA Static analysis

main The function is called first malloc Function dynamically applied for two on the heap 9 Byte space buffer0 and buffer1, Then call scanf Function reads two 8 Byte string . adopt complex_function The function performs character by character processing on two inputs respectively , Finally, judge whether the two new strings obtained by transformation are UODXLZBI and UAORRAYF. If it is , The output Good Job, Otherwise output 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("./06")
start_addr = 0x8048699
init_state = p.factory.blank_state(addr=start_addr)
p1 = claripy.BVS('p1', 64)
p2 = claripy.BVS('p2', 64)
fake_heap_addr1 = 0x4444444
fake_heap_addr2 = 0x4444454
pointer1 = 0xABCC8A4
pointer2 = 0xABCC8AC
init_state.memory.store(pointer1, fake_heap_addr1, endness=p.arch.memory_endness, size=4)
init_state.memory.store(pointer2, fake_heap_addr2, endness=p.arch.memory_endness, size=4)
init_state.memory.store(fake_heap_addr1, p1)
init_state.memory.store(fake_heap_addr2, p2)
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()
print(res1)
print(res2)4. Run the script to see the results

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

main Function first passes scanf Parameter reads a string to buffer, And then call ignore_me function , take buffer Content in write to file OJKSQYDP.txt in . After then OJKSQYDP.txt Read in the contents of the file buffer, adopt complex_function Function to process . Finally, match the processed string with AQWLCTXB Compare , If the same, output Good Job, Otherwise output 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 fopen Method starts before opening the file , The file content 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("./07")
start_addr = 0x80488D6
init_state = p.factory.blank_state(addr=start_addr)
password = claripy.BVS('password', 64)
filename = 'OJKSQYDP.txt'
file = angr.storage.SimFile(filename, content=password)
init_state.fs.insert(filename, file)
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]
res = found_state.solver.eval(password, cast_to=bytes).decode()
print(res)4. Run the script to see the results
![]()
5. Verify the correctness of the results
![]()
边栏推荐
猜你喜欢

复现 ASVspoof 2021 baseline RawNet2

Ansible部署指南

js加密参数定位

mysql 解决不支持中文的问题

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

Open virtual private line network load balancing

VS Code 连接远程 Jupyter 服务器

VSCode Latex Workshop 设置 XeLatex 编译

Common methods of nodejs version upgrade or switching

PyTorch 对 Batch 中每个样本计算损失 Loss for each sample
随机推荐
Erlang (offline deployment)
Angr (II) -- angr_ ctf
Angr (VI) -- angr_ ctf
Angr (I) - Installation
IDEA整体字体大小修改
Radio and multi selection buttons of swing components
升级 GLIBC 2.29 checking LD_LIBRARY_PATH variable... contains current directory error 解决方案
VoxCeleb1 数据集下载
UE4 LoadingScreen动态加载启动动画
Redis使用场景
for循环:水仙花案例
测试基本概念
关于slf4j log4j log4j2的jar包配合使用的那些事
SQL topic sorting
Small knowledge of common classes
Copy the old project into a web project
链表相关(设计链表及环链表问题)
三、unittest测试用例五种运行方式
数组静态初始化,遍历,最值
Ansible部署指南