BUUCTF:Mysterious

题目地址:https://buuoj.cn/challenges#Mysterious

在这里插入图片描述
题目附件是一个exe,运行起来让我们输入什么东西,尝试输入了一些字符没有反应

在这里插入图片描述
使用记事本打开,查看这个exe是64位的还是32位的

在这里插入图片描述
PE...L...是32位的exe文件特征,使用ida打开,Shift+F12查看字符

在这里插入图片描述
点击well done,找到了类似flag的字符串
在这里插入图片描述
Functions Window找到这个地址,点击,F5反汇编查看伪C代码

在这里插入图片描述

int __stdcall sub_401090(HWND hWnd, int a2, int a3, int a4)
{
  char v5; // [esp+50h] [ebp-310h]
  CHAR Text[4]; // [esp+154h] [ebp-20Ch]
  char v7; // [esp+159h] [ebp-207h]
  __int16 v8; // [esp+255h] [ebp-10Bh]
  char v9; // [esp+257h] [ebp-109h]
  int v10; // [esp+258h] [ebp-108h]
  CHAR String; // [esp+25Ch] [ebp-104h]
  char v12; // [esp+25Fh] [ebp-101h]
  char v13; // [esp+260h] [ebp-100h]
  char v14; // [esp+261h] [ebp-FFh]

  memset(&String, 0, 0x104u);
  v10 = 0;
  if ( a2 == 16 )
  {
    DestroyWindow(hWnd);
    PostQuitMessage(0);
  }
  else if ( a2 == 273 )
  {
    if ( a3 == 1000 )
    {
      GetDlgItemTextA(hWnd, 1002, &String, 260);
      strlen(&String);
      if ( strlen(&String) > 6 )
        ExitProcess(0);
      v10 = atoi(&String) + 1;
      if ( v10 == 123 && v12 == 120 && v14 == 122 && v13 == 121 )
      {
        strcpy(Text, "flag");
        memset(&v7, 0, 0xFCu);
        v8 = 0;
        v9 = 0;
        _itoa(v10, &v5, 10);
        strcat(Text, "{");
        strcat(Text, &v5);
        strcat(Text, "_");
        strcat(Text, "Buff3r_0v3rf|0w");
        strcat(Text, "}");
        MessageBoxA(0, Text, "well done", 0);
      }
      SetTimer(hWnd, 1u, 0x3E8u, TimerFunc);
    }
    if ( a3 == 1001 )
      KillTimer(hWnd, 1u);
  }
  return 0;
}

满足

if ( v10 == 123 && v12 == 120 && v14 == 122 && v13 == 121 )

输入的字符长度不能大于6,否则结束程序,v10atoi()函数转为数字整型并且+1,那么满足条件的v10应该为122v12v13v14对应的Ascii字符为xyz,所以输入

122xyz

即可得到flag

在这里插入图片描述
从伪C代码里面按照程序拼接也可以得到flag

flag{123_Buff3r_0v3rf|0w}
  • 8
    点赞
  • 5
    收藏
  • 打赏
    打赏
  • 7
    评论
Leon Starr and Andrew Mangogna, "Models to Code: With No Mysterious Gaps" English | ISBN: 1484222164 | 2017 | 305 pages | PDF | 18 MB Learn how to translate an executable model of your application into running code. This is not a book about theory, good intentions or possible future developments. You’ll benefit from translation technology and solid software engineering principles that are demonstrated with concrete examples using an open source tool chain. Models don’t deliver enough value if they are not on a direct path to code production. But to waste time building models that are merely pictures of your code doesn’t add much value either. In this book, you’ll translate detailed, yet platform-independent models that solve real application problems. Using a pragmatic approach, Models to Code quickly dives into two case studies of Executable UML models. The models and code are extensively annotated and illustrate key principles that are emphasized throughout the book. You’ll work with code production using "C" as the implementation language and targeting microcomputer class processors. This might not be your particular target language or platform, but you can use you can use what you learn here to engineer or re-evaluate your own code translation system to dramatically increase the value of both your modeling and code generation solution. Written by three leading experts, Models to Code is an exceptional resource for producing software by model translation― add it to your library today.

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

末初mochu7

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值