Wireshark TS | Packet Challenge 之 Window 案例分析

admin 2022年9月23日13:48:00评论56 views字数 4795阅读15分59秒阅读模式

Packets don't lie


前言
来自于 Sharkfest Packet Challenge 中的一个数据包案例,Sharkfest 是 Wireshark 官方组织的一年一度的大会,致力于在 Wireshark 开发人员和用户社区之间分享知识、经验和最佳实践。印象中早期是一年一次,近几年发展成一年两次,一次貌似固定在美国,一次会在其他地区,像是欧洲或亚洲。Packet Challenge 是大会其中一个比较有意思的活动环节,通过一系列数据包案例设置关卡,参会人员进行分析挑战,测试综合分析能力。

题目信息
本次案例为 Sharkfest 2015 Packet Challenge 中的第五个也是最后一个题目 PRINTING PAIN!,数据包跟踪文件为 printpain.pcapng
主要描述如下:
1. What is the make and model of the target printer?
2. What file is being printed?
3. What is the maximum TCP receive buffer size advertised by the printer?
4. What three characteristics make frame 179 a “window zero probe?”
5. What is the largest delay between a Window Full indication and a Window Update?

数据包信息
数据包跟踪文件基本信息如下:
λ capinfos printpain.pcapngFile name:           printpain.pcapngFile type:           Wireshark/... - pcapngFile encapsulation:  EthernetFile timestamp precision:  microseconds (6)Packet size limit:   file hdr: (not set)Number of packets:   854File size:           1071 kBData size:           1041 kBCapture duration:    127.885457 secondsFirst packet time:   2013-11-07 13:28:13.967672Last packet time:    2013-11-07 13:30:21.853129Data byte rate:      8144 bytes/sData bit rate:       65 kbpsAverage packet size: 1219.70 bytesAverage packet rate: 6 packets/sSHA256:              a81f71187fa52516fc27a5d5e561bf44d5d54e1dfc8cb3be9e080d0bc793933bRIPEMD160:           d12c9eb5956dd124f99887c9fb6b0a16c7496ff7SHA1:                8ade6e77ef0719632c1cd26ecf06c89dac051341Strict time order:   TrueCapture oper-sys:    32-bit Windows 7 Service Pack 1, build 7601Capture application: Dumpcap 1.8.6 (SVN Rev 48142 from /trunk-1.8)Capture comment:     Copyright Chappell University <[email protected]>  Troubleshooting with Wireshark: Locate the Source of Performance Problems ISBN: 978-1-893939-9-74   You may not reproduce, duplicate, copy, sell, trade, resell, or exploit for any commercial purposes, this trace file or any  trace file available at www.wiresharkbook.com.Number of interfaces in file: 1Interface #0 info:                     Name = DeviceNPF_{6C89B4B8-5C6E-437A-9BA1-CFEF8F98C68D}                     Encapsulation = Ethernet (1 - ether)                     Capture length = 65535                     Time precision = microseconds (6)                     Time ticks per second = 1000000                     Time resolution = 0x06                     Operating system = 32-bit Windows 7 Service Pack 1, build 7601                     Number of stat entries = 1                     Number of packets = 854
λ
Winows 7 系统上直接通过 Wireshark 捕获,无截断,文件大小 1071 KB,捕获数据包数量 854 个,捕获持续时间为 127.89 秒,平均速率 65 kbps,并有相关注释说明。
会话信息统计如下,仅有一条 TCP 流。
Wireshark TS | Packet Challenge 之 Window 案例分析

专家信息显示如下,Warning 信息中有较多的 TCP 零窗口以及 TCP 窗口满提示,说明  TCP window 存在一定问题。
Wireshark TS | Packet Challenge 之 Window 案例分析


数据包分析

数据包跟踪文件初步展开信息如下,Packet List 最右侧会有一些黑色告警信息的提示,点选可知基本都是 TCP 零窗口以及 TCP 窗口满提示。
Wireshark TS | Packet Challenge 之 Window 案例分析

1. What is the make and model of the target printer?

目标打印机的牌子和型号是什么?

分析步骤
Pakcet List 视图中 Protocol 均是 TCP ,协议分层统计信息中也没有比较特殊的专有协议。题目提到了打印机,简单通过服务端口 9100 查了下,大概是 HP 打印机。
Wireshark TS | Packet Challenge 之 Window 案例分析
而关于品牌和型号的信息,可以通过分析 Follow-> TCP Stream 得到
Wireshark TS | Packet Challenge 之 Window 案例分析
PJL(打印机工作语言),由惠普公司开发的打印机命令语言,可在打印作业级别提供打印机控制。使用 PJL 命令,可以更改默认打印机设置,如要打印的份数。

分析答案
目标打印机的牌子和型号是:HP Officejet 6500 E710n-z。

2. What file is being printed?

被打印的文件是什么。

分析步骤
同样在分析 Follow-> TCP Stream 得到相关信息
Wireshark TS | Packet Challenge 之 Window 案例分析

分析答案

被打印的文件是:Installation.pdf。


3. What is the maximum TCP receive buffer size advertised by the printer?

打印机通知的 TCP 接收缓冲区的最大大小是多少?


分析步骤

此题所讲的 TCP receive buffer 实际上是 TCP WindowWindow size scaling factor 的乘积,也就是字段 [Calculated window size] 的值。

可通过在 Pakcet List 视图中增加列信息,字段值为:tcp.window_size

Wireshark TS | Packet Challenge 之 Window 案例分析
问的是打印机,可过滤源 IP 得到打印机通告的所有 Window 值。
Wireshark TS | Packet Challenge 之 Window 案例分析

分析答案

打印机通知的 TCP 接收缓冲区的最大大小是:17520。

4. What three characteristics make frame 179 a “window zero probe?”

哪三个特征使得数据帧 179 标记为一个“window zero probe”?


分析步骤

首先跳转到 No.179 前后,关于零窗口的问题就很明显了。
Wireshark TS | Packet Challenge 之 Window 案例分析
  1. 首先客户端根据打印机所通知的窗口值,结合自己所发送的数据分段大小,得知对端打印机的接收窗口满,No.173 标记 TCP Window Full。注:这个标记指的是对端 TCP 窗口满。
  2. No.174 打印机因为自身零窗口 Win 0 , 所以标记为 TCP ZeroWindow;
  3. No.175 为客户端所发送的 TCP 零窗口探测包,以查看打印机的零窗口是否依然存在,打印机会对这个零窗口探测进行 ACK 回复,即 No.176;
  4. 以此类推,如果打印机回复窗口大小仍然为零,则客户端的探测计时器加倍。
Wireshark TS | Packet Challenge 之 Window 案例分析

节选 Wireshark 官方文档对于 TCP ZeroWindowProbe 的定义

TCP ZeroWindowProbe

Set when the sequence number is equal to the next expected sequence number, the segment size is one, and last-seen window size in the reverse direction was zero.
If the single data byte from a Zero Window Probe is dropped by the receiver (not ACKed), then a subsequent segment should not be flagged as retransmission if all of the following conditions are true for that segment: * The segment size is larger than one. * The next expected sequence number is one less than the current sequence number.
This affects “Fast Retransmission”, “Out-Of-Order”, or “Retransmission”.

分析答案

哪三个特征使得数据帧 179 标记为一个“window zero probe”:1. the sequence number is equal to the next expected sequence number;2. the segment size is one;3. last-seen window size in the reverse direction was zero.

5. What is the largest delay between a Window Full indication and a Window Update?

“窗口满”指示和“窗口更新”之间的最大延迟是多少?

分析步骤

回顾一下 4 题,在 No.184 打印机仍回复零窗口之后,大约 11.22 秒之后打印机窗口恢复到了 16384,也就是 No.185 数据包 Win=16384 。而从 No.173 TCP Window Full 到 No.185 TCP Window Update 之间的时间延迟为 25.682732 秒。
Wireshark TS | Packet Challenge 之 Window 案例分析

同样,可以点选 No.173 后右键选择 Set/Unset Time Reference 后,将 No.173 作为基准时间(即作为第一个数据帧),同时在 Pakcet List 视图中增加列信息,字段值为 frame.time_relative,那么 No.185 相距第一个数据帧 No.173 的时间差值为 25.682732 秒。

Wireshark TS | Packet Challenge 之 Window 案例分析

如何在此跟踪文件中找到类似 No.185 和 No.173 之间的时间间隔值中的最大值?可以通过显示过滤表达式过滤出所有的 “窗口满”和“窗口更新”数据包。
Wireshark TS | Packet Challenge 之 Window 案例分析

然后在 Pakcet List 视图中增加列信息,字段值为:frame.time_delta_displayed,并从大到小排列找到最大差值。
Wireshark TS | Packet Challenge 之 Window 案例分析
Wireshark TS | Packet Challenge 之 Window 案例分析


分析答案

“窗口满”指示和“窗口更新”之间的最大延迟是:25.866367 秒。


Wireshark TS | Packet Challenge 之 Window 案例分析


往期推荐


1. Wireshark 提示和技巧 | 捕获点之 TCP 三次握手

2. Wireshark 提示和技巧 | a == ${a} 显示过滤宏

3. Wireshark TS | Slow Slow Slow Web

4. Wireshark TS | 消失的 TCP DUP ACK

5. 网络设备 MTU MSS Jumboframe 全解



后台回复「TT」获取 Wireshark 提示和技巧系列 合集
后台回复「TS」获取 Wireshark Troubleshooting系列 合集
如需交流,可后台直接留言,我会在第一时间回复,谢谢!
Wireshark TS | Packet Challenge 之 Window 案例分析

原文始发于微信公众号(Echo Reply):Wireshark TS | Packet Challenge 之 Window 案例分析

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年9月23日13:48:00
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Wireshark TS | Packet Challenge 之 Window 案例分析http://cn-sec.com/archives/1312783.html

发表评论

匿名网友 填写信息