lsb最低位解密及usb流量取证分析

lsb最低位解密及usb流量取证分析

下载题目后,发现是一个解压包,而且有多层解密,所以我们可以使用脚本来对文件进行多层解压,而每层zip文件中都有story,而在story中会有关键的信息,但不知道是那一层,而story中隐藏信息不知道哪来的思路,我也只是看别人的wp,解压脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from zipfile import ZipFile


for i in range(1,520):
str1="D:/比赛临时文档/羊城杯/temp/"
str1=str1+str(520-i)+".zip"
f = ZipFile(str1,'r')
for file in f.namelist():
f.extract(file,"D:/比赛临时文档/羊城杯/temp/")
with open("D:/比赛临时文档/羊城杯/temp/story",'r',encoding='UTF-8') as f:
str2=f.read()
if 'png' in str2:
pass
else:
print(str2)

运行脚本,解压文件,并会输出特殊的story的信息

1
2
3
4
5
6
这都被你发现了?
我这故事不错吧,嘻嘻嘻
那就把flag给你吧
oh,不,还有一半藏在了pcap的心里,快去找找吧
左心房右心房,扑通扑通的心,咿呀咿呀的❤
72, 89, 75, 88, 128, 93, 58, 116, 76, 121, 120, 63, 108,

我们可以知道一部分的flag,而且我们还可以得到一张flag.png,而根据题目的提示,我们可以判断是LSB最低位解密,也可以使用zsteg来对png图片进行扫描,从而发现有flag.pcap文件,所以此时我们可以使用LSBsteg.py来进行解密

1
LSBsteg.py decode -i flag.png -o flag.zip

所以我们可以使用ARCHPR软件来破解,密码是12345,解压后我们看见flag.pcap,然后看见flag.pcap文件的内容,我们可以判断是usb流量分析,然后从流量包中可以看见流量信息为4个字节,而由于鼠标移动时表现为连续性,与键盘击键的离散性不一样,但实际上鼠标动作所产生的数据包也是离散的。不同的鼠标抓到的流量不一样,一般的鼠标流量都是四个字节,所以判断是鼠标流量,因此可以用

1
tshark -r usb2.pcap -T fields -e usb.capdata > usbdata.txt

来获取信息,但是这个exe在wireshark文件夹里面,所以要将flag.pcap放在wireshark文件夹里,然后在相应的文件夹的cmd命令行中执行上面的命令,然后用exp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
f = open('xy.txt','w')
DataFileName = "2.txt"
def main():
# get argv
pcapFilePath = sys.argv[1]

# get data of pcap
os.system("tshark -r %s -T fields -e usb.capdata > %s" % (pcapFilePath, DataFileName))

with open('2.txt','r') as keys:
posx = 0
posy = 0
for line in keys:
if len(line) != 12 :
continue
x = int(line[3:5],16)
y = int(line[6:8],16)
if x > 127 :
x -= 256
if y > 127 :
y -= 256
posx += x
posy += y
btn_flag = int(line[0:2],16)
if btn_flag == 2 : #2为右键,1为左键
f.write(str(posx)+",")
f.write(str(posy)+'\n')
f.close()
keys.close()

来获取坐标点,然后用这个exp来画散点图,获取剩下的flag,但是上面那个脚本需要左键跑完,右键再跑

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import matplotlib.pyplot as plt
import random
from matplotlib.pyplot import MultipleLocator

x=[]
y=[]

with open("xy.txt",'r') as f:
for line in f:
strlist=line.split(',')
y.append(int(strlist[0]))
x.append(int(strlist[1].replace('\n','')))


plt.scatter(x,y,s=30)
plt.show()

然后得到剩余数字,然后提示有flag头部为GWHT,所以看它们的ascii码,然后与得到的数字进行对比,然后发现规律,exp

1
2
3
s=[72,89,75,88,128,93,58,116,76,121,120,63,108,94,51,134,119,146,130,63,111]
for i in range(1,22):
print(chr(int(s[i-1]-i)))