DNS 流量可能会泄漏到 Android 上的 VPN 隧道之外
DNS traffic can leak outside the VPN tunnel on Android

原始链接: https://mullvad.net/en/blog/dns-traffic-can-leak-outside-the-vpn-tunnel-on-android

2024 年 4 月下旬,影响某些 Android 设备上 DNS 查询的隐私问题曝光。该问题源于 Android 本身的错误,并影响特定应用程序。 该团队发现了一份用户报告,详细说明了禁用虚拟专用网络 (VPN),然后启用“阻止没有 VPN 的连接”时发生的 DNS 泄漏。 经过调查,发现了几种导致 DNS 泄漏的场景: 1. 当VPN缺少配置的DNS服务器时。 2. VPN 应用程序调整其隧道设置或崩溃的短暂时期。 这些实例似乎涉及直接调用“getaddrinfo”系统调用,从而导致 DNS 泄漏。 利用这种方法进行域解析的应用程序(例如 Chrome 浏览器)已经证明了这些漏洞。 尽管有这些发现,但仅使用 Android API 的应用程序(例如 DnsResolver)尚未观察到泄漏。 尽管已经实施了一些解决方法,但这些问题仍然超出了单个应用程序的控制范围。 该团队建议从根源(操作系统)解决这些问题,以确保所有 Android 用户的安全,无论他们使用什么应用程序。 要重现该问题,请使用 WireGuard 应用程序和 Chrome 按照以下步骤操作: 1. 在您的 Android 设备上安装 WireGuard 和 Chrome。 2. 设置WireGuard 隧道并启用VPN 权限。 3. 在系统设置中为 WireGuard 激活永远在线 VPN 和“阻止没有 VPN 的连接”。 4. 使用 tcpdump 等工具捕获网络上的数据。 5. 打开Chrome并通过浏览器访问网页,同时在不同的WireGuard隧道之间切换。 尽管 VPN 正在积极使用,但仍观察退出设备的纯文本 DNS 请求。 这些观察结果凸显了对隐私影响的重大担忧,并强调了保持应用程序更新的重要性。

Mulvad 是一家总部位于瑞典的虚拟专用网络 (VPN) 提供商,以其对隐私和透明度的坚定承诺而闻名。 尽管作者没有亲自使用 Mulvad 的服务,但他还是很欣赏 Mullvad。 他们赞扬 Mulvad 通过短期解决方案解决隐私问题,并倡导在 Android 平台中进行必要的修复。 Mulvad 的广告,包括广告牌和博客,旨在传播意识并吸引非技术人员采取行动,实现更加私有化的数字环境。 虽然有些人认为传统广告具有侵入性,但另一些人则认识到它对于接触更广泛的受众以及在线上和线下环境中围绕元数据隐私产生讨论的重要性。 总体而言,Mullvad 对数据最小化、详尽的文档记录和公开审计的奉献精神使其成为行业的开拓者。
相关文章

原文

Privacy App 

We were recently made aware of multiple potential DNS leaks on Android. They stem from bugs in Android itself, and only affect certain apps.

On Monday 22 of April we became aware of a user report on Reddit of a DNS leak. The report detailed how the user managed to leak DNS queries when disabling and enabling VPN while having “Block connections without VPN” on. We immediately started an internal investigation that could confirm the issue. The investigation also led to more findings of scenarios that can cause DNS leaks on Android.

Findings

Identified scenarios where the Android OS can leak DNS traffic:

  • If a VPN is active without any DNS server configured.
  • For a short period of time while a VPN app is re-configuring the tunnel or is being force stopped/crashes.

The leaks seem to be limited to direct calls to the C function getaddrinfo. Apps that use this way to resolve domain names cause leaks in the scenarios listed above. We have not found any leaks from apps that only use Android API:s such as DnsResolver. The Chrome browser is an example of an app that can use getaddrinfo directly.

The above applies regardless of whether Always-on VPN and Block connections without VPN is enabled or not, which is not expected OS behavior and should therefore be fixed upstream in the OS.

We’ve been able to confirm that these leaks occur in multiple versions of Android, including the latest version (Android 14).

Improvements

Our app currently does not set any DNS server in its blocking state. When our app fails to set up a tunnel in a way that is not recoverable, it enters the blocking state. In this state it stops traffic from leaving the device. However, it does not set any DNS server in this state, and as a result the above described DNS leaks can happen. We will work around the OS bug by setting a bogus DNS server for now. You can expect a release with this fix soon.

The leak during tunnel reconnects is harder for us to mitigate in our app. We are still looking for solutions. We can potentially minimize the amount of times a tunnel re-configuration happens, but we currently don’t think this leak can be fully prevented.

It should be made clear that these workarounds should not be needed in any VPN app. Nor is it wrong for an app to use getaddrinfo to resolve domain names. Instead, these issues should be addressed in the OS in order to protect all Android users regardless of which apps they use.

We have reported the issues and suggested improvements to Google and hope that they will address this quickly.

Steps to reproduce

The following steps reproduce the second scenario above, where a VPN user changes the tunnel configuration, e.g. switching to another server or changing DNS server.

Here we use the WireGuard app since it has become a reference Android VPN implementation. It should be noted that the leaks can probably be reproduced with any other Android VPN app also. We use Chrome to trigger the leaks since it is one of the apps we have confirmed uses getaddrinfo.

  1. Download spam_get_requests.html
  2. Install the WireGuard app & Chrome
  3. Import wg1.conf, wg2.conf into WireGuard
  4. Enable the wg1 tunnel in the WireGuard app and allow the VPN permission
  5. In Android VPN Settings enable “Always-on VPN” & “Block connections without VPN” for WireGuard
  6. Start capturing data on your router by using e.g tcpdump
    $ tcpdump -i <INTERFACE> host <IP of android device>
  7. Split the screen to show both WireGuard & Chrome side by side
  8. Open spam_get_requests.html with Chrome & press “Start”
  9. Toggle back and fourth between wg1 and wg2 in the WireGuard app until you see the leaks in the next step.
  10. Observe DNS traffic similar to this on the router:
    11:50:27.816359 IP Pixel-Tablet.lan.53353 > OpenWrt.lan.53: 11200+ A? 307lf5rgn6-19282-11-50-27-519z.mullvad.test.lan. (65)
    11:50:27.816359 IP Pixel-Tablet.lan.48267 > OpenWrt.lan.53: 44347+ A? 307lf5rgn6-19284-11-50-27-579z.mullvad.test.lan. (65)
    11:50:27.816396 IP Pixel-Tablet.lan.16747 > OpenWrt.lan.53: 44584+ A? 307lf5rgn6-19289-11-50-27-729z.mullvad.test. (61)
    11:50:27.816458 IP OpenWrt.lan.53 > Pixel-Tablet.lan.53353: 11200 NXDomain 0/0/0 (65)
    11:50:27.816476 IP Pixel-Tablet.lan.45727 > OpenWrt.lan.53: 40503+ A? 307lf5rgn6-19290-11-50-27-759z.mullvad.test. (61)
    11:50:27.816542 IP OpenWrt.lan.53 > Pixel-Tablet.lan.48267: 44347 NXDomain 0/0/0 (65)
    11:50:27.816588 IP Pixel-Tablet.lan.43821 > OpenWrt.lan.53: 36295+ A? 307lf5rgn6-19291-11-50-27-789z.mullvad.test. (61) 11:50:27.816625 IP OpenWrt.lan.53 > Pixel-Tablet.lan.16747: 44584 NXDomain 0/0/0 (61)

Since “Block connections without VPN” was active, nothing except encrypted WireGuard traffic should have left the device, but here we see plaintext DNS leaving the device.

Conclusions and recommendations

DNS leaks may have serious privacy implications for users, and can be used to derive users' approximate location or find out what websites and services a user uses.

These finding also shows once again that “Block connections without VPN” does not live up to its name (or documentation) and that it has multiple flaws. Apps may still leak DNS traffic during the conditions mentioned above, and as previously reported it still leaks connection check traffic.

Depending on your threat model this might mean that you should avoid using Android altogether for anything sensitive, or employ other mitigations to prevent the leaks. We aim to partially mitigate these problems in our app, so make sure to keep the app up-to-date.

联系我们 contact @ memedata.com