-
-
[原创] 第五题:申时·忆海倒带 wp
-
发表于: 2026-8-17 16:36 93
-
附件 cm.rar 包含 cm.exe 与规则说明。规则要求输入序列号并看到verify success.。原文件 SHA-1 为d1c8124c5964af1531c6e311328854a05ca40bca,与题面一致。
cm.exe 是未签名的 32 位 PE。真实输入路径从 0x403F60 开始:只接受0-9、A-Z,并严格要求 88 个字符。输入首先被按十六进制大整数解析;因此
实际可用字符集是十六进制的 0-9A-F。
该路径随后把大整数按大端字节展开,检查:
字符串中的 admin123、异常处理器和 int3 注释只在前导诱饵代码中出现,未进入
最终成功比较,不能作为密码使用。
最终映射对象由 0x4033d0 建立。0x404870 对输入字节 b 的实际查找为:
对目标欢迎语逐字节反查 b in [1, 127],每个字符都有唯一原像。前 28 个原像直接
构成序列号对应大整数的前缀;后 16 个原像是 RSA 变换后的结果。
函数 0x403500 取原始大整数的后 16 字节,进行 pow(x, e, n),再把结果覆盖到
最终查表前的后 16 字节。程序的“大整数数组”不是普通连续数组:访问器0x402a70 通过对象 +0x0c 的置换索引定位 +0x04 的基数组。按该布局还原得到:
对所需的最后 16 个映射前字节作私钥逆运算,即可恢复原始尾块。
实际求解器:solve.py。完整内容如下:
solve.py output:
index = b - 1
offset = u32[0x4163b0 + 4 * index]
output = byte[0x4263b0 + offset]
n = 0x8c91cb79ec693f3ed6519c945dd67371
e = 65537
n = 13702465297157554691 * 13636154180376482939
"""Construct the verified key for KCTF 2026 Reverse #5 from static evidence."""
from functools import reduce
TARGET_AFTER_RSA = bytes.fromhex(
"323C47184B0D3C44254B445842552F365C362C1144424B0D"
"3C4416430F4439374E3C44372544164425151D1B"
)
P = 13702465297157554691
Q = 13636154180376482939
E = 65537
def rolling_check(data: bytes) -> int:
total = 0
for byte in data:
total = (total + ((total & 0x7F) + 1) * byte) & 0xFFFFFFFF
return total & 0xFFFF
def main() -> None:
n = P * Q
phi = (P - 1) * (Q - 1)
d = pow(E, -1, phi)
encrypted_tail = int.from_bytes(TARGET_AFTER_RSA[-16:], "big")
original_tail = pow(encrypted_tail, d, n).to_bytes(16, "big")
key_bytes = TARGET_AFTER_RSA[:-16] + original_tail
assert len(key_bytes) == 44
assert pow(int.from_bytes(original_tail, "big"), E, n) == encrypted_tail
assert reduce(lambda left, right: left ^ right, key_bytes, 0) == 0x8F
assert rolling_check(key_bytes) == 0xBEFF
key = key_bytes.hex().upper()
assert len(key) == 88 and all(char in "0123456789ABCDEF" for char in key)
print(key)
if __name__ == "__main__":
main()
赞赏记录
参与人
雪币
留言
时间
嫉妒的死远点
感谢你的贡献,论坛因你而更加精彩!
2026-10-20 12:04
一路南寻
感谢你的贡献,论坛因你而更加精彩!
2026-10-20 06:36
PLEBFE
为你点赞!
2026-10-19 19:21
心游尘世外
为你点赞!
2026-10-19 17:26
東陽不列山
为你点赞!
2026-10-19 15:42
飘零丶
为你点赞!
2026-10-19 06:33
赞赏
赞赏
雪币:
留言: