Insomni'hack teaser 2019

参考链接

https://ctftime.org/task/7455

题目描述

A babyrust to become a hardcore reverser

点我下载

解题过程

一道用rust写的逆向题,先拖到IDA PRO里,期间会报错,不用理会即可,可以看到里面有两个main函数,选比较长的那个main函数_ZN15beginer_reverse4main17h80fa15281f646bc1E,这个main函数看起来逻辑很复杂,但真正有用的部分只有这里

do
{
  if ( v15 == v22 )
    break;
  v25 = ((*((_DWORD *)v30 + v23) >> 2) ^ 0xA) == *(_DWORD *)&v15[4 * v23];
  // if we set a breakpoint here, v15 is the input but is unsigned extended to DWORD array
  ++v23;
  v24 += v25;
  v22 -= 4;
}

这段被加密过的字符串解密方式为(data[i] >> 2) ^ 0xA,datauint32_t类型的数组,解密之后的字符串即为flag,然后会拿来和自己输入的字符串作比较。

Python>flag = ""
Python>for p in range(0x51000, 0x51080, 4) + range(0x6722, 0x672a, 4):
Python>  flag += chr((Dword(p) >> 2) ^0xA)
Python>
Python>flag
INS{y0ur_a_r3a1_h4rdc0r3_r3v3rs3r}
原文地址:https://www.cnblogs.com/Antiver/p/10298652.html