首页 > 其他分享 >攻防世界-难度1- happyctf

攻防世界-难度1- happyctf

时间:2024-04-29 23:22:05浏览次数:26  
标签:std 攻防 string v14 str happyctf operator v9 难度

参考
https://www.52pojie.cn/thread-1792441-1-1.html

查壳

IDA静态分析

反编译main函数

int __cdecl main(int argc, const char **argv, const char **envp)
{

  v3 = std::operator<<<std::char_traits<char>>(&std::cout, "please input flag");
  std::ostream::operator<<(v3, std::endl<char,std::char_traits<char>>);
  std::operator>><char>(&std::cin, &str);
  if ( std::string::length(&str) == 24 )
  {
    p_str = &str;
    v14 = std::string::_Unchecked_begin(&str);
    v13 = std::string::_Unchecked_end(&str);
    while ( v14 != v13 )
    {
      item = *v14;
      lambda_1b3a4e77a09e1a7ed440bad3aa4c443b_::operator()(&add, item);
      ++v14;
    }
    qmemcpy(key, "rxusoCqxw{yqK`{KZqag{r`i", sizeof(key));
    lambda_7686c8adb828765130ce2b0d457195d9_::_lambda_7686c8adb828765130ce2b0d457195d9_(
      &cmp,
      (unsigned __int8 (*)[24])key);
    v9 = std::vector<unsigned char>::_Unchecked_begin(&v);
    v8 = std::vector<unsigned char>::_Unchecked_end(&v);
    while ( v9 != v8 )
    {
      if ( !lambda_7686c8adb828765130ce2b0d457195d9_::operator()(&cmp, *v9) )
      {
        v6 = std::operator<<<std::char_traits<char>>(&std::cout, "error");
        std::ostream::operator<<(v6, std::endl<char,std::char_traits<char>>);
        LOBYTE(v19) = 0;
        std::vector<unsigned char>::~vector<unsigned char>(&v);
        v19 = -1;
        std::string::~string(&str);
        return 0;
      }
      ++v9;
    }
    v7 = std::operator<<<std::char_traits<char>>(&std::cout, "good job");

关键步骤

  1. 对输入的24个字符进行异或
while ( v14 != v13 )
{
  item = *v14;
  lambda_1b3a4e77a09e1a7ed440bad3aa4c443b_::operator()(&add, item);
  ++v14;
}
  1. 逐位比较
while ( v9 != v8 )
{
  if ( !lambda_7686c8adb828765130ce2b0d457195d9_::operator()(&cmp, *v9) )
  {
    v6 = std::operator<<<std::char_traits<char>>(&std::cout, "error");
    std::ostream::operator<<(v6, std::endl<char,std::char_traits<char>>);
    LOBYTE(v19) = 0;
    std::vector<unsigned char>::~vector<unsigned char>(&v);
    v19 = -1;
    std::string::~string(&str);
    return 0;
  }
  ++v9;
}

题解

s = 'rxusoCqxw{yqK`{KZqag{r`i'
for i in range(len(s)):
    print(chr(ord(s[i]) ^ 0x14), end='')

标签:std,攻防,string,v14,str,happyctf,operator,v9,难度
From: https://www.cnblogs.com/Rainy-Day/p/18166824

相关文章

  • 攻防世界-难度1- xxxorrr
    攻防世界-逆向-难度1根据提示应该是异或加密,找到密文和密钥,再异或回去就得到原文。参考https://blog.csdn.net/qq_63699339/article/details/130657034官方wp逆向解法梳理一下程序执行逻辑1.在main函数之前的init-array段首先执行了sub84A在ELF(ExecutableandLinkabl......
  • 攻防世界-难度1- bad_python
    the.pycisbroken,canyouhelpmerecover?攻防世界难度1-bad_pythonpython头部观察文件名pyre.cpython-36.pyc,说明是在python3.6环境下编译的,那么需要恢复正常pyc3.6对应的首部16字节。uncompyle6pip3installuncompyle6uncompyle6--versionuncompyle6pyre.cpython......
  • 攻防世界---unseping
    一.题干二.pop链的构造反序列化执行__wakeup魔术方法->waf函数对传入的参数进行过滤->执行__destruct魔术方法->利用call_user_func_array执行回调函数ping三.绕过过滤1.首先,waf函数过滤了ls命令,可以使用空变量${Z}或者''或者""绕过:<?phphighlight_file(__FILE__);class......
  • 攻防世界-难度1- easyEZbaby_app
    攻防世界-难度1-easyEZbaby_app文件格式文件格式(APK,JAR,WAR,RAR)在不同的技术领域和应用场景中有着各自的作用和特点:APK全称:AndroidPackage用途:APK文件是Android平台上的应用程序包格式。它是一种压缩格式,包含了Android应用运行所需的所有文件,包括代码、资源、资产、证......
  • 攻防世界-难度1- toddler_regs
    攻防世界-难度1toddler_regs.zip运行ida静态分析shift+f12搜索字符串点过去F5先搞定g_team_idx,一路跟过去F5g_team_idx=23;还需要两个数组内容:team[]和teamjnu[],点过去就行了。只需要提取其中的内容就行了。注意字符串末尾是'\0',编写脚本时要注意这点team=......
  • 攻防世界-难度1- toddler_regs
    攻防世界-难度1toddler_regs.zip运行idashift+f12搜索字符串点过去F5先搞定g_team_idx,一路跟过去F5g_team_idx=23;还需要两个数组内容:team[]和teamjnu[],点过去就行了。只需要提取其中的内容就行了。注意字符串末尾是'\0',编写脚本时要注意这点team="""......
  • 攻防世界逆向-难度1- easyre-xctf
    攻防世界-难度1easyre-xctf.zipUpx壳这里先直接用工具脱壳,后面学会手动脱壳再回来补充。工具下载地址:https://down.52pojie.cn/?query=upxupx.exe-deasyre.exe再查一次,避免多重壳。逆向分析ida搜索字符串,shift+F12是flag的第2部分,现在查找第一部分。打开反汇编子......
  • 攻防世界逆向-难度1- CatFly
    难度1题目CatFlyLinux下的elf二进制文件,strings一下没发现什么信息。参考:https://xia0ji233.pro/2023/01/01/Nepnep-CatCTF2022/index.htmlhttps://blog.csdn.net/Lynnette177/article/details/132616817解题思路:遍历正确密钥,解密dword_E120(flag密文),注意sub_62B5()获取的......
  • 攻防世界 Windows_Reverse1
    第一次遇见地址偏移间接操作,记录一下wp的思路方法不是我的,我只是做记录理思路题目分析过程PE查壳,有一个UPX壳 用工具脱壳 IDA看看main函数两个关键参数:input(v6改名)和flag(v4改名)光看反汇编函数,这两个参数怎么都联系不起来想着地址说不定连在一起呢?-00000404......
  • 【攻防实操系列+内网渗透篇】--第2章:内网渗透攻击基础①
    以域控为基础架构,通过域控实现对用户和计算机资源的统一管理,带来便利的同时也成为了最受攻击者重点攻击的集权系统。针对域控的攻击技术,在Windows通用攻击技术的基础上自成一套技术体系,将AD域攻防分为信息收集、权限提升、凭证窃取、横向移动、权限维持等攻击阶段,把域环境下众多......