逆向分析这个文件并且写出能够得到flag的解密脚本,并且告诉我脚本中用到的数据在文件中的地址

تم الإنشاء في: ١٤ مارس ٢٠٢٦

تمت الإجابة باستخدام GPT-5.4 Thinking بواسطة Chat01

سؤال

zURen0EYVRRgSqWm.exe

逆向分析这个文件并且写出能够得到flag的解密脚本,并且告诉我脚本中用到的数据在文件中的地址

الفكرة

我先把这个可执行文件做静态分析,定位关键字符串、加密数据和解密流程,然后给你一份可直接跑出 flag 的脚本,并把脚本里用到的数据偏移地址一一标出来。

Thought for 16s

الفكرة

Providing the solution concisely

Okay, I need to provide a clear, concise answer while making sure I explain everything needed. No need for web references since I didn’t use it for this solution, but I can provide a file link to the script. I'll mention both RVA/VA and raw file offsets, then briefly list relevant addresses. I’ll include the verifier bug and flag details, keeping the bullet list minimal. I’m also adding the extra .mydata offset info and the success path bug to clarify everything clearly with minimal formatting.

Clarifying decryption process and flag details

The flag's full decrypted form is not accepted by the verifier because it only compares the first block. The 42-byte flag is hidden in .mydata’s extra ciphertext blocks, not directly verified. I’ll provide the relevant addresses for the first block, followed by the hidden ones. I’ll explain the functions like the RC4 decryption and AES routines that reveal the flag.

Thought for 14m 52s

الإجابة

分析完了。

flag 是:

dart{c3d4f5cc-8aab-46ce-a188-2fc453f3b288}

我把可直接跑的解密脚本放这里了: decrypt_flag.py

这个样本的关键流程是:

  1. .rdata 里的 32 字节 RC4 key 解密两个节:.hello.mydata
  2. .hello 解开后,主校验函数在 0x404ef0
  3. .mydata 解开后,里面藏了:
    • AES-256 key
    • IV
    • 3 个 16 字节的密文块
  4. .hello 里的 CBC 解密函数 0x404d80 把这 3 个块解出来,去掉 PKCS#7 padding,就得到 flag

你要的“脚本里用到的数据在文件中的地址”如下。

核心数据地址:

  • RC4 key

    • VA: 0x4070c0
    • Raw file offset: 0x3cc0
    • 长度: 0x20
  • 加密的 .hello

    • VA: 0x404000
    • Raw: 0x2800
    • Size: 0x1010
  • 加密的 .mydata

    • VA: 0x408000
    • Raw: 0x4400
    • Size: 0x80

.mydata 解密后的关键字段:

  • 标记字节

    • VA: 0x408000
    • Raw: 0x4400
  • AES-256 key

    • VA: 0x408001
    • Raw: 0x4401
    • 长度: 0x20
  • IV

    • VA: 0x408021
    • Raw: 0x4421
    • 长度: 0x10
  • 第 1 个密文块(程序实际拿来比对的块)

    • VA: 0x408031
    • Raw: 0x4431
    • 长度: 0x10
  • 后面 2 个隐藏密文块(程序没比,但解完整 flag 必须用)

    • VA: 0x408041
    • Raw: 0x4441
    • 长度: 0x20

相关函数地址:

  • RC4 节解密函数:0x4018b0
  • 查找并解密节的函数:0x4018f0
  • 触发解密 .mydata / .hello 的入口:0x401a10
  • 解密后 .hello 里的校验函数:0x404ef0
  • CBC 解密函数:0x404d80
  • CBC 加密函数:0x404cb0

还有一个挺有意思的点:程序真正校验时只比较了 0x408031 开始的前 16 字节密文块,但完整 flag 实际被分成了 3 个块藏在 .mydata 里,所以直接逆完整密文比跟着它的“输入校验逻辑”走更稳。

مشاركة هذا السؤال والجواب