[网鼎杯 2020 青龙组]singal 1

前言

在主函数中找到了一个vm的译码器,译码器主要是解释传入的opcode,然后对我们输入的字符操作,这里我们发现他是单字节比较的,方法很多可以使用单字节映射,也可以是使用符号化执行,当然也可以硬着头皮去看

Angr

python 复制代码
import angr
import sys

def main(argv):
  path_to_binary = f'./signal.exe'
  project = angr.Project(path_to_binary)
  initial_state = project.factory.entry_state(
    add_options = { angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY,
                    angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS}
  )
  simulation = project.factory.simgr(initial_state)

  def is_successful(state):
    stdout_output = state.posix.dumps(sys.stdout.fileno())
    return b'good,The answer format is:flag {}' in stdout_output # :boolean

  def should_abort(state):
    stdout_output = state.posix.dumps(sys.stdout.fileno())
    return b'what a shame...' in stdout_output
  simulation.explore(find=is_successful, avoid=should_abort)

  if simulation.found:
    solution_state = simulation.found[0]
    print(solution_state.posix.dumps(sys.stdin.fileno()).decode())
  else:
    raise Exception('Could not find the solution')

if __name__ == '__main__':
  main(sys.argv)

找到程序通过输出的话,和不通过输出的话,然后我们通过符号化执行,判断出输入的值

Ponce

使用ponce的话就麻烦很多,首先启动调试

将输入设置为符号化

到达判断点

这样就分析出了第一位,我们可以修改EIP一步步来,这样就可以得到所有的输入

相关推荐
鳄鱼儿19 小时前
密码算法的OID查阅
算法
卡提西亚19 小时前
C++笔记-34-map/multimap容器
开发语言·c++·笔记
lxh011320 小时前
螺旋数组题解
前端·算法·js
2***B44920 小时前
C++在金融中的QuantLibXL
开发语言·c++·金融
E***U94520 小时前
前端安全编程实践
前端·安全
A***071720 小时前
C++在游戏中的阴影渲染
开发语言·c++·游戏
数据堂官方账号20 小时前
行业洞见 | AI鉴伪:数据驱动的数字安全变革
人工智能·安全
x***B41120 小时前
React安全编程实践
前端·安全·react.js
wanhengidc20 小时前
云手机中的数据通常存储在哪里?
运维·服务器·安全·web安全·智能手机
czlczl2002092520 小时前
算法:二叉树的公共祖先
算法