前言
1. 第四扩展FS
题目给了一张图片,用foremost提取出一张图片和加密的zip压缩包,爆破解压密码许久都没有成功,用EmEditor打开看到有字符串:Pactera,成功解压压缩包,然后根据提示需要统计字符出现次数。1
2
3
4
5
6from collections import Counter
f=open("file.txt",'r')
print(Counter(f.readlines()[0]))
#输出:
Counter({'D': 3950, 'C': 1900, 'T': 1850, 'F': 1800, '{': 1750, 'h': 1700, 'u': 1650, 'a': 1600, 'n': 1550, 'w': 1500, 'e': 1450, '1': 1400, 's': 1350, 'i': 1300, 'k': 1250, '4': 1200, 'o': 1150, '!': 1100, '}': 1050})
得到flag:DDCTF{huanwe1sik4o!}
2. 安全通信
该题使用ECB(电子密码本模式)进行加密,由于分组模式中ECB模式相同的明文分组,会得到相同密文输出。
根据这个特性,以爆破第一位为例,构造输入Agent ID 为45个1,加密消息为:1
Connection for mission: ID为111111111111111111111111111111111111111111111, your mission's flag is: D
然后加上Flag的第一位,构成96(16*6)个字符长度输入,截取密文的前192(32*6)。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17Please enter mission key:
b9ba15b341c847c8beba85273f9b7f90
#Agent ID为45个1
Please enter your Agent ID to secure communications:
#返回的欢迎加密信息,取前192位作为判断
111111111111111111111111111111111111111111111
ce62ff6f5ebd23a8d059b1bd831a8d0fed6d82e4257f35a62ef76a43970ade3e06b6e8e7589fddd8b8ac55e5c29625e906b6e8e7589fddd8b8ac55e5c29625e9eae01a76a2f84e768e4408555cb4acbf17888d387e8b7756e9a3de2a68b4fbf726b43ef60ec00ce6bfbdf91d4d9dba79bb2983e79315def49a0fa8eaa10cd4a8250e53382d70f71936a32961d5741662
Please send some messages to be encrypted, 'quit' to exit:
#猜测第一位为C
Connection for mission: 111111111111111111111111111111111111111111111, your mission's flag is: C
ce62ff6f5ebd23a8d059b1bd831a8d0fed6d82e4257f35a62ef76a43970ade3e06b6e8e7589fddd8b8ac55e5c29625e906b6e8e7589fddd8b8ac55e5c29625e9eae01a76a2f84e768e4408555cb4acbf18c2aed45181d467f22c858da3d1b03b
Please send some messages to be encrypted, 'quit' to exit:
#猜测第一位为D
Connection for mission: 111111111111111111111111111111111111111111111, your mission's flag is: D
ce62ff6f5ebd23a8d059b1bd831a8d0fed6d82e4257f35a62ef76a43970ade3e06b6e8e7589fddd8b8ac55e5c29625e906b6e8e7589fddd8b8ac55e5c29625e9eae01a76a2f84e768e4408555cb4acbf17888d387e8b7756e9a3de2a68b4fbf7
Please send some messages to be encrypted, 'quit' to exit:
当输入的最后一位为D时,加密结果和欢迎消息密文的前192位结果相同。接下来爆破Flag的第二位时,将Agent ID位数减1(44位)。依次递增Flag位数,同时递减Agent ID位数即可爆破出Flag,写个脚本。
1 | #Connection for mission: 111111111111111111111111111111111111111111111, your mission's flag is: D |
得到Flag;DDCTF{afd18f4a112ca67951fc95afb92b74d8}