初始谜题
解题思路
用t1异或上m3,即可作为第三个分组,使得能够任意伪造通过mac。
最终构造如下:m=m1||m2||t1^m3||m4,mac=t2
关键操作和代码
复制粘贴即可
夺旗闯关:第一个Flag
解题思路
C语言源码中实现了一个特殊的加密算法,针对该算法实现解密函数即可
关键操作和代码
def
printhex
(password)
:
for
p
in
password:
(
"%02X "
% p, end=
''
)
()
def
xorWithKeys
(password, round)
:
for
i
in
range(
16
):
password[i] ^= ((
0x78
* round) &
0xff
)
def
rightShiftBytes
(password)
:
for
i
in
range(
16
):
password[i] = ((password[i] >>
3
) | (password[i] <<
5
)) &
0xff
def
swapPositions
(password)
:
positions = [
13
,
4
,
0
,
5
,
2
,
12
,
11
,
8
,
10
,
6
,
1
,
9
,
3
,
15
,
7
,
14
]
temp = [
0
] *
16
for
i
in
range(
16
):
temp[positions.index(i)] = password[i]
for
i
in
range(
16
):
password[i] = temp[i]
def
reverseBits
(password)
:
for
i
in
range(
16
):
temp =
0
for
j
in
range(
8
):
temp |= ((password[i] >> j) &
1
) << (
7
- j)
password[i] = temp
def
decrypt
(password)
:
for
round
in
range(
15
,
-1
,
-1
):
print
(round)
printhex (password)
xorWithKeys(password, round)
printhex (password)
rightShiftBytes(password)
swapPositions(password)
reverseBits(password)
password =
'6B562E2D3E7B6C61636078616C666C62'
password = bytes.fromhex(password)
print
(password)
password =
decrypt(password)
print
(password)
print
(bytes(password))
运行结果如下:
夺旗闯关:第二个Flag
解题思路
审计流量发现关键流量:需要构造证书满足一系列要求即可。
关键操作和代码
发现这条流量。
将该证书下载到本地,结合后端代码发现:
需要对颁布者信息和证书的扩展进行限制,发现证书有如下特点:
BCSYS颁布的
要求有个自定义扩展字段。
首先随便建立一个CA的自签名证书,要求是BCSYS颁布的。
然后生成一个自己的私钥
然后生成证书请求文件:
国家要填NL,拥有着是admin1。
这样就完成了issuer的校验,接下来是扩展字段,审计官方文档发现:
于是修改openssl.cnf
修改req的扩展值为extensions
生成证书
并上传
并输入对应私钥即可完成登录,获得加密zip以及加密的zip口令,采用上一题脚本解密口令即可获得flag。
文案 | 潘卓成
排版 | 张 涔
原文始发于微信公众号(赛博安全社团):“熵密杯“ WP
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论