REVERSE-拆弹专家
ISCC2026 WriteUp 提交模板
REVERSE-拆弹专家
解题思路
1.经分析,程序依次调用了:
sg6j(password1);
d5n7(password2);
s6m8(password3);
h5b5(password1, password2, password3);
2.先看sg6j:

函数 sg6j 要求输入长度为 8,并且字符必须是可打印字符。输入会先经过一套 2x2x2 魔方加密逻辑,key 为:R U F R' D2,加密结果再做 Base64,然后计算 FNV1a32,最后判断:(hash ^ 0xA5A5A5A5) == 0xB7520468所以目标 hash 为:0x12f7a1cd

源码注释中泄露了第一关明文,验证其加密 hash 后可确认第一关密码为:PJPIOGOX。
2.d4n7
第一关通过后,程序调用:d4n7(g_stage1_hash);


用第一关 hash 派生第二关参数。代入 0x12f7a1cd 后得到系数:g_a = [3, 6, 6, 6, 8]。程序内部生成的五个数为:[6, 15, 60, 93, 94]第二关输入格式是:x1 + x2两位 + x3两位 + x4两位 + x5两位所以第二关密码为:615609394
3.迷宫路径
然后程序用第二关输入和第一关 hash 生成迷宫 seed:
seed = atoi(password2);
seed ^= g_stage1_hash * 0x9E3779B1;
生成的 4x4 迷宫为:
##..
.##.
..##
...#
其中 # 表示可走。从左上角走到右下角,路径为:RDRDRD
好了可以写脚本了,放到下面了
Flag: ISCC{PJPIOGOX615609394RDRDRD}
Exp
h = 0x12f7a1cd
pw1 = "PJPIOGOX"
base_a = [2, 3, 4, 5, 6]
g_a = [base_a[i] + ((h >> (i * 6)) & 3) for i in range(5)]
state = h ^ 0x12345678
x = []
for i in range(5):
state = (state * 1664525 + 1013904223) & 0xffffffff
x.append(state % 10 if i == 0 else 10 + state % 90)
pw2 = "".join(map(str, x))
seed = (int(pw2) ^ ((h * 0x9E3779B1) & 0xffffffff)) & 0xffffffff
st = seed ^ 0x9E3779B9
mx = [[0] * 4 for _ in range(4)]
cx = cy = 0
mx[cy][cx] = 1
path = []
while (cx, cy) != (3, 3):
st = (st * 1664525 + 1013904223) & 0xffffffff
if cx < 3 and cy < 3:
move = "R" if (st & 1) else "D"
elif cx < 3:
move = "R"
else:
move = "D"
if move == "R":
cx += 1
else:
cy += 1
path.append(move)
mx[cy][cx] = 1
pw3 = "".join(path)
print(f"Flag: ISCC{{{pw1}{pw2}{pw3}}}")

浙公网安备 33010602011771号