天天看点

攻防世界WP-reverse-re1-100

ELF文件。F5查看伪代码(感觉没有伪代码就不行

关键的地方贴出来。

if ( numRead )
      {
        if ( childCheckDebugResult() )
        {
          responseFalse();
        }
        else if ( bufParentRead[0] == 123 )
        {
          if ( strlen(bufParentRead) == 42 )
          {
            if ( !strncmp(&bufParentRead[1], "53fc275d81", 0xAuLL) )
            {
              if ( bufParentRead[strlen(bufParentRead) - 1] == 125 )
              {
                if ( !strncmp(&bufParentRead[31], "4938ae4efd", 0xAuLL) )
                {
                  if ( !confuseKey(bufParentRead, 42) )
                  {
                    responseFalse();
                  }
                  else if ( !strncmp(bufParentRead, "{daf29f59034938ae4efd53fc275d81053ed5be8c}", 0x2AuLL) )
                  {
                    responseTrue();
                  }
           

最开始试了一下

{daf29f59034938ae4efd53fc275d81053ed5be8c}

不对。但是可以确定

flag

的格式是

{53fc275d81x(20个)4938ae4efd}

。然后看到前面有一个

confuseKey

函数,进去看一看。

关键代码如下:

strncpy(szPart1, szKey + 1, 0xAuLL);
  strncpy(szPart2, szKey + 11, 0xAuLL);
  strncpy(szPart3, szKey + 21, 0xAuLL);
  strncpy(szPart4, szKey + 31, 0xAuLL);
  memset(szKey, 0, iKeyLength);
  *szKey = 123;
  strcat(szKey, szPart3);
  strcat(szKey, szPart4);
  strcat(szKey, szPart1);
  strcat(szKey, szPart2);
  szKey[41] = 125;
  return 1;
           

10位为一组,调换顺序。

flag为

53fc275d81053ed5be8cdaf29f59034938ae4efd

最坑的是提交的flag不带

{}