当前位置:网站首页>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
![]()
边栏推荐
猜你喜欢
随机推荐
Angr(七)——angr_ctf
Erlang(离线部署)
Detailed explanation of MySQL database
Pytorch 张量列表转换为张量 List of Tensor to Tensor 使用 torch.stack()
切换 shell 命令行终端(bash/zsh)后,conda 无法使用: command not found
字典树的使用
Set creation and common methods
Detailed explanation of JDBC operation database
Selenium 等待元素出现与等待操作可以执行的条件
UE4源码的获取和编译
Bug分类和定级
Redis使用场景
数论--负进制转换
用户喜好
Exception handling exception
UE4 LoadingScreen动态加载启动动画
PyTorch 代码模板 (CNN)
conda 配置深度学习环境 pytorch transformers
常用类的小知识
一文学会,三款黑客必备的抓包工具教学









