2015广东省强网杯CTF初赛题之大黑阔writeup

前几天的防火墙与入侵检测课上,老师把广东省强网杯CTF其中的一道初赛题当做实践课的任务,解题时学会了不少东西,觉得挺有趣的,所以记下来,以下writeup仅仅是个人见解


问题

-【大黑阔的数据包】是一个.pcap文件


详细步骤如下:

用Wireshark打开.pcap文件。
分析对象

1、协议统计:在菜单中选择Statistics,然后选择Protocol Hierarchy,就可以统计出所在数据包中所含的IP协议、应用层协议。
对数据包进行协议统计


2、数据过滤:由于抓包数据看起来比较杂乱,可以根据需求在Filter对话框中输入命令进行过滤。将http包过滤出来。
显示过滤
数据内容分析
-分析:可知双方微信聊天的ip地址以及ID。
按包长度排序
-分析:按Length递增排列分类,点击Length大于343时的包时发现其中含有聊天记录。


3、使用”Follow TCP Stream”查看Tcp流中的应用层数据。在包列表中选择一个包,然后选择Wireshark工具栏菜单的”Following TCP Streams”选项(或者使用包列表鼠标右键的上下文菜单)。然后,Wireshark就会创建合适的显示过滤器,并弹出一个对话框显示TCP流的所有数据。流的内容出现的顺序同他们在网络中出现的顺序一致。从A到B的通信标记为红色,从B到A的通信标记为蓝色。非打印字符将会被显示为圆点。
*使用"Follow TCP Stream
TCP流
- 分析:截取出如下聊天记录

[{'content':'hi','stime':'15:36:39'}]
content=i am here what?&sender=haiou&geter=haozi 15:36:48
[{'content':'next week','stime':'15:37:07'}]
[{'content':'we can go somewhere to have a rest','stime':'15:37:30'}]
[{'content':'where are you going ?','stime':'15:38:05'}]
content=i don't have idea&sender=haiou&geter=haozi
[{'content':'how about tangshang','stime':'15:38:25'}]
content=but i was born in tangshan&sender=haiou&geter=haozi
[{'content':'wow....','stime':'15:38:47'}]
[{'content':'then how about tianyahaijiao','stime':'15:38:57'}]
content=sounds like not bad&sender=haiou&geter=haozi
content=where is that?&sender=haiou&geter=haozi
[{'content':'i ....do not know','stime':'15:39:30'}]
[{'content':'but i can check in my map img','stime':'15:39:43'}]
content=if it is a place with water....&sender=haiou&geter=haozi
[{'content':'then?','stime':'15:40:06'}]
content=i can not swim&sender=haiou&geter=haozi
[{'content':'god....','stime':'15:40:20'}]
[{'content':'then...you dont want go anywhere?','stime':'15:40:38'}]
content=i have no idea&sender=haiou&geter=haozi
[{'content':'how about wangsicong 100?','stime':'15:41:36'}]
content=what meaning?&sender=haiou&geter=haozi
[{'content':'how about wangsicong 100?','stime':'15:41:52'}]
[{'content':'guominlaogong ','stime':'15:42:05'}]
[{'content':'lol...','stime':'15:42:10'}]
content=what is 100?&sender=haiou&geter=haoziHTTP/1.1 200 OK
[{'content':'his family has alot of building..you know..','stime':'15:42:44'}]
content=yes....&sender=haiou&geter=haozi
content=but i really do not know the way&sender=haiou&geter=haozi
content=canyou show me the way in the map?&sender=haiou&geter=haozi
[{'content':'ok','stime':'15:43:44'}]
[{'content':'upload to me','stime':'15:43:49'}]
content=ok&sender=haiou&geter=haozi
content=see that?&sender=haiou&geter=haoziHTTP/1.1 200 OK
[{'content':'well! ','stime':'15:44:35'}]

他们聊天的内容是计划下周的出行目的地是“王思聪 100”(他家的建筑),有传图。


4、还原图片:利用WinHex软件
(1)将TCP流另存为temp.bin
TCP流另存
(2)利用WinHex从保存的原始文件中将上传的图片还原出来
将保存的temp.bin用WinHex打开,可以看到文件中包含HTTP请求信息以及我们的图片信息,还有文件结尾的尾部信息。需要确定图片文件的原始信息头和尾,并去掉多余的部分。
emp.bin用WinHex打开
回到Wireshark中,会看到我们刚才的数据流中关于图片的头部分。
数据流中关于图片的头部分
在Content-Type: image/pjpeg后面有两个换行符,在原始文件中换行符用十六进制表示是 “0D 0A”,因为有两个,所以我们在图片名字map.jpg附近寻找“0D 0A 0D 0A”,后面的部分就表示图片的开始。
两个换行符
需要去掉图片以上的部分。在00000000偏移处点击alt+1,表示选块开始。
在到的“0D 0A 0D 0A”处的最后一个0A处点击alt+2.表示选块结束。
这时候,就选中了图片之前的多余部分。
截取需要的部分
按下delete键,将文件中的多余头部确认删除。
delete
回到wireshark中,看看图片传送完毕之后的尾部部分。可以看到,这次是一个换行符,后面有些文件结束标志“————-”。
图片的尾部
同样在原始文件中删除它们。
一个换行符
要删除的
这时文件中就仅仅是原始图片的内容了,如下,将文件另存为test.jpg。
得到图片完整数据
另存为.jpg
打开jpg图片,是一份中国地图。


5、开脑洞:利用搜索工具
根据对话内容中的
王思聪100以及his family has alot of building —>搜索 万达 100
搜到 万达100店——昆明西山的达广场盛大开业
地点昆明 结合地图 调整对比度和亮度得出 flag
end


【参考】
1、 [ Wireshark系列之7 利用WinHex还原文件 - 一壶浊酒 - 51CTO技术博客 ]

2、 [ WireShark黑客发现之旅–开篇 | WooYun知识库 ]

3、 [ 广东省第一届“强网杯” writeup - 程序园 ]


发布了11 篇原创文章 · 获赞 7 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/sinat_16683257/article/details/50804892