在暴露 ICE 候选时使用多播 DNS 保护隐私(IETF 草案 draft-ietf-mmusic-mdns-ice-candidates) 原文标题:Using Multicast DNS to protect privacy when exposing ICE candidates
内容概要总结
本文是 IETF 关于 WebRTC 的互联网草案《Using Multicast DNS to protect privacy when exposing ICE candidates》(draft-ietf-mmusic-mdns-ice-candidates-latest,作者 Y. Fablet、J. de Borst、J. Uberti、Q. Wang,来自 Apple 和 Google,2021 年 1 月)。针对 WebRTC 默认暴露客户端私有 IP 地址造成严重用户指纹识别面的问题,本文提出为本地私有 IP 地址注册临时 mDNS(RFC 6762)名称,用名称替代候选中的 IP 地址。关键机制:唯一名称必须由版本 4 UUID(RFC 4122)加 ".local" 构成;处理远程候选时按 ".local" 结尾与点的数量判断是否用 mDNS 解析;通过 STUN 判断地址是否已公开;mDNS 候选的 connection-address 不得用于 SDP "c=" 行;不得在自身 relay 候选与远程 mDNS 候选间形成候选对(防 TURN 服务器泄露);统计信息不得泄露 mDNS 地址或解析成败;已注册名称应按源和页面生命周期限定以防被当作更可靠的追踪标识。文档还给出实验数据(双方启用 mDNS 时 ICE 连接率影响 2%,需 STUN 的连接从 94% 升至 97%;与提供原始 IP 的端点交互连接率下降 3%)、IPv4/IPv6/STUN 完整示例与安全考量(mDNS 洪泛、恶意响应、未经请求的 ICE 通信)。
翻译内容
原文内容(English)
MMUSIC
Y. Fablet
Internet-Draft
Apple Inc.
更新:8839(如获批准)
J. de Borst
预期状态:信息性(Informational)
J. Uberti
到期:2021 年 7 月 12 日
Q. Wang
Google
2021 年 1 月 8 日
在暴露 ICE 候选时使用多播 DNS 保护隐私
draft-ietf-mmusic-mdns-ice-candidates-latest
摘要
WebRTC 应用程序在创建点对点连接的过程中会收集 ICE 候选。为最大化直接点对点连接的概率,客户端私有 IP 地址会被包含在这个候选集合中。然而,披露这些地址具有隐私影响。本文档描述了一种在与其他客户端共享本地 IP 地址的同时保护客户端隐私的方法。这是通过用动态生成的多播 DNS(mDNS)名称来隐藏 IP 地址来实现的。
本文档状态
本 Internet-Draft 完全符合 BCP 78 和 BCP 79 的规定。
Internet-Draft 是 IETF 的工作文档。请注意,其他组织也可能将工作文档作为 Internet-Draft 分发。当前 Internet-Draft 的列表位于 https://datatracker.ietf.org/drafts/current/。
Internet-Draft 是有效期最长六个月的草稿文档,可能在任何时候被更新、替换或废弃。将 Internet-Draft 作为参考资料使用或以"进行中的工作"以外的方式引用它们都是不恰当的。
本 Internet-Draft 将于 2021 年 7 月 12 日到期。
版权声明
版权所有(c)2021 IETF Trust 及被认定为本文档作者的人员。保留所有权利。
本文档受 BCP 78 及《IETF 文件相关信托法律条款》(https://trustee.ietf.org/license-info)约束,其效力以本文档发布之日为准。请仔细阅读这些文档,因为它们描述了您对本文档的权利与限制。从本文档中提取的代码组件必须包含《信托法律条款》第 4.e 节所述的 Simplified BSD License 文本,并且按《Simplified BSD License》所述不提供任何担保。
目录
3.1. ICE 候选收集
3.1.2. 实现指导
3.2. ICE 候选处理
3.2.2. 实现指导
3.3. 附加隐私考量
3.3.2. 与 TURN 服务器的交互
3.3.3. 生成名称的复用
3.3.4. 特定浏览上下文
3.3.5. 网络接口枚举
3.3.6. 会话监控
5.1. 连通性降低
5.2. 连接建立延迟
5.3. 向后兼容性
6.2. 由慢速信令产生的对等反射候选
6.3. 由慢速解析产生的对等反射候选
6.4. IPv4、IPv6 与 STUN 处理
- 安全考量
7.1. mDNS 消息洪泛
7.2. 拒绝名称注册的恶意响应
7.3. 未经请求的 ICE 通信
9.1. 规范性参考文献
9.2. 资料性参考文献
1. 引言
如 [IPHandling] 所详述,默认向 Web 应用程序暴露客户端私有 IP 地址能最大化在客户端之间成功创建直接点对点连接的概率,但会造成一个巨大的用户指纹识别面。[IPHandling] 承认了这个问题,但也承认目前没有解决方案;选择使用 Mode 3 来应对隐私关切的实现,在 WebRTC 应用中经常遭受连接失败或次优连接。这在非受管网络(通常是家庭或小型办公室)中尤其是一个问题,因为那里可能不支持 NAT 回环(NAT loopback)。
本文档提出一个针对该问题的总体解决方案:扩展 [ICESDP],允许 ICE 实现为本地私有 IP 地址注册临时的 mDNS [RFC6762] 名称,然后在其 ICE 候选中提供这些名称而非 IP 地址。虽然该技术意在使 Web 浏览器中的 WebRTC 实现受益(通过防止任意网页收集私有 IP 地址),但它也可以被任何想要避免向其他网络上的远程对等端披露其本地网络信息的端点使用。
WebRTC 及兼容 WebRTC 的端点 [Overview] 收到带有 mDNS 名称的 ICE 候选后,会将这些名称解析为 IP 地址并照常执行 ICE 处理。在端点是 Web 应用程序的情况下,WebRTC 实现将在内部管理此解析,不会向应用程序披露实际的 IP 地址。
2. 术语
本文档中的关键词 "MUST"、"MUST NOT"、"REQUIRED"、"SHALL"、"SHALL NOT"、"SHOULD"、"SHOULD NOT"、"RECOMMENDED"、"MAY" 和 "OPTIONAL" 应按 [RFC2119] 所述来解释。
3. 描述
本节使用 [RFC8445] 中定义的 ICE 代理(ICE agent)概念。在本文档其余部分,假定每个浏览上下文(如 [HTMLSpec] 第 7.1 节所定义)都有自己的 ICE 代理。
3.1. ICE 候选收集
本节概述 ICE 代理应如何使用 mDNS 来隐藏本地 IP 地址。
3.1.1. 过程
对于 ICE 代理在 [RFC8445] 第 5.1.1 节所述收集过程中收集到的每个主机候选,该候选按如下方式处理。
检查该 IP 地址是否满足 ICE 代理关于某个地址是否可安全暴露的策略。如果满足,则暴露该候选并中止此过程。
检查 ICE 代理此前是否已按第 3 至 5 步为该 IP 地址生成、注册并存储了一个 mDNS 主机名。如果有,则跳到第 6 步。
生成一个唯一的 mDNS 主机名。该唯一名称必须由一个 [RFC4122] 定义的版本 4 UUID 后跟 ".local" 构成。
按 [RFC6762] 所述注册该候选的 mDNS 主机名。ICE 代理应(SHOULD)为该主机名发送一个 mDNS 通告,但由于该主机名预期是唯一的,ICE 代理应跳过对该主机名的探测(probing)。
将该 mDNS 主机名及其相关的 IP 地址存储在 ICE 代理中以供将来复用。
把 ICE 候选的 IP 地址替换为其 mDNS 主机名,并将该候选提供给 Web 应用程序。
ICE 代理可以以任何方式实现此过程,只要它产生等效结果。例如,实现可以通过执行第 3 至 5 步来预注册 mDNS 主机名,并相应地预填充 ICE 代理。这样,在收集候选时只需执行上述过程的第 6 步。
为防止 Web 应用程序利用此机制来查询本地网络是否支持 mDNS,即使本地网络不支持 mDNS 或第 4 步中 mDNS 注册失败,ICE 代理在第 6 步仍应提供 mDNS 候选。
此过程确保一个 mDNS 名称仅用于替换一个 IP 地址。具体而言,一个同时拥有 IPv4 和 IPv6 地址的接口的 ICE 代理,必须为每个地址暴露一个不同的 mDNS 名称。
3.1.2. 实现指导
3.1.2.1. 注册
发送到网络的 mDNS 通告可能会被延迟,例如由于速率限制。ICE 代理应在其 mDNS 名称生成后立即将候选提供给 Web 应用程序,无论该通告是否已发送到网络上。
3.1.2.2. 确定地址隐私与服务器反射候选
自然,一个已经暴露到互联网的地址无需由 mDNS 保护,因为它可以被 Web 服务器或远程端点轻易观察到。然而,事先确定这一点并不直接;虽然一个 IPv4 地址是私有的这一事实有时可由其值推断(例如,它是否是一个 [RFC1918] 地址),但反过来未必成立。IPv6 地址有其自身的复杂之处,例如 NAT64 [RFC6146] 所导致的私有 IPv6 地址。
相反,一个地址是否公开可以在 ICE 收集过程中可靠地确定。对于按上述指导生成的每个 mDNS 主机候选,向一个 STUN 服务器发送通常的 STUN [RFC5389] 请求。只要应用程序配置了 IPv4 和 IPv6 STUN 服务器,这对 IPv4 和 IPv6 本地地址都可以做。如果 STUN 响应返回的值与本地 IP 地址相同,这表明该地址实际上是公开的。
无论结果如何,都会生成一个服务器反射候选;该候选的传输地址是一个 IP 地址,因此与相关联的 mDNS 候选的主机名传输地址不同,据此,按 [RFC8445] 第 5.1.3 节的指导,它不得被视为冗余。为避免意外的 IP 地址披露,该服务器反射候选必须按 [ICESDP] 第 9.1 节所述,将其 raddr 字段设为 "0.0.0.0"/"::",将其 rport 字段设为 "9"。
一旦某个地址被识别为公开,ICE 代理可以缓存此信息,并在未来的 ICE 收集阶段对该地址省略 mDNS 保护。
3.1.2.3. IPv6 地址的特殊处理
如 [IPHandling] 所述,私有 IPv4 地址尤其成问题,因为它们的生命周期不受限。然而,推荐用于 WebRTC 的 [RFC4941] IPv6 地址具有固有的隐私保护,即短生命周期和不存在任何有状态信息。据此,实现可以选择不用 mDNS 名称隐藏 [RFC4941] 地址,作为换取更好点对点连通性的权衡。
3.1.2.4. mDNS 候选编码
一个 mDNS 候选的 mDNS 名称必须用于其候选属性的 connection-address 字段。然而,当一个 mDNS 候选将是默认候选时(通常因为没有其他候选),其 mDNS 名称不得用于 SDP "c=" 行的 connection-address 字段,因为实验性部署表明许多远程端点将无法处理这样的 SDP。在这种情况下,必须改为在 c= 和 m= 行中使用 IP 地址值 "0.0.0.0"/"::" 和端口值 "9",类似于 [ICESDP] 第 4.3.1 节中处理无候选情况的方式。
通过本地描述暴露给应用程序的任何候选,必须与候选收集期间提供的候选完全相同(即不得包含私有主机 IP 地址)。
3.2. ICE 候选处理
本节概述 ICE 代理如何处理收到的带有 mDNS 名称的 ICE 候选,与所有端点都相关。
3.2.1. 过程
对于 ICE 代理收到的任何远程 ICE 候选,使用以下过程:
如果该 ICE 候选的 connection-address 字段值不以 ".local" 结尾,或该值包含多于一个 ".",则按 [RFC8445] 所述处理该候选。
如果 ICE 候选策略是 "relay"(如 [JSEP] 所定义),则忽略该候选。
否则,使用 mDNS 解析该候选。ICE 代理应设置相应 mDNS 查询消息的单播响应位(unicast-response bit);这能最小化多播流量,因为该响应很可能只对发起查询的节点有用。
如果它解析为一个 IP 地址,则把该 ICE 候选的 mDNS 主机名替换为解析得到的 IP 地址,并按 [RFC8445] 所述继续处理该候选。
否则,忽略该候选。
3.2.2. 实现指导
ICE 代理可以使用一个同时透明支持多播和单播 DNS 的主机名解析器。在这种情况下,".local" 名称的解析可能如 [RFC6762] 第 3 节所述通过单播 DNS 发生。
当主机名解析返回多于一个 IP 地址时,ICE 代理应忽略该候选。
ICE 代理可以对其将使用 mDNS 解析的 ICE 候选增加额外限制,因为该机制允许攻击者向具有众所周知 mDNS 名称的设备发送 ICE 流量。特别是,如果 mDNS 名称不符合第 3.1 节所定义的格式,ICE 代理不应解析它们。
3.3. 附加隐私考量
该机制的目标是在继续允许应用程序传输 ICE 候选的同时,将私有主机 IP 地址的知识保持在 ICE 代理内部。除了让私有主机 IP 地址不出现在 ICE 候选中之外,实现还必须采取措施,防止这些 IP 地址通过其他途径暴露给 Web 应用程序。
3.3.1. 统计信息
Web 应用程序可访问的、与 ICE 候选相关的统计信息,不得包含本地或远程 mDNS 候选的 IP 地址;应改为使用 mDNS 名称。
统计信息不应泄露 mDNS 解析成功还是失败。为此,对于提交给 ICE 代理的任何远程 mDNS 候选,即使该 mDNS 候选作为第 3.2 节的一部分被忽略,也应为它生成 [WebRTCStats] 定义的 RTCIceCandidateStats 对象。一种在统计信息中混淆 mDNS 候选地址的实现策略(无论它是否被解析)是,把该 ICE 候选的 mDNS 主机名替换为 IP 值 "0.0.0.0" 或 "::"。
此外,作为一次 ICE 连通性检查的结果,可能会从某个远程主机 IP 地址构造出一个对等反射远程候选,如 [RFC8445] 第 7.3.1.3 节所述。由于信令或 mDNS 解析延迟,该检查可能在候选到达之前到达,如上面的示例所示。
为防止在这种场景下向应用程序披露主机 IP 地址,与 ICE 候选相关的统计信息不得包含任何对等反射候选的 IP 地址,除非该 IP 已通过信令一个具有相同地址、相同或不同端口的候选而被知悉;这包括信令的候选按 [RFC8445] 第 5.1.3 节作为冗余被丢弃的情况。
3.3.2. 与 TURN 服务器的交互
当向 TURN [RFC5766] 服务器发送数据时,发送方客户端会告诉服务器该数据的目标 IP 和端口。这意味着,如果客户端使用 TURN 发送到一个通过 mDNS 解析获得的 IP,TURN 服务器将得知底层的宿主 IP 和端口,而这个信息随后可以被中继给 Web 应用程序,从而使 mDNS 包装的价值失效。
为防止向 TURN 服务器披露主机 IP 地址,ICE 代理不得在其自身的 relay 候选与远程 mDNS 候选之间形成候选对。此限制适用于所有远程 mDNS 候选类型,而不仅仅是主机候选;mDNS 候选可以从它们的 connection-address 字段清楚地识别。另请注意,反过来不是问题;ICE 代理可以在其自身的 mDNS 候选与远程 relay 候选之间形成候选对,因为在这种情况下,宿主 IP 不会直接发送给 TURN 服务器。
此限制对连通性没有影响;在主机 IP 地址是私有的、需要用 mDNS 名称包装的情况下,它们从 TURN 服务器将不可达,而如上所述,反向路径将继续正常工作。
3.3.3. 生成名称的复用
重要的是,已注册 mDNS 主机名的使用在时间和/或范围上受到限制。无限期地复用同一个 mDNS 主机名候选,会给应用程序提供一个比本规范旨在隐藏的私有 IP 地址更可靠的追踪机制。就 Web 应用程序而言,已注册 mDNS 主机名的使用应按 Web 应用程序的源(origin)限定范围,并应具有执行该 Web 应用程序的页面的生命周期。
3.3.4. 特定浏览上下文
如 [IPHandling] 所述,如果运行在两个浏览上下文中的 Web 应用程序能够确定它是否运行在同一设备上,隐私可能会被破坏。虽然本文档的方法防止应用程序直接比较本地私有 IP 地址,但一次成功的本地 WebRTC 连接也可能对用户隐私构成威胁。具体而言,当一次 WebRTC 连接延迟接近零时,两个对等端运行在同一设备上的概率很高。
为避免此问题,浏览器不应为运行在第三方浏览上下文(即,与顶层浏览上下文具有不同源的上下文)或私有浏览上下文中的 WebRTC 应用程序注册 mDNS 名称。
3.3.5. 网络接口枚举
即使本地 IP 地址未被暴露,mDNS 主机名候选的数量仍然可以提供一个指纹识别维度。对于连接性有限、不会生成服务器反射或 relay 候选的网络接口,这尤其是这种情况。
一个端点通过 mDNS 主机名候选暴露的 mDNS 名称越多,指纹识别风险就越高。一种对策是把此数量限制在一个很小的值。
请注意,把 mDNS 主机名候选限制为仅默认路由时,不会引入额外的指纹识别风险。
3.3.6. 会话监控
本地网络中的一个恶意端点也可能记录其他正在注册、注销和解析 mDNS 名称的端点。这样,它们就能创建一份会话日志,显示哪些端点正在通信以及持续多久。如果会话中的两个端点都在同一网络上,它们正在通信这一事实就能被发现。
缓解此威胁超出了本提案的范围。
4. 对 RFC 8839 的更新
[ICESDP] 第 5.1 节规定:
生成本地候选的代理不得使用 FQDN 地址。处理远程候选的代理必须忽略那些包含 FQDN 或不受支持/无法识别的 IP 地址版本的候选行。
本文档扩展 [ICESDP],特别允许生成和处理带有 {gathering} 中所定义 ".local" FQDN 的 ICE 候选。对其他 FQDN 的限制不受影响。
5. 潜在局限
5.1. 连通性降低
在典型 ICE 中,同一网络上的端点通常能够在它们的本地 IP 地址之间建立直接连接。使用 mDNS 技术时,直接连接仍然可能,但前提是至少有一方能正确解析所提供的 mDNS 候选。这可能并非在所有场景中都可行。
首先,某些网络可能完全禁用 mDNS。其次,mDNS 查询的范围有限。在大型网络上,这可能意味着如果远程端点相隔太多网段,mDNS 名称就无法被解析。
当 mDNS 失败时,ICE 将尝试回退到 NAT 发夹(NAT hairpin,如支持)或 TURN relay(如不支持)。这可能导致连通性降低、吞吐量下降和延迟增加,在 TURN relay 的情况下还会导致成本增加。
在一组已知的、配置了 STUN 服务器但未配置 TURN 服务器的支持 mDNS 的端点上进行 mDNS 技术的实验测试时,当双方都启用 mDNS 时,观测到的对 ICE 连接率的影响为 2%(相对值),相比只在一侧启用 mDNS 时。在此测试中,需要 STUN 的连接(即经过 NAT)的百分比从 94% 增加到 97%,表明 mDNS 大约有一半时间成功,其余时间回退到 NAT 发夹。整体连接率下降最可能的解释是发夹在某些情况下失败了。
一种潜在的缓解措施,如第 3.3 节所述,是不隐藏从 [RFC4941] IPv6 地址创建的候选。这允许即使在大型内部网络或 mDNS 被禁用的地方也保持连通性。本文档的未来版本将包含关于此选项的实验数据。
5.2. 连接建立延迟
如第 3 节所述,使用 mDNS 技术的 ICE 代理负责作为 ICE 过程一部分注册和解析 mDNS 名称。与使用原始本地 IP 地址相比,这些步骤可能延迟直接点对点连接的建立。
鉴于这些 mDNS 注册和查询通常发生在本地网络上,任何相关延迟都应该很小。此外,如第 3.1 节所述,可以采用预注册来完全消除收集延迟。
5.3. 向后兼容性
大体上,向后兼容性对 mDNS 技术来说不是重大问题。当一个支持 mDNS 的端点与一个不支持 mDNS 的端点通信时,旧端点仍会提供其本地 IP 地址,因此仍可尝试直接连接,即使旧端点无法解析新端点提供的 mDNS 名称。在旧端点尝试使用单播 DNS 解析 mDNS 名称的情况下,这可能导致 ICE 完成所需时间稍长,但不应影响连通性或连接建立时间。
然而,一些旧端点并不完全符合规范,在遇到包含主机名的 ICE 候选时可能表现不可预测,可能导致 ICE 失败。一些端点也可能无法处理来自它们未在信令中收到的地址的连通性检查。在上述实验测试中,与提供原始 IP 地址的端点(因此本应不受影响)交互时的连接率下降了 3%(相对值),推测正是出于这些原因。
6. 示例
以下示例展示 mDNS 技术在 ICE 处理期间如何被使用。第一个示例展示一个简单情形,接下来两个示例展示由于时间差异如何为本地 IP 地址创建对等反射候选,最后一个示例展示一个包含 IPv4、IPv6 和 STUN 的真实世界情形。
6.1. 正常处理
在此示例中,mDNS 候选在对等端之间交换并被正常解析以获得相应的 IP 地址。
ICE Agent 1 (192.0.2.1) ICE Agent 2 (192.0.2.2)
<Register mDNS | |
name N1, | |
192.0.2.1> | |
|------- mDNS Candidate N1 ------>|
| | <Register mDNS
| | name N2,
| | 192.0.2.2>
|<------ mDNS Candidate N2 -------|
<Resolve | | <Resolve
mDNS name N2> | | mDNS name N1>
|<=== STUN check to 192.0.2.1 ====|
|==== STUN check to 192.0.2.2 ===>|
| | |
ICE 候选的交换依赖带外信令,例如 [ICESDP] 定义的 SDP Offer/Answer 过程。在上面的示例中,用于在 ICE Agent 1 和 2 之间交换 mDNS 候选的 SDP 消息中的候选属性如下:
a=candidate:1 1 udp 2122262783 1f4712db-ea17-4bcf-a596-105139dfd8bf.local 54596 typ host
a=candidate:1 1 udp 2122262783 2579ef4b-50ae-4bfe-95af-70b3376ecb9c.local 61606 typ host
6.2. 由慢速信令产生的对等反射候选
在此示例中,由于 mDNS 候选在 STUN 检查开始之后才被信令,因此生成了一个对等反射候选。
ICE Agent 1 (192.0.2.1) ICE Agent 2 (192.0.2.2)
<Register mDNS | |
name N1, | |
192.0.2.1> | |
|------- mDNS Candidate N1 ------>|
| | <Resolve
| | mDNS name N1>
|<=== STUN check to 192.0.2.1 ====|
prflx candidate | | <Register mDNS
192.0.2.2 created | | name N2,
| | 192.0.2.2>
|<------ mDNS Candidate N2 -------|
| | |
6.3. 由慢速解析产生的对等反射候选
在此示例中,由于对名称 N2 的 mDNS 解析直到 STUN 检查被收到之后才完成,因此生成了一个对等反射候选。
ICE Agent 1 (192.0.2.1) ICE Agent 2 (192.0.2.2)
<Register mDNS | | <Register mDNS
name N1, | | name N2,
192.0.2.1> | | 192.0.2.2>
|------- mDNS Candidate N1 ------>|
|<------ mDNS Candidate N2 -------|
<Resolve | | <Resolve
mDNS | | mDNS name N1>
. |<=== STUN check to 192.0.2.1 ====|
. prflx candidate | |
. 192.0.2.2 created| |
name | |
N2> | |
6.4. IPv4、IPv6 与 STUN 处理
最后一个示例展示两个端点的整体 ICE 收集过程,每个端点都有一个私有 IPv4 地址和一个公开 IPv6 地址。它们预注册其 mDNS 名称以加速 ICE 收集。
ICE Agent 1 ICE Agent 2
192.168.1.1 STUN 192.168.1.2
2001:db8::1 Server 2001:db8::2
----------------------------------------------------------------------
预注册 mDNS 名称
| | |
<Register mDNS | | <Register mDNS
name N1.1, | | name N2.1,
192.168.1.1> | | 192.168.1.2>
<Register mDNS | | <Register mDNS
name N1.2, | | name N2.2,
2001:db8::1> | | 2001:db8::2>
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 1 发送 mDNS 候选
| | |
<N1.1> |------- mDNS Candidate C1.1 ----->|
<N1.2> |------- mDNS Candidate C1.2 ----->|
| | | <Resolve mDNS
| | | name N1.1 to
| | | 192.168.1.1>
| | | <Resolve mDNS
| | | name N1.2 to
| | | 2001:db8::1>
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 1 发送服务器反射候选
| | |
<192.168.1.1 |--Binding Req-->| |
is 192.0.2.1> |<-Binding Resp--| |
<192.0.2.1> |------ srflx Candidate C1.3 ----->|
<2001:db8::1 |--Binding Req-->| |
is 2001:db8::1> |<-Binding Resp--| |
<2001:db8::1> |------ srflx Candidate C1.4 ----->| <Discard C1.4
| | | as redundant>
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 2 发送 mDNS 候选,解析缓慢
| | |
|<------ mDNS Candidate C2.1 ------| <N2.1>
|<------ mDNS Candidate C2.2 ------| <N2.2>
<Resolve mDNS | |
name N2.1 ...> | |
<Resolve mDNS | |
name N2.2 ...> | |
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 2 发送服务器反射候选,解析完成
| | |
| |<--Binding Req---| <192.168.1.2
| |---Binding Resp->| is 192.0.2.2>
|<----- srflx Candidate C2.3 ------| <192.0.2.2>
| |<--Binding Req---| <2001:db8::2
| |---Binding Resp->| is 2001:db8::2>
|<----- srflx Candidate C2.4 ------| <2001:db8::2>
| | |
<... N2.1 is | |
192.168.1.2> | |
<... N2.2 is | |
2001:db8::2, | |
discard C2.4> | |
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE 连通性检查
| | |
2001:db8::1 |<============= STUN ==============| 2001:db8::2
2001:db8::1 |============== STUN =============>| 2001:db8::2
192.168.1.1 |<============= STUN ==============| 192.168.1.2
192.168.1.1 |============== STUN =============>| 192.168.1.2
192.0.2.1 | Failed <-- STUN --------------| 192.168.1.2
192.168.1.1 |---------------STUN --> Failed | 192.0.2.2
2001:db8::1 |====== STUN(USE-CANDIDATE) ======>| 2001:db8::2
C1.1: candidate:1 1 udp 2122262783 9b36eaac-bb2e-49bb-bb78-21c41c499900.local 10004 typ host
C1.2: candidate:2 1 udp 2122262527 76c82649-02d6-4030-8aef-a2ba3a9019d5.local 10006 typ host
C1.3: candidate:1 1 udp 1686055167 192.0.2.1 30004 typ srflx raddr 0.0.0.0 rport 0
C1.4: candidate:2 1 udp 1686054911 2001:db8::1 10006 typ srflx raddr 0.0.0.0 rport 0
C2.1: candidate:1 1 udp 2122262783 b977f597-260c-4f70-9ac4-26e69b55f966.local 20004 typ host
C2.2: candidate:2 1 udp 2122262527 ac4595a7-7e42-4e85-85e6-c292abe0e681.local 20006 typ host
C2.3: candidate:1 1 udp 1686055167 192.0.2.2 40004 typ srflx raddr 0.0.0.0 rport 0
C2.4: candidate:2 1 udp 1686054911 2001:db8::2 20006 typ srflx raddr 0.0.0.0 rport 0
7. 安全考量
7.1. mDNS 消息洪泛
本提案的实现需要浏览器的 mDNS 查询能力,用于注册 mDNS 名称或添加带有此类名称的远程 ICE 主机候选。它还需要浏览器或浏览器所在操作平台的 mDNS 响应能力,用于注册、移除或解析 mDNS 名称。具体而言,
- 名称的注册需要可选的探测查询和强制的通告响应([RFC6762] 第 8 节),这在 ICE 收集开始时执行;
- 添加带有 mDNS 名称的远程 ICE 主机候选,会为每个候选的名称生成 mDNS 查询;
- 名称的移除可能在某个实现中 ICE 代理的浏览上下文被销毁时发生,此时应发送 goodbye 响应以使该 ICE 代理在本地网络中生成的记录失效([RFC6762] 第 10.1 节)。
一个恶意的 Web 应用程序可以通过以下方式用 mDNS 消息洪泛本地网络:
- 创建浏览上下文,这些上下文创建 ICE 代理并开始收集本地 ICE 主机候选;
- 在名称注册完成后不久就销毁这些本地候选;
- 添加带有 mDNS 名称的虚构远程 ICE 主机候选。
[RFC6762] 定义了通用的每问题(per-question)和每记录(per-record)多播速率限制规则,其中给定接口上的给定问题或记录自上次传输以来不得在少于 1 秒内发送。然而,这条速率限制规则不能缓解上述攻击,因为在这些攻击中,新的名称(因而新的问题或记录)被不断创建和发送。因此,必须为第 3 节所述的 ICE 候选收集和处理期间派发的所有 mDNS 查询和响应提供一个浏览器级的 mDNS 消息速率限制。浏览器可以实现更具体的速率限制,例如确保单个源不会阻止其他源注册、注销或解析 mDNS 名称。
7.2. 拒绝名称注册的恶意响应
如果为名称注册实现了可选的探测查询,本地网络中的一个能够响应 mDNS 查询的恶意端点可以发送响应来阻止所生成名称的使用。这会导致该 ICE 主机候选按第 3.1 节第 5 步被丢弃。
上述攻击可以通过在注册名称时跳过探测来缓解,这也符合 [RFC6762] 第 8 节,因为该名称在第 3.1 节第 3 步中为概率唯一性而被随机生成(例如版本 4 UUID)。然而,通过利用否定响应([RFC6762] 第 8.1 节所定义,其中发送 NSEC 资源记录来声称与所收集 ICE 主机候选相关的记录不存在),可以实施类似的攻击。
本地网络中恶意端点的存在构成一种通用威胁,需要专门的协议套件来缓解,这超出了本提案的范围。
7.3. 未经请求的 ICE 通信
如 [RTCWebSecurity] 第 4.2 节所述,攻击者可能把 ICE 用作向特定端点发送未经请求的网络流量的一种方式。虽然这并非 mDNS 主机名候选所特有,但该技术使针对具有众所周知 mDNS 名称的设备变得更容易。
此外,同一技术可以被用作一种预言机(oracle),来确定本地网络中某些本地服务是否可达。这些知识可用于指纹识别目的,或作为攻击本地网络的基础。
如第 3.2 节所述,不鼓励 ICE 代理解析不符合第 3.1 节所定义格式的 mDNS 名称,并可进一步约束它们实际会尝试解析的 mDNS 名称。
8. IANA 考量
本文档不需要 IANA 采取任何行动。
9. 参考文献
9.1. 规范性参考文献
[RFC2119] Bradner, S.,"Key words for use in RFCs to Indicate Requirement Levels",BCP 14,RFC 2119,DOI 10.17487/RFC2119,1997 年 3 月。
[RFC4122] Leach, P., Mealling, M. 与 R. Salz,"A Universally Unique IDentifier (UUID) URN Namespace",RFC 4122,DOI 10.17487/RFC4122,2005 年 7 月。
[RFC4941] Narten, T., Draves, R. 与 S. Krishnan,"Privacy Extensions for Stateless Address Autoconfiguration in IPv6",RFC 4941,DOI 10.17487/RFC4941,2007 年 9 月。
[RFC5389] Rosenberg, J., Mahy, R., Matthews, P. 与 D. Wing,"Session Traversal Utilities for NAT (STUN)",RFC 5389,DOI 10.17487/RFC5389,2008 年 10 月。
[RFC5766] Mahy, R., Matthews, P. 与 J. Rosenberg,"Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)",RFC 5766,DOI 10.17487/RFC5766,2010 年 4 月。
[RFC6762] Cheshire, S. 与 M. Krochmal,"Multicast DNS",RFC 6762,DOI 10.17487/RFC6762,2013 年 2 月。
[RFC8445] Keranen, A., Holmberg, C. 与 J. Rosenberg,"Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal",RFC 8445,DOI 10.17487/RFC8445,2018 年 7 月。
9.2. 资料性参考文献
[HTMLSpec] "HTML Living Standard",n.d.。
[ICESDP] Keranen, A.,"Session Description Protocol (SDP) Offer/Answer procedures for Interactive Connectivity Establishment (ICE)",2018 年 4 月。
[IPHandling] Shieh, G.,"WebRTC IP Address Handling Requirements",2018 年 4 月。
[JSEP] Rescorla, Ed, E.,"JavaScript Session Establishment Protocol",2019 年 2 月。
[Overview] Alvestrand, H.,"Overview: Real Time Protocols for Browser-based Applications",2017 年 11 月。
[RFC1918] Rekhter, Y., Moskowitz, B., Karrenberg, D., de Groot, G. 与 E. Lear,"Address Allocation for Private Internets",BCP 5,RFC 1918,DOI 10.17487/RFC1918,1996 年 2 月。
[RFC6146] Bagnulo, M., Matthews, P. 与 I. van Beijnum,"Stateful NAT64: Network Address and Protocol Translation from IPv6 Clients to IPv4 Servers",RFC 6146,DOI 10.17487/RFC6146,2011 年 4 月。
[RTCWebSecurity] Rescorla, E.,"Security Considerations for WebRTC",2018 年 1 月。
[WebRTCSpec] Bruaroey, J.,"The WebRTC specification",n.d.。
[WebRTCStats] Boström, H.,"Identifiers for WebRTC's Statistics API",n.d.。
作者地址
Youenn Fablet
Apple Inc.
EMail: youenn@apple.com
Jeroen de Borst
Google
EMail: jeroendb@google.com
Justin Uberti
Google
EMail: juberti@google.com
Qingsi Wang
Google
EMail: qingsi@google.com
MMUSIC
Y. Fablet
Internet-Draft
Apple Inc.
Updates: 8839 (if approved)
J. de Borst
Intended status: Informational
J. Uberti
Expires: July 12, 2021
Q. Wang
January 08, 2021
Using Multicast DNS to protect privacy when exposing ICE candidates
draft-ietf-mmusic-mdns-ice-candidates-latest
Abstract
WebRTC applications collect ICE candidates as part of the process of creating peer-to-peer connections. To maximize the probability of a direct peer-to-peer connection, client private IP addresses are included in this candidate collection. However, disclosure of these addresses has privacy implications. This document describes a way to share local IP addresses with other clients while preserving client privacy. This is achieved by concealing IP addresses with dynamically generated Multicast DNS (mDNS) names.
Status of This Memo
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on July 12, 2021.
Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
- 3.1. ICE Candidate Gathering
- 3.1.2. Implementation Guidance
- 3.2. ICE Candidate Processing
- 3.2.2. Implementation Guidance
- 3.3. Additional Privacy Considerations
- 3.3.2. Interactions With TURN Servers
- 3.3.3. Generated Name Reuse
- 3.3.4. Specific Browsing Contexts
- 3.3.5. Network Interface Enumeration
- 3.3.6. Monitoring of Sessions
- 5.1. Reduced Connectivity
- 5.2. Connection Setup Latency
- 5.3. Backward Compatibility
- 6.2. Peer-reflexive Candidate From Slow Signaling
- 6.3. Peer-reflexive Candidate From Slow Resolution
- 6.4. IPv4, IPv6, and STUN handling
- 7. Security Considerations
- 7.1. mDNS Message Flooding
- 7.2. Malicious Responses to Deny Name Registration
- 7.3. Unsolicited ICE Communications
- 9.1. Normative References
- 9.2. Informative References
1. Introduction
As detailed in [IPHandling], exposing client private IP addresses by default to web applications maximizes the probability of successfully creating direct peer-to-peer connections between clients, but creates a significant surface for user fingerprinting. [IPHandling] recognizes this issue, but also admits that there is no current solution to this problem; implementations that choose to use Mode 3 to address the privacy concerns often suffer from failing or suboptimal connections in WebRTC applications. This is particularly an issue on unmanaged networks, typically homes or small offices, where NAT loopback may not be supported.
This document proposes an overall solution to this problem by extending [ICESDP] to allow ICE implementations to register ephemeral mDNS [RFC6762] names for local private IP addresses, and then provide those names, rather than the IP addresses, in their ICE candidates. While this technique is intended to benefit WebRTC implementations in web browsers, by preventing collection of private IP addresses by arbitrary web pages, it can also be used by any endpoint that wants to avoid disclosing information about its local network to remote peers on other networks.
WebRTC and WebRTC-compatible endpoints [Overview] that receive ICE candidates with mDNS names will resolve these names to IP addresses and perform ICE processing as usual. In the case where the endpoint is a web application, the WebRTC implementation will manage this resolution internally and will not disclose the actual IP addresses to the application.
2. Terminology
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119].
3. Description
This section uses the concept of ICE agent as defined in [RFC8445]. In the remainder of the document, it is assumed that each browsing context (as defined in Section 7.1 of [HTMLSpec]) has its own ICE agent.
3.1. ICE Candidate Gathering
This section outlines how mDNS should be used by ICE agents to conceal local IP addresses.
3.1.1. Procedure
For each host candidate gathered by an ICE agent as part of the gathering process described in [RFC8445], Section 5.1.1, the candidate is handled as described below.
- Check whether this IP address satisfies the ICE agent’s policy regarding whether an address is safe to expose. If so, expose the candidate and abort this process.
- Check whether the ICE agent has previously generated, registered, and stored an mDNS hostname for this IP address as per steps 3 to 5. If it has, skip ahead to step 6.
- Generate a unique mDNS hostname. The unique name MUST consist of a version 4 UUID as defined in [RFC4122], followed by “.local”.
- Register the candidate’s mDNS hostname as defined in [RFC6762]. The ICE agent SHOULD send an mDNS announcement for the hostname, but as the hostname is expected to be unique, the ICE agent SHOULD skip probing of the hostname.
- Store the mDNS hostname and its related IP address in the ICE agent for future reuse.
- Replace the IP address of the ICE candidate with its mDNS hostname and provide the candidate to the web application.
ICE agents can implement this procedure in any way as long as it produces equivalent results. An implementation may for instance pre-register mDNS hostnames by executing steps 3 to 5 and prepopulate an ICE agent accordingly. By doing so, only step 6 of the above procedure will be executed at the time of gathering candidates.
In order to prevent web applications from using this mechanism to query for mDNS support in the local network, the ICE agent SHOULD still provide mDNS candidates in step 6 even if the local network does not support mDNS or mDNS registration fails in step 4.
This procedure ensures that an mDNS name is used to replace only one IP address. Specifically, an ICE agent using an interface with both IPv4 and IPv6 addresses MUST expose a different mDNS name for each address.
3.1.2. Implementation Guidance
3.1.2.1. Registration
Sending the mDNS announcement to the network can be delayed, for instance due to rate limits. An ICE agent SHOULD provide the candidate to the web application as soon as its mDNS name is generated, regardless of whether the announcement has been sent on the network.
3.1.2.2. Determining Address Privacy and Server-Reflexive Candidates
Naturally, an address that is already exposed to the Internet does not need to be protected by mDNS, as it can be trivially observed by the web server or remote endpoint. However, determining this ahead of time is not straightforward; while the fact that an IPv4 address is private can sometimes be inferred by its value, e.g., whether it is an [RFC1918] address, the reverse is not necessarily true. IPv6 addresses present their own complications, e.g., private IPv6 addresses as a result of NAT64 [RFC6146].
Instead, the determination of whether an address is public can be reliably made as part of the ICE gathering process. For each mDNS host candidate generated according the guidance above, the usual STUN [RFC5389] request is sent to a STUN server. This can be done for both IPv4 and IPv6 local addresses, provided that the application has configured both IPv4 and IPv6 STUN servers. If the STUN response returns the same value as the local IP address, this indicates the address is in fact public.
Regardless of the result, a server-reflexive candidate will be generated; the transport address of this candidate is an IP address and therefore distinct from the hostname transport address of the associated mDNS candidate, and as such MUST NOT be considered redundant per the guidance in [RFC8445], Section 5.1.3. To avoid accidental IP address disclosure, this server-reflexive candidate MUST have its raddr field set to “0.0.0.0”/”::” and its rport field set to “9”, as discussed in [ICESDP], Section 9.1.
Once an address has been identified as public, the ICE agent MAY cache this information and omit mDNS protection for that address in future ICE gathering phases.
3.1.2.3. Special Handling for IPv6 Addresses
As noted in [IPHandling], private IPv4 addresses are especially problematic because of their unbounded lifetime. However, the [RFC4941] IPv6 addresses recommended for WebRTC have inherent privacy protections, namely a short lifetime and the lack of any stateful information. Accordingly, implementations MAY choose to not conceal [RFC4941] addresses with mDNS names as a tradeoff for improved peer-to-peer connectivity.
3.1.2.4. mDNS Candidate Encoding
The mDNS name of an mDNS candidate MUST be used in the connection-address field of its candidate attribute. However, when an mDNS candidate would be the default candidate, typically because there are no other candidates, its mDNS name MUST NOT be used in the connection-address field of the SDP “c=” line, as experimental deployment has indicated that many remote endpoints will fail to handle such a SDP. In this situation, the IP address values “0.0.0.0”/”::” and port value “9” MUST instead be used in the c= and m= lines, similar to how the no-candidates case is handled in [ICESDP], Section 4.3.1.
Any candidates exposed to the application via local descriptions MUST be identical to those provided during candidate gathering (i.e., MUST NOT contain private host IP addresses).
3.2. ICE Candidate Processing
This section outlines how received ICE candidates with mDNS names are processed by ICE agents, and is relevant to all endpoints.
3.2.1. Procedure
For any remote ICE candidate received by the ICE agent, the following procedure is used:
- If the connection-address field value of the ICE candidate does not end with “.local” or if the value contains more than one “.”, then process the candidate as defined in [RFC8445].
- If the ICE candidate policy is “relay”, as defined in [JSEP], ignore the candidate.
- Otherwise, resolve the candidate using mDNS. The ICE agent SHOULD set the unicast-response bit of the corresponding mDNS query message; this minimizes multicast traffic, as the response is probably only useful to the querying node.
- If it resolves to an IP address, replace the mDNS hostname of the ICE candidate with the resolved IP address and continue processing of the candidate as defined in [RFC8445].
- Otherwise, ignore the candidate.
3.2.2. Implementation Guidance
An ICE agent may use a hostname resolver that transparently supports both Multicast and Unicast DNS. In this case the resolution of a “.local” name may happen through Unicast DNS as noted in [RFC6762], Section 3.
An ICE agent SHOULD ignore candidates where the hostname resolution returns more than one IP address.
An ICE agent MAY add additional restrictions regarding the ICE candidates it will resolve using mDNS, as this mechanism allows attackers to send ICE traffic to devices with well-known mDNS names. In particular, ICE agents SHOULD NOT resolve mDNS names if they are not in the format defined by Section 3.1.
3.3. Additional Privacy Considerations
The goal of this mechanism is to keep knowledge of private host IP addresses within the ICE agent while continuing to allow the application to transmit ICE candidates. Besides keeping private host IP addresses out of ICE candidates, implementations must take steps to prevent these IP addresses from being exposed to web applications through other means.
3.3.1. Statistics
Statistics related to ICE candidates that are accessible to the web application MUST NOT contain the IP address of a local or remote mDNS candidate; the mDNS name SHOULD be used instead.
Statistics SHOULD NOT leak whether the mDNS resolution succeeds or fails. For that reason, RTCIceCandidateStats objects as defined in [WebRTCStats] SHOULD be generated for any remote mDNS candidate submitted to the ICE agent, even if the mDNS candidate is ignored as part of Section 3.2. An implementation strategy to obfuscate the address of an mDNS candidate in the statistics, regardless if it is resolved or not, is to replace the mDNS hostname of the ICE candidate with IP values “0.0.0.0” or “::”.
In addition, a peer-reflexive remote candidate may be constructed from a remote host IP address as a result of an ICE connectivity check, as described in Section 7.3.1.3 of [RFC8445]. This check may arrive before the candidate due to signaling or mDNS resolution delays, as shown in the examples above.
To prevent disclosure of the host IP address to the application in this scenario, statistics related to ICE candidates MUST NOT contain the IP address of any peer-reflexive candidate, unless that IP has already been learned through signaling of a candidate with the same address and either the same or a different port; this includes cases where the signaled candidate is discarded as redundant according to Section 5.1.3 of [RFC8445].
3.3.2. Interactions With TURN Servers
When sending data to a TURN [RFC5766] server, the sending client tells the server the destination IP and port for the data. This means that if the client uses TURN to send to an IP that was obtained by mDNS resolution, the TURN server will learn the underlying host IP and port, and this information can then be relayed to the web application, defeating the value of the mDNS wrapping.
To prevent disclosure of the host IP address to a TURN server, the ICE agent MUST NOT form candidate pairs between its own relay candidates and remote mDNS candidates. This restriction applies to all remote mDNS candidate types, not just host candidates; mDNS candidates can be clearly identified from their connection-address fields. Note also that the converse is not an issue; the ICE agent MAY form candidate pairs between its own mDNS candidates and remote relay candidates, as in this situation host IPs will not be sent directly to the TURN server.
This restriction has no effect on connectivity; in the cases where host IP addresses are private and need to be wrapped with mDNS names, they will be unreachable from the TURN server, and as noted above, the reverse path will continue to work normally.
3.3.3. Generated Name Reuse
It is important that use of registered mDNS hostnames is limited in time and/or scope. Indefinitely reusing the same mDNS hostname candidate would provide applications an even more reliable tracking mechanism than the private IP addresses that this specification is designed to hide. In the case of a web application, the use of registered mDNS hostnames SHOULD be scoped by the web application origin, and SHOULD have the lifetime of the page executing the web application.
3.3.4. Specific Browsing Contexts
As noted in [IPHandling], privacy may be breached if a web application running in two browsing contexts can determine whether it is running on the same device. While the approach in this document prevents the application from directly comparing local private IP addresses, a successful local WebRTC connection can also present a threat to user privacy. Specifically, when the latency of a WebRTC connection latency is close to zero, the probability is high that the two peers are running on the same device.
To avoid this issue, browsers SHOULD NOT register mDNS names for WebRTC applications running in a third-party browsing context (i.e., a context that has a different origin than the top-level browsing context), or a private browsing context.
3.3.5. Network Interface Enumeration
Even when local IP addresses are not exposed, the number of mDNS hostname candidates can still provide a fingerprinting dimension. This is in particular the case for network interfaces with limited connectivity that will not generate server-reflexive or relay candidates.
The more mDNS names an endpoint exposes through mDNS hostname candidates, the higher the fingerprinting risk. One countermeasure is to limit this number to a small value.
Note that no additional fingerprinting risk is introduced when restricting mDNS hostname candidates to default route only.
3.3.6. Monitoring of Sessions
A malicious endpoint in the local network may also record other endpoints who are registering, unregistering, and resolving mDNS names. By doing so, they can create a session log that shows which endpoints are communicating, and for how long. If both endpoints in the session are on the same network, the fact they are communicating can be discovered.
Mitigation of this threat is beyond the scope of this proposal.
4. Update to RFC 8839
Section 5.1 of [ICESDP] states:
- An agent generating local candidates MUST NOT use FQDN addresses. An agent processing remote candidates MUST ignore candidate lines that include candidates with FQDN or IP address versions that are not supported or recognized.
This document extends [ICESDP] to specifically allow the generation and processing of ICE candidates with the “.local” FQDNs defined in {gathering}. The restrictions on other FQDNs are unaffected.
5. Potential Limitations
5.1. Reduced Connectivity
With typical ICE, endpoints on the same network will usually be able to establish a direct connection between their local IP addresses. When using the mDNS technique, a direct connection is still possible, but only if at least one side can properly resolve the provided mDNS candidates. This may not be possible in all scenarios.
First, some networks may entirely disable mDNS. Second, mDNS queries have limited scope. On large networks, this may mean that an mDNS name cannot be resolved if the remote endpoint is too many segments away.
When mDNS fails, ICE will attempt to fall back to either NAT hairpin, if supported, or TURN relay if not. This may result in reduced connectivity, reduced throughput and increased latency, as well as increased cost in case of TURN relay.
During experimental testing of the mDNS technique across a set of known mDNS-aware endpoints that had configured a STUN server but not a TURN server, the observed impact to ICE connection rate was 2% (relative) when mDNS was enabled on both sides, compared to when mDNS was only enabled on one side. In this testing, the percentage of connections that required STUN (i.e., went through a NAT) increased from 94% to 97%, indicating that mDNS succeeded about half the time, and fell back to NAT hairpin for the remainder. The most likely explanation for the overall connection rate drop is that hairpinning failed in some cases.
One potential mitigation, as discussed in Section 3.3, is to not conceal candidates created from [RFC4941] IPv6 addresses. This permits connectivity even in large internal networks or where mDNS is disabled. Future versions of this document will include experimental data regarding this option.
5.2. Connection Setup Latency
As noted in Section 3, ICE agents using the mDNS technique are responsible for registering and resolving mDNS names as part of the ICE process. These steps may delay establishment of a direct peer-to-peer connection, compared to when raw local IP addresses are used.
Given that these mDNS registrations and queries are typically occurring on a local network, any associated delays should be small. Also, as noted in Section 3.1, pre-registration can be employed to eliminate gathering delays entirely.
5.3. Backward Compatibility
For the most part, backward compatibility does not present a significant issue for the mDNS technique. When an endpoint that supports mDNS communicates with an endpoint that does not, the legacy endpoint will still provide its local IP addresses, and accordingly a direct connection can still be attempted, even though the legacy endpoint cannot resolve the mDNS names provided by the new endpoint. In the event the legacy endpoint attempts to resolve mDNS names using Unicast DNS, this may cause ICE to take somewhat longer to fully complete, but should not have any effect on connectivity or connection setup time.
However, some legacy endpoints are not fully spec-compliant and can behave unpredictably in the presence of ICE candidates that contain a hostname, potentially leading to ICE failure. Some endpoints may also fail to handle a connectivity check from an address that they have not received in signaling. During the aforementioned experimental testing, the connection rate when interacting with endpoints that provided raw IP addresses (and therefore should be unaffected) decreased by 3% (relative), presumably for these reasons.
6. Examples
The examples below show how the mDNS technique is used during ICE processing. The first example shows a simple case, the next two examples demonstrate how peer-reflexive candidates for local IP addresses can be created due to timing differences, and the final example shows a real-world case with IPv4, IPv6, and STUN.
6.1. Normal Handling
In this example, mDNS candidates are exchanged between peers and resolved normally to obtain the corresponding IP addresses.
ICE Agent 1 (192.0.2.1) ICE Agent 2 (192.0.2.2)
<Register mDNS | |
name N1, | |
192.0.2.1> | |
|------- mDNS Candidate N1 ------>|
| | <Register mDNS
| | name N2,
| | 192.0.2.2>
|<------ mDNS Candidate N2 -------|
<Resolve | | <Resolve
mDNS name N2> | | mDNS name N1>
|<=== STUN check to 192.0.2.1 ====|
|==== STUN check to 192.0.2.2 ===>|
| |
The exchange of ICE candidates relies on out-of-band signaling, for example, the SDP Offer/Answer procedure defined in [ICESDP]. In the above example, the candidate attributes in the SDP messages to exchange the mDNS candidates between ICE Agent 1 and 2 are as follows:
a=candidate:1 1 udp 2122262783 1f4712db-ea17-4bcf-a596-105139dfd8bf.local
54596 typ host
a=candidate:1 1 udp 2122262783 2579ef4b-50ae-4bfe-95af-70b3376ecb9c.local
61606 typ host
6.2. Peer-reflexive Candidate From Slow Signaling
In this example, a peer-reflexive candidate is generated because the mDNS candidate is signaled after the STUN checks begin.
ICE Agent 1 (192.0.2.1) ICE Agent 2 (192.0.2.2)
<Register mDNS | |
name N1, | |
192.0.2.1> | |
|------- mDNS Candidate N1 ------>|
| | <Resolve
| | mDNS name N1>
|<=== STUN check to 192.0.2.1 ====|
prflx candidate | | <Register mDNS
192.0.2.2 created | | name N2,
| | 192.0.2.2>
|<------ mDNS Candidate N2 -------|
| |
6.3. Peer-reflexive Candidate From Slow Resolution
In this example, a peer-reflexive candidate is generated because the mDNS resolution for name N2 does not complete until after the STUN checks are received.
ICE Agent 1 (192.0.2.1) ICE Agent 2 (192.0.2.2)
<Register mDNS | | <Register mDNS
name N1, | | name N2,
192.0.2.1> | | 192.0.2.2>
|------- mDNS Candidate N1 ------>|
|<------ mDNS Candidate N2 -------|
<Resolve | | <Resolve
mDNS | | mDNS name N1>
. |<=== STUN check to 192.0.2.1 ====|
. prflx candidate | |
. 192.0.2.2 created | |
name | |
N2> | |
6.4. IPv4, IPv6, and STUN handling
This last example demonstrates the overall ICE gathering process for two endpoints, each with a private IPv4 address and a public IPv6 address. They preregister their mDNS names to speed up ICE gathering.
ICE Agent 1 ICE Agent 2
192.168.1.1 STUN 192.168.1.2
2001:db8::1 Server 2001:db8::2
----------------------------------------------------------------------
Pre-registration of mDNS names
| | |
<Register mDNS | | | <Register mDNS
name N1.1, | | | name N2.1,
192.168.1.1> | | | 192.168.1.2>
<Register mDNS | | | <Register mDNS
name N1.2, | | | name N2.2,
2001:db8::1> | | | 2001:db8::2>
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 1 sends mDNS candidates
| | |
<N1.1> |------- mDNS Candidate C1.1 ----->|
<N1.2> |------- mDNS Candidate C1.2 ----->|
| | | <Resolve mDNS
| | | name N1.1 to
| | | 192.168.1.1>
| | | <Resolve mDNS
| | | name N1.2 to
| | | 2001:db8::1>
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 1 sends server-reflexive candidates
| | |
<192.168.1.1 |--Binding Req-->| |
is 192.0.2.1> |<-Binding Resp--| |
<192.0.2.1> |------ srflx Candidate C1.3 ----->|
<2001:db8::1 |--Binding Req-->| |
is 2001:db8::1> |<-Binding Resp--| |
<2001:db8::1> |------ srflx Candidate C1.4 ----->| <Discard C1.4
| | | as redundant>
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 2 sends mDNS candidates, resolution is slow
| | |
|<------ mDNS Candidate C2.1 ------| <N2.1>
|<------ mDNS Candidate C2.2 ------| <N2.2>
<Resolve mDNS | | |
name N2.1 ...> | | |
<Resolve mDNS | | |
name N2.2 ...> | | |
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE Agent 2 sends server-reflexive candidates, resolution completes
| | |
| |<--Binding Req---| <192.168.1.2
| |---Binding Resp->| is 192.0.2.2>
|<----- srflx Candidate C2.3 ------| <192.0.2.2>
| |<--Binding Req---| <2001:db8::2
| |---Binding Resp->| is 2001:db8::2>
|<----- srflx Candidate C2.4 ------| <2001:db8::2>
| | |
<... N2.1 is | | |
192.168.1.2> | | |
<... N2.2 is | | |
2001:db8::2, | | |
discard C2.4> | | |
| | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ICE connectivity checks
| | |
2001:db8::1 |<============= STUN ==============| 2001:db8::2
2001:db8::1 |============== STUN =============>| 2001:db8::2
192.168.1.1 |<============= STUN ==============| 192.168.1.2
192.168.1.1 |============== STUN =============>| 192.168.1.2
192.0.2.1 | Failed <-- STUN --------------| 192.168.1.2
192.168.1.1 |---------------STUN --> Failed | 192.0.2.2
2001:db8::1 |====== STUN(USE-CANDIDATE) ======>| 2001:db8::2
C1.1: candidate:1 1 udp 2122262783 9b36eaac-bb2e-49bb-bb78-
21c41c499900.local 10004 typ host
C1.2: candidate:2 1 udp 2122262527 76c82649-02d6-4030-8aef-
a2ba3a9019d5.local 10006 typ host
C1.3: candidate:1 1 udp 1686055167 192.0.2.1
30004 typ srflx raddr 0.0.0.0 rport 0
C1.4: candidate:2 1 udp 1686054911 2001:db8::1
10006 typ srflx raddr 0.0.0.0 rport 0
C2.1: candidate:1 1 udp 2122262783 b977f597-260c-4f70-9ac4-
26e69b55f966.local 20004 typ host
C2.2: candidate:2 1 udp 2122262527 ac4595a7-7e42-4e85-85e6-
c292abe0e681.local 20006 typ host
C2.3: candidate:1 1 udp 1686055167 192.0.2.2
40004 typ srflx raddr 0.0.0.0 rport 0
C2.4: candidate:2 1 udp 1686054911 2001:db8::2
20006 typ srflx raddr 0.0.0.0 rport 0
7. Security Considerations
7.1. mDNS Message Flooding
The implementation of this proposal requires the mDNS querying capability of the browser for registering mDNS names or adding remote ICE host candidates with such names. It also requires the mDNS responding capability of either the browser or the operating platform of the browser for registering, removing or resolving mDNS names. In particular,
- the registration of name requires optional probing queries and mandatory announcing responses ([RFC6762], Section 8), and this is performed at the beginning of ICE gathering;
- the addition of remote ICE host candidates with mDNS names generates mDNS queries for names of each candidate;
- the removal of names could happen when the browsing context of the ICE agent is destroyed in an implementation, and goodbye responses should be sent to invalidate records generated by the ICE agent in the local network ([RFC6762], Section 10.1).
A malicious Web application could flood the local network with mDNS messages by:
- creating browsing contexts that create ICE agents and start gathering of local ICE host candidates;
- destroying these local candidates soon after the name registration is done;
- adding fictitious remote ICE host candidates with mDNS names.
[RFC6762] defines a general per-question and per-record multicast rate limiting rule, in which a given question or record on a given interface cannot be sent less than one second since its last transmission. This rate limiting rule however does not mitigate the above attacks, in which new names, hence new questions or records, are constantly created and sent. Therefore, a browser-wide mDNS message rate limit MUST be provided for all mDNS queries and responses that are dispatched during the ICE candidate gathering and processing described in Section 3. A browser MAY implement more specific rate limits, e.g., to ensure a single origin does not prevent other origins from registering, unregistering, or resolving mDNS names.
7.2. Malicious Responses to Deny Name Registration
If the optional probing queries are implemented for the name registration, a malicious endpoint in the local network, which is capable of responding mDNS queries, could send responses to block the use of the generated names. This would lead to the discarding of this ICE host candidate as in Step 5 in Section 3.1.
The above attack can be mitigated by skipping the probing when registering a name, which also conforms to Section 8 in [RFC6762], given that the name is randomly generated for the probabilistic uniqueness (e.g. a version 4 UUID) in Step 3 in Section 3.1. However, a similar attack can be performed by exploiting the negative responses (defined in [RFC6762], Section 8.1), in which NSEC resource records are sent to claim the nonexistence of records related to the gathered ICE host candidates.
The existence of malicious endpoints in the local network poses a generic threat, and requires dedicated protocol suites to mitigate, which is beyond the scope of this proposal.
7.3. Unsolicited ICE Communications
As noted in Section 4.2 of [RTCWebSecurity], an attacker may use ICE as a way to send unsolicited network traffic to specific endpoints. While this is not specific to mDNS hostname candidates, this technique makes it easier to target devices with well-known mDNS names.
Also, the same technique can be used as an oracle to determine whether some local services are reachable in the local network. This knowledge can be used for fingerprinting purposes or as a basis for attacking local networks.
As noted in Section 3.2, ICE agents are discouraged to resolve mDNS names that are not in the format defined by Section 3.1 and may further constrain the mDNS names they will actually try to resolve.
8. IANA Considerations
This document requires no actions from IANA.
9. References
9.1. Normative References
[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997.
[RFC4122]
Leach, P., Mealling, M. and R. Salz, "A Universally Unique IDentifier (UUID) URN Namespace", RFC 4122, DOI 10.17487/RFC4122, July 2005.
[RFC4941]
Narten, T., Draves, R. and S. Krishnan, "Privacy Extensions for Stateless Address Autoconfiguration in IPv6", RFC 4941, DOI 10.17487/RFC4941, September 2007.
[RFC5389]
Rosenberg, J., Mahy, R., Matthews, P. and D. Wing, "Session Traversal Utilities for NAT (STUN)", RFC 5389, DOI 10.17487/RFC5389, October 2008.
[RFC5766]
Mahy, R., Matthews, P. and J. Rosenberg, "Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)", RFC 5766, DOI 10.17487/RFC5766, April 2010.
[RFC6762]
Cheshire, S. and M. Krochmal, "Multicast DNS", RFC 6762, DOI 10.17487/RFC6762, February 2013.
[RFC8445]
Keranen, A., Holmberg, C. and J. Rosenberg, "Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal", RFC 8445, DOI 10.17487/RFC8445, July 2018.
9.2. Informative References
[HTMLSpec]
"HTML Living Standard", n.d..
[ICESDP]
Keranen, A., "Session Description Protocol (SDP) Offer/Answer procedures for Interactive Connectivity Establishment (ICE)", April 2018.
[IPHandling]
Shieh, G., "WebRTC IP Address Handling Requirements", April 2018.
[JSEP]
Rescorla, Ed, E., "JavaScript Session Establishment Protocol", February 2019.
[Overview]
Alvestrand, H., "Overview: Real Time Protocols for Browser-based Applications", November 2017.
[RFC1918]
Rekhter, Y., Moskowitz, B., Karrenberg, D., de Groot, G. and E. Lear, "Address Allocation for Private Internets", BCP 5, RFC 1918, DOI 10.17487/RFC1918, February 1996.
[RFC6146]
Bagnulo, M., Matthews, P. and I. van Beijnum, "Stateful NAT64: Network Address and Protocol Translation from IPv6 Clients to IPv4 Servers", RFC 6146, DOI 10.17487/RFC6146, April 2011.
[RTCWebSecurity]
Rescorla, E., "Security Considerations for WebRTC", January 2018.
[WebRTCSpec]
Bruaroey, J., "The WebRTC specification", n.d..
[WebRTCStats]
Boström, H., "Identifiers for WebRTC's Statistics API", n.d..
Authors' Addresses
Youenn Fablet
Fablet
Apple Inc.
EMail: youenn@apple.com
Jeroen de Borst
de Borst
EMail: jeroendb@google.com
Justin Uberti
Uberti
EMail: juberti@google.com
Qingsi Wang
Wang
EMail: qingsi@google.com