跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[宽带症候群] 实验发现与 plex 的通信被 middlebox 干扰

发表于

近日发现 plex 的服务不可用。排障过程中,发现了一些有意思的事。

过程

Plex 其中一个受影响域名是 clients.plex.tv

首先,查询 DNS ,得知此域名解析结果没有被污染。

$ nslookup clients.plex.tv
Server:         192.168.1.1
Address:        192.168.1.1#53

Non-authoritative answer:
Name:   clients.plex.tv
Address: 172.64.151.205
Name:   clients.plex.tv
Address: 104.18.36.51
Name:   clients.plex.tv
Address: 2606:4700:4400::6812:2433
Name:   clients.plex.tv
Address: 2606:4700:4400::ac40:97cd

其次,选取 2606:4700:4400::ac40:97cd 为目标 IP 地址,测试连通性。得知此 IP 地址没有被封锁。

$ ncat -v 2606:4700:4400::ac40:97cd 443
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Connected to 2606:4700:4400::ac40:97cd:443.

接着,选择 visa.com 为 SNI ,使用 curl 测试服务可用性。重复两次,得到相同结果。

$ curl --silent --output /dev/null \
  --write-out "%{http_code}" \
  --resolve visa.com:443:[2606:4700:4400::ac40:97cd] \
  https://visa.com
301

然后,选择 clients.plex.tv 为 SNI 再次测试服务可用性。观察到 curl 卡住,遂手工终止程序。

$ curl --silent --output /dev/null \
  --write-out "%{http_code}" \
  --resolve clients.plex.tv:443:[2606:4700:4400::ac40:97cd] \
  https://clients.plex.tv
^C

此时,再次使用 ncat 测试 IP 地址连通性。发现此 IP 地址已被封锁。

$ nc -v 2606:4700:4400::ac40:97cd 443
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Connection timed out.

最后,使用 mtr 探测问题发生位置。命令:

$ mtr --tcp --port 443 --interval 1 --timeout 3 --no-dns 2606:4700:4400::ac40:97cd

发现最后一跳不在输出中显示。

约 5 分钟后,第三次使用 ncat 测试 IP 地址连通性。发现恢复。

$ ncat -v 2606:4700:4400::ac40:97cd 443
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Connected to 2606:4700:4400::ac40:97cd:443.

此时,第二次使用 mtr 追踪路由。发现最后一跳已能够在输出中显示。

变换网络环境为蜂窝网,重复上述实验。结果相同。

使用 wireshark 抓包,重复上述实验。发现若 clients.plex.tv 为 SNI ,客户端在服务器 ServerHelloDone 后的一段时间内,不再能收到服务器的任何报文。这一过程中,客户端没有收到过 TCP RST 。

猜想

Plex 的一些域名已被 middlebox 干扰。

这一审查使用了非常聪明的机制,不同于以往封锁 IP 地址在骨干网丢弃出站报文,表现得更像是源自服务器的故障。

根据已知事实,楼主的猜想如下:

  • 审查通过 SNI 触发
  • 触发后,middlebox 会添加二元组条件的临时过滤规则来丢弃报文
  • 规则在入站方向生效(依据 mtr 的输出结果猜测)
  • 临时规则有效时间约为 5 分钟

此外,楼主猜测执行这套审查机制的是一套新颖的系统,与执行 SNI 阻断(如对 store.steampowered.com )的那套也不同。最明显的是,这套系统没有注入 TCP RST 报文。

楼主尝试使用 TCP 或 TLS records 分片( fragmentation )保护客户端与 clients.plex.tv 的连接免受 middlebox 攻击,但失败了。而这一措施在应对 SNI 阻断时十分好用。这可能说明,这套系统拥有充沛的计算资源来执行流重组。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.