buu CrackRTF

32位程序IDA反编译如下

int __cdecl main_0(int argc, const char **argv, const char **envp)
{
  DWORD v3; // eax
  DWORD v4; // eax
  char Str[260]; // [esp+4Ch] [ebp-310h] BYREF
  int v7; // [esp+150h] [ebp-20Ch]
  char String1[260]; // [esp+154h] [ebp-208h] BYREF
  char Destination[260]; // [esp+258h] [ebp-104h] BYREF

  memset(Destination, 0, sizeof(Destination));
  memset(String1, 0, sizeof(String1));
  v7 = 0;
  printf("pls input the first passwd(1): ");
  scanf("%s", Destination);
  if ( strlen(Destination) != 6 )
  {
    printf("Must be 6 characters!\n");
    ExitProcess(0);
  }
  v7 = atoi(Destination);
  if ( v7 < 100000 )
    ExitProcess(0);
  strcat(Destination, "@DBApp");
  v3 = strlen(Destination);
  sub_40100A(Destination, v3, String1);
  if ( !_strcmpi(String1, "6E32D0943418C2C33385BC35A1470250DD8923A9") )
  {
    printf("continue...\n\n");
    printf("pls input the first passwd(2): ");
    memset(Str, 0, sizeof(Str));
    scanf("%s", Str);
    if ( strlen(Str) != 6 )
    {
      printf("Must be 6 characters!\n");
      ExitProcess(0);
    }
    strcat(Str, Destination);
    memset(String1, 0, sizeof(String1));
    v4 = strlen(Str);
    sub_401019(Str, v4, String1);
    if ( !_strcmpi("27019e688a4e62a649fd99cadaafdb4e", String1) )
    {
      if ( !sub_40100F(Str) )
      {
        printf("Error!!\n");
        ExitProcess(0);
      }
      printf("bye ~~\n");
    }
  }
  return 0;
}

知道了第一次输入在10000~999999之间,与@DBApp拼接之后用sub40100A函数加密与一串值比较
在这里插入图片描述
进入这个加密函数查看发现是做哈希运算,想到一些常见的散列算法得到的散列值位数

  • sha-1:160bit
  • md5:128bit
  • sha-256:256bit
    在这里插入图片描述
    然后计算一下那个明文的长度发现是160bit,推测是sha-1
    在这里插入图片描述
    为进一步确认,搜索CryptCreateHash函数的官方文档,发现第二个参数(即 0x8004)指明了算法的类型
    在这里插入图片描述
    这里把全部ALG_ID的参考值扒下来
IdentifierValueDescription
CALG_3DES0x00006603Triple DES encryption algorithm.
CALG_3DES_1120x00006609Two-key triple DES encryption with effective key length equal to 112 bits.
CALG_AES0x00006611Advanced Encryption Standard (AES). This algorithm is supported by the Microsoft AES Cryptographic Provider.
CALG_AES_1280x0000660e128 bit AES. This algorithm is supported by the Microsoft AES Cryptographic Provider.
CALG_AES_1920x0000660f192 bit AES. This algorithm is supported by the Microsoft AES Cryptographic Provider.
CALG_AES_2560x00006610256 bit AES. This algorithm is supported by the Microsoft AES Cryptographic Provider.
CALG_AGREEDKEY_ANY0x0000aa03Temporary algorithm identifier for handles of Diffie-Hellman–agreed keys.
CALG_CYLINK_MEK0x0000660cAn algorithm to create a 40-bit DES key that has parity bits and zeroed key bits to make its key length 64 bits. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_DES0x00006601DES encryption algorithm.
CALG_DESX0x00006604DESX encryption algorithm.
CALG_DH_EPHEM0x0000aa02Diffie-Hellman ephemeral key exchange algorithm.
CALG_DH_SF0x0000aa01Diffie-Hellman store and forward key exchange algorithm.
CALG_DSS_SIGN0x00002200DSA public key signature algorithm.
CALG_ECDH0x0000aa05Elliptic curve Diffie-Hellman key exchange algorithm.[!Note] This algorithm is supported only through Cryptography API: Next Generation. Windows Server 2003 and Windows XP: This algorithm is not supported.
CALG_ECDH_EPHEM0x0000ae06Ephemeral elliptic curve Diffie-Hellman key exchange algorithm.[!Note] This algorithm is supported only through Cryptography API: Next Generation. Windows Server 2003 and Windows XP: This algorithm is not supported.
CALG_ECDSA0x00002203Elliptic curve digital signature algorithm.[!Note] This algorithm is supported only through Cryptography API: Next Generation. Windows Server 2003 and Windows XP: This algorithm is not supported.
CALG_ECMQV0x0000a001Elliptic curve Menezes, Qu, and Vanstone (MQV) key exchange algorithm. This algorithm is not supported.
CALG_HASH_REPLACE_OWF0x0000800bOne way function hashing algorithm.
CALG_HUGHES_MD50x0000a003Hughes MD5 hashing algorithm.
CALG_HMAC0x00008009HMAC keyed hash algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_KEA_KEYX0x0000aa04KEA key exchange algorithm (FORTEZZA). This algorithm is not supported.
CALG_MAC0x00008005MAC keyed hash algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_MD20x00008001MD2 hashing algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_MD40x00008002MD4 hashing algorithm.
CALG_MD50x00008003MD5 hashing algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_NO_SIGN0x00002000No signature algorithm.
CALG_OID_INFO_CNG_ONLY0xffffffffThe algorithm is only implemented in CNG. The macro, IS_SPECIAL_OID_INFO_ALGID, can be used to determine whether a cryptography algorithm is only supported by using the CNG functions.
CALG_OID_INFO_PARAMETERS0xfffffffeThe algorithm is defined in the encoded parameters. The algorithm is only supported by using CNG. The macro, IS_SPECIAL_OID_INFO_ALGID, can be used to determine whether a cryptography algorithm is only supported by using the CNG functions.
CALG_PCT1_MASTER0x00004c04Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_RC20x00006602RC2 block encryption algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_RC40x00006801RC4 stream encryption algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_RC50x0000660dRC5 block encryption algorithm.
CALG_RSA_KEYX0x0000a400RSA public key exchange algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_RSA_SIGN0x00002400RSA public key signature algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_SCHANNEL_ENC_KEY0x00004c07Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_SCHANNEL_MAC_KEY0x00004c03Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_SCHANNEL_MASTER_HASH0x00004c02Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_SEAL0x00006802SEAL encryption algorithm. This algorithm is not supported.
CALG_SHA0x00008004SHA hashing algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_SHA10x00008004Same as CALG_SHA. This algorithm is supported by the Microsoft Base Cryptographic Provider.
CALG_SHA_2560x0000800c256 bit SHA hashing algorithm. This algorithm is supported by Microsoft Enhanced RSA and AES Cryptographic Provider…Windows XP with SP3: This algorithm is supported by the Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype). Windows XP with SP2, Windows XP with SP1 and Windows XP: This algorithm is not supported.
CALG_SHA_3840x0000800d384 bit SHA hashing algorithm. This algorithm is supported by Microsoft Enhanced RSA and AES Cryptographic Provider.Windows XP with SP3: This algorithm is supported by the Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype). Windows XP with SP2, Windows XP with SP1 and Windows XP: This algorithm is not supported.
CALG_SHA_5120x0000800e512 bit SHA hashing algorithm. This algorithm is supported by Microsoft Enhanced RSA and AES Cryptographic Provider.Windows XP with SP3: This algorithm is supported by the Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype). Windows XP with SP2, Windows XP with SP1 and Windows XP: This algorithm is not supported.
CALG_SKIPJACK0x0000660aSkipjack block encryption algorithm (FORTEZZA). This algorithm is not supported.
CALG_SSL2_MASTER0x00004c05Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_SSL3_MASTER0x00004c01Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_SSL3_SHAMD50x00008008Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_TEK0x0000660bTEK (FORTEZZA). This algorithm is not supported.
CALG_TLS1_MASTER0x00004c06Used by the Schannel.dll operations system. This ALG_ID should not be used by applications.
CALG_TLS1PRF0x0000800aUsed by the Schannel.dll operations system. This ALG_ID should not be used by applications.

确认了是SHA-1算法没错了,这里尝试用python的hashlib模块爆破一下得到第一个密码123321

import hashlib
for i in range(100000,999999):
    h = hashlib.sha1((str(i)+"@DBApp").encode('utf8'))
    if h.hexdigest()=="6e32d0943418c2c33385bc35a1470250dd8923a9":
        print((str(i)+"@DBApp").encode('utf-8'))
        break

再往下看这次的同样是做哈希,只不过不是sha-1,查表发现是md5,这次没有限定小范围,只告诉我们是6位数,爆破也很难爆破
在这里插入图片描述
在这里插入图片描述

先看看第三重关键函数sub_40100F(一些不知道功能的函数直接查文档就好)
读取这个exe文件集成的AAA资源文件,
在这里插入图片描述
打开ResourceHack查找一下这个AAA文件
在这里插入图片描述
进入sub_401005函数,这个函数就是把输入的密码组合起来然后跟上面AAA文件里的每一个字节循环异或,得到新的值再写入rtf文件
在这里插入图片描述
我们只要输入的password都是正确的,那么最终会生成一个rtf文件,里面应该有我们要的flag,第二次密码输入既然无法爆破,那就从rtf文件头入手,网上查了一下rtf文件头部为7B5C72746631,跟AAA文件的前6个数据异或一下就得到了密码

~!3a@0

两次输入密码之后,打开生成的rtf文件看到flag
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Em0s_Er1t

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

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

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

打赏作者

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

抵扣说明:

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

余额充值