-
-
[原创]2021KCTF秋季赛 迷失丛林
-
发表于: 2021-11-30 14:04 14776
-
这里是验证第一段序列号的逻辑
可以发现其实前8个字节被放进了dword_404000里,而且还测试了这个其实是个s盒,没有重复的数字。
所以可以确定前个8个字节是什么,但是并不知道它们之间的顺序是什么。
0x1e,0x28,0x4b,0x6d,0x8c,0xa3,0xd2,0xfb
确定顺序之后其实就可以爆破了,大概10分钟可以爆出来。
B4D682C8BF2DE13A 前16个序列号
后8个字节序列号的逻辑代码
最后要等于“GoodJob~”
得到前8个序列号后我们就可以进入这里面了,然后可以dump出dword_40400的数据,这里是对后8个字节进行加密。
这里也是采用爆破,这里可以单字节爆破,我是一个个字节来爆破的。
得到序列号:B4D682C8BF2DE13AD9B6AEF24A80CB22
do
{
byte_404220[
0
]
=
*
((_BYTE
*
)&dword_404000
+
v2
-
1
);
/
/
取第一个
hex
byte_404221
=
v2;
v3
=
byte_404220;
v4
=
&dword_404100;
v5
=
&byte_404220[dword_404100];
do
{
v6
=
*
v4;
if
(
*
v4 >
0
)
{
do
{
v7
=
v5
+
1
;
*
(v7
-
1
)
=
*
((_BYTE
*
)&dword_404000
+
(unsigned __int8)
*
v3);
*
v7
=
*
v3
+
1
;
v5
=
v7
+
1
;
+
+
v3;
-
-
v6;
}
while
( v6 );
}
+
+
v4;
}
while
( (
int
)v4 < (
int
)&unk_40411C );
v8
=
256
;
do
{
+
+
v25[(unsigned __int8)
*
v3
+
+
];
-
-
v8;
}
while
( v8 );
+
+
v2;
v25
+
=
256
;
}
while
( v2
-
1
<
256
);
v9
=
&unk_404448;
v10
=
256
;
do
{
if
(
*
(v9
-
40
) )
+
+
v21;
if
(
*
(v9
-
26
) )
+
+
v22;
if
(
*
v9 )
+
+
v23;
if
( v9[
39
] )
+
+
v24;
v9
+
=
256
;
-
-
v10;
}
while
( v10 );
if
( v21
=
=
(char)
0xA9
&& v22
=
=
(char)
0xAC
&& v23
=
=
(char)
0xA7
&& v24 >
0xC8u
)
do
{
byte_404220[
0
]
=
*
((_BYTE
*
)&dword_404000
+
v2
-
1
);
/
/
取第一个
hex
byte_404221
=
v2;
v3
=
byte_404220;
v4
=
&dword_404100;
v5
=
&byte_404220[dword_404100];
do
{
v6
=
*
v4;
if
(
*
v4 >
0
)
{
do
{
v7
=
v5
+
1
;
*
(v7
-
1
)
=
*
((_BYTE
*
)&dword_404000
+
(unsigned __int8)
*
v3);
*
v7
=
*
v3
+
1
;
v5
=
v7
+
1
;
+
+
v3;
-
-
v6;
}
while
( v6 );
}
+
+
v4;
}
while
( (
int
)v4 < (
int
)&unk_40411C );
v8
=
256
;
do
{
+
+
v25[(unsigned __int8)
*
v3
+
+
];
-
-
v8;
}
while
( v8 );
+
+
v2;
v25
+
=
256
;
}
while
( v2
-
1
<
256
);
v9
=
&unk_404448;
v10
=
256
;
do
{
if
(
*
(v9
-
40
) )
+
+
v21;
if
(
*
(v9
-
26
) )
+
+
v22;
if
(
*
v9 )
+
+
v23;
if
( v9[
39
] )
+
+
v24;
v9
+
=
256
;
-
-
v10;
}
while
( v10 );
if
( v21
=
=
(char)
0xA9
&& v22
=
=
(char)
0xAC
&& v23
=
=
(char)
0xA7
&& v24 >
0xC8u
)
import
sys
a
=
[
0xA2
,
0x9B
,
0xF4
,
0xDF
,
0xAC
,
0x7C
,
0xA1
,
0xC6
,
0x16
,
0xD0
,
0x0F
,
0xDD
,
0xDC
,
0x73
,
0xC5
,
0x6B
,
0xD1
,
0x96
,
0x47
,
0xC2
,
0x26
,
0x67
,
0x4E
,
0x41
,
0x82
,
0x20
,
0x56
,
0x9A
,
0x6E
,
0x33
,
0x92
,
0x88
,
0x29
,
0xB5
,
0xB4
,
0x71
,
0xA9
,
0xCE
,
0xC3
,
0x34
,
0x50
,
0x59
,
0xBF
,
0x2D
,
0x57
,
0x22
,
0xA6
,
0x30
,
0x04
,
0xB2
,
0xCD
,
0x36
,
0xD5
,
0x68
,
0x4D
,
0x5B
,
0x45
,
0x9E
,
0x85
,
0xCF
,
0x9D
,
0x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0x84
,
0xE9
,
0x55
,
0xBB
,
0xC7
,
0x0A
,
0xE0
,
0x66
,
0xF2
,
0xD8
,
0xCB
,
0x00
,
0x12
,
0xB8
,
0x17
,
0x94
,
0x6A
,
0x4A
,
0x01
,
0x24
,
0x14
,
0x51
,
0x07
,
0x65
,
0x21
,
0xC8
,
0x38
,
0xFD
,
0x8F
,
0xC4
,
0xF5
,
0xFC
]
def
check(d):
for
i
in
d:
if
d.count(i)>
1
:
return
1
return
0
burst_num
=
[
0x1e
,
0x28
,
0x4b
,
0x6d
,
0x8c
,
0xa3
,
0xd2
,
0xfb
]
def
enc_fun(d):
# print(hex(d[0]),hex(d[1]))
e
=
[
0
for
i
in
range
(
256
*
256
)]
f
=
[
0
for
i
in
range
(
512
)]
v2
=
1
m
=
0
for
i
in
range
(
256
):
f[
0
]
=
d[v2
-
1
]
f[
1
]
=
v2&
0xff
l
=
0
for
k
in
range
(
254
):
f[
2
+
k
*
2
]
=
d[f[l]]
f[
2
+
k
*
2
+
1
]
=
(f[l]
+
1
)&
0xff
l
+
=
1
for
j
in
range
(
256
):
e[m
+
f[l]]
+
=
1
l
+
=
1
v2
+
=
1
m
+
=
256
# print(e)
n
=
0
v21
=
0
v22
=
0
v23
=
0
v24
=
0
for
i
in
range
(
256
):
if
e[n]:
v21
+
=
1
if
e[n
+
14
]:
v22
+
=
1
if
e[n
+
40
]:
v23
+
=
1
if
e[n
+
79
]:
v24
+
=
1
n
+
=
256
if
v24>
0xc8
:
print
(
hex
(v21),
hex
(v22),
hex
(v23),
hex
(v24))
if
v21
=
=
0xA9
and
v22
=
=
0xAC
and
v23
=
=
0xA7
and
v24 >
0xc8
:
return
1
return
0
def
brust():
flag
=
0
for
i1
in
burst_num:
for
i2
in
burst_num:
for
i3
in
burst_num:
for
i4
in
burst_num:
for
i5
in
burst_num:
for
i6
in
burst_num:
for
i7
in
burst_num:
for
i8
in
burst_num:
d
=
[i1,i2,i3,i4,i5,i6,i7,i8]
if
check(d):
continue
d
+
=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x53
,
0xAA
,
0xFF
,
0x6F
,
0x8E
,
0x91
,
0xF1
,
0xF0
,
0xA4
,
0x46
,
0x3A
,
0x7D
,
0x54
,
0xEB
,
0x2F
,
0xC1
,
0xC0
,
0x0E
,
0xBD
,
0xE1
,
0x6C
,
0x64
,
0xBE
,
0xE4
,
0x02
,
0x3C
,
0x5A
,
0xA8
,
0x9F
,
0x37
,
0xAF
,
0xA0
,
0x13
,
0xED
,
0x1B
,
0xEC
,
0x8B
,
0x3E
,
0x7E
,
0x27
,
0x99
,
0x75
,
0xAB
,
0xFE
,
0xD9
,
0x3F
,
0xF3
,
0xEA
,
0x70
,
0xF7
,
0x95
,
0xBA
,
0x1D
,
0x40
,
0xB0
,
0xF9
,
0xE5
,
0xF8
,
0x06
,
0xBC
,
0xB6
,
0x03
,
0xC9
,
0x10
,
0x9C
,
0x2E
,
0x89
,
0x5C
,
0x7F
,
0xB1
,
0x1A
,
0xD6
,
0x90
,
0xAE
,
0xDA
,
0xE6
,
0x5E
,
0xB9
,
0x84
,
0xE9
,
0x55
,
0xBB
,
0xC7
,
0x0A
,
0xE0
,
0x66
,
0xF2
,
0xD8
,
0xCB
,
0x00
,
0x12
,
0xB8
,
0x17
,
0x94
,
0x6A
,
0x4A
,
0x01
,
0x24
,
0x14
,
0x51
,
0x07
,
0x65
,
0x21
,
0xC8
,
0x38
,
0xFD
,
0x8F
,
0xC4
,
0xF5
,
0xFC
]
def
check(d):
for
i
in
d:
if
d.count(i)>
1
:
return
1
return
0
burst_num
=
[
0x1e
,
0x28
,
0x4b
,
0x6d
,
0x8c
,
0xa3
,
0xd2
,
0xfb
]
def
enc_fun(d):
# print(hex(d[0]),hex(d[1]))
e
=
[
0
for
i
in
range
(
256
*
256
)]
f
=
[
0
for
i
in
range
(
512
)]
v2
=
1
m
=
0
for
i
in
range
(
256
):
f[
0
]
=
d[v2
-
1
]
f[
1
]
=
v2&
0xff
l
=
0
for
k
in
range
(
254
):
f[
2
+
k
*
2
]
=
d[f[l]]
f[
2
+
k
*
2
+
1
]
=
(f[l]
+
1
)&
0xff
l
+
=
1
for
j
in
range
(
256
):
e[m
+
f[l]]
+
=
1
l
+
=
1
v2
+
=
1
m
+
=
256
# print(e)
n
=
0
v21
=
0
v22
=
0
v23
=
0
v24
=
0
for
i
in
range
(
256
):
if
e[n]:
v21
+
=
1
if
e[n
+
14
]:
v22
+
=
1
if
e[n
+
40
]:
v23
+
=
1
if
e[n
+
79
]:
v24
+
=
1
n
+
=
256
if
v24>
0xc8
:
print
(
hex
(v21),
hex
(v22),
hex
(v23),
hex
(v24))
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
最后于 2021-11-30 16:47
被n3ko编辑
,原因:
赞赏
他的文章
- [原创]KCTF2021秋季赛 声名远扬 14715
- [原创]KCTF2021秋季赛 窥伺者谁 14362
- [原创]2021KCTF秋季赛 迷失丛林 14777
看原图
赞赏
雪币:
留言: