-
-
[原创]]2022KCTF秋季赛 第十题 两袖清风
-
发表于: 2022-12-10 23:38 13386
-
cipher 0xB20446102D1C343D0575674CA28EBC0419BCFE4D75682C2AC81C9502454650BDDAEF6968AF269B54C182
N = 0x4F62187B5F6590C6CFF0FBDBBEBDAF60AA861BD2F66F8F7FFD57A66AE50DB7D2FFFFFFFFFFFFFFFFFFFFF
E = 0x11
N可直接分解
计算出 D 243855937587318030864454877487317725150433472540948954237790304930432311137671434982797927461139896305
转为hex 1BDF5752B86533B0EF0C488375EBFE389163712709D3FEE35C7679A1AB7A8E697366227CAF168C99DD7F1
key为 4位数字 + rsa解密内容("AllIsNothing") + "00 CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD"
4位数字要求两两相同
爆破脚本
观察到 1010 像是解密正确的结果
EnumWindows 里会检查窗口是不是有 ida x64dbg,但是转换了大写,这就检测不到了
GetTickCount64时间检测,ResumeThread执行解密代码,随后对一处反调试代码校验
UuidFromStringA获取第2段代码,通过EnumSystemLocalesA回调执行代码
两个bin都有简单的自解密,处理后dump分析
输入第一个字节是长度,随后是半个字节的范围在0-9
bin1检查输入合法,第一步YX要求X=0,每一步要求与上一步在相邻行或者列(这里写错了,导致可以跨行跨列瞬移),最后一步要求在边界,生成正确的迷宫
bin2校验输入,同bin1检查输入,同时检查输入长度,以及每一步都是00
可能的解
17 3031323343515253545556617166727374847677788694
17 3031324351525354555661717273746676777884948694
0F 303132334353525161717273748494(有争议,部分机器可行)
实际提交解 1BDF5752B86533B0EF0C488375EBFE389163712709D3FEE35C7679A1AB7A8E697366227CAF168C99DD7F11010173031324351525354555661717273746676777884948694
import
base64
from
Crypto.Cipher
import
AES
from
Crypto.Util.Padding
import
pad, unpad
def
AES_Decrypt(key, data):
iv
=
bytearray.fromhex(
"41 42 43 44 45 46 30 31 32 33 34 35 36 37 38 39"
)
cipher
=
AES.new(key, AES.MODE_CBC, iv)
text_decrypted
=
cipher.decrypt(data)
# try:
# text_decrypted = unpad(text_decrypted, AES.block_size, "pkcs7")
# except:
# return None
if
(text_decrypted[
-
1
] !
=
0x00
):
return
None
# 去补位
return
text_decrypted
data
=
bytearray.fromhex(
"94 C7 A9 05 C7 DC ... 22 6A"
)
#密文
for
i
in
range
(
10000
):
key
=
b""
t
=
[]
n
=
i
for
l
in
range
(
4
):
t.append((n
%
10
)
+
48
)
n
/
/
=
10
key
=
bytearray(t)
key
+
=
bytearray.fromhex(
"41 6C 6C 49 73 4E 6F 74 68 69 6E 67 00 CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD"
)
result
=
AES_Decrypt(key,data)
if
(result !
=
None
):
print
(key[
0
:
4
],(result[
0
:
0x10
]).
hex
())
import
base64
from
Crypto.Cipher
import
AES
from
Crypto.Util.Padding
import
pad, unpad
def
AES_Decrypt(key, data):
iv
=
bytearray.fromhex(
"41 42 43 44 45 46 30 31 32 33 34 35 36 37 38 39"
)
cipher
=
AES.new(key, AES.MODE_CBC, iv)
text_decrypted
=
cipher.decrypt(data)
# try:
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课