[网鼎杯 2020 青龙组]singal 1

前言

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

Angr


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一步步来,这样就可以得到所有的输入

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值