Skip to content
Info disclosure Disclosed report Intermediate

Leaking VPN traffic through non-RFC1918 local IP addresses

Mozilla VPN on Linux and iOS sends traffic to the local network outside the VPN tunnel. A malicious Wi-Fi or Ethernet network can assign non-RFC1918 IP addresses to the local network, causing the VPN client to leak nearly all IP-based traffic outside the tunnel.

Mathy Vanhoef Follow

Originally disclosed on HackerOne

  • Triaged in 34 hours
  • Fixed in 15 months
  • Paid in 2 months
  • Disclosed after 18 months

Disclosure and Deviation of T&Cs

This finding is part of a multi-party coordinated disclosure on VPN security. We plan to publicly disclose relevant findings in early August 2023. Please don't give a bug bounty if you disagree with the eventual public disclosure, we will still be happy to discuss details even without a bounty. Note that it's OK for us if you already release updated binaries before the coordinated disclosure as long as the details of the vulnerability are not mentioned. If you use the information in this report we assume this will be OK. Happy to discuss details.

For context, we tested more than 66 VPNs/devices, meaning your device is just one of the many VPNs we tested, so there won't be an explicit focus on it during disclosure. We also plan to contact CERT/CC to reach other VPN companies for similar vulnerabilities.

Summary

As part of a larger study on VPN security, we found that Mozilla VPN on Linux and iOS sends traffic to the local network outside the VPN tunnel. On its own, this is not an issue, but a malicious Wi-Fi or Ethernet network can hand out non-RFC1918 IP addresses for the local network, and then your VPN client can be tricked into sending nearly all IP-based traffic outside the VPN tunnel.

As a simple example, if a rogue Wi-Fi hotspot uses the subnet 216.165.47.0/24 for the local network, then all traffic to these IP addresses will be leaked in plaintext, i.e., sent outside the VPN tunnel. This is because the VPN client thinks these IP addresses are in the local network. For instance, if the victim then visits http://nyu.edu, which has IP address 216.165.47.10, the website will be loaded outside the VPN tunnel. An adversary can also use 0.0.0.0/1 or 128.0.0.0/1 as the local network so nearly all IP-based traffic can be intercepted.

Steps to Reproduce

A quick-and-dirty method to test for the vulnerability is to make your router hand out non-RFC1918 IP addresses for the local network, e.g., using 216.165.47.0/24 for the local network. Then enable the VPN and try to visit http://nyu.edu or directly visit http://216.165.47.10. This should have as result that the NYU website won't load and in Wireshark you should see ARP requests for the IP address 216.165.47.10.

For a more rigorous test, see the attached script vpn_tester.sh to reproduce the attack. The file README.md has instructions on how to use this script, in particular, the section "Local IP Camouflage Attack". In our experiments, we tried to leak traffic to nyu.edu using the following command:

sudo ./vpn_tester.sh wlan0 wlan0 testnetwork abcdefgh --vpn-local nyu.edu

After executing this command you can connect to the created Wi-Fi network (SSID testnetwork with password abcdefgh) and enable the VPN. When you now visit the website http://nyu.edu in a browser (don't include the WWW prefix!) the corresponding HTTP request and HTTP response will be sent outside the VPN tunnel. You can also try to visit http://216.165.47.10 (the exact IP address will be displayed by the script). Without performing the attack, traffic to this IP address would be sent through the VPN tunnel.

Impact

Example Impact 1: Leaking Traffic to a specific subnet

The direct impact is self-evident: even when the victim is always using the VPN, an adversary can leak all IP traffic in a given subnet. The adversary can forward the leaked traffic to the real server so that the victim can still visit all websites normally. If the website uses plaintext IP protocols, such as HTTP/DNS/SMTP/NTP/FTP/.., this directly leaks sensitive information or the adversary can use it as the basis for subsequent attacks.

If the victim is using an encrypted protocol such as HTTPS or similar, the adversary can still learn which IP addresses the victim is visiting, meaning the adversary can learn the websites that a victim is visiting (see "What can you learn from an IP?"). Simply knowing the website that someone is visiting can be sensitive information, after all, that's why the victim might be using a VPN. The adversary can further try to perform known attacks on HTTP, such as SSLStrip, since the usage of HSTS is not yet widespread, or the adversary can use fingerprinting techniques to leak additional information such as the specific webpage being visited.

Example Impact 2: Leaking all IP-based

An adversary can also try to assign the subnet 0.0.0.0/0 to intercept all IP-based traffic. Whether this works depends on the target OS, since this may conflict with the default route. However, we found that using the subnet 0.0.0.0/1 or 128.0.0.0/1 to intercept almost all traffic typically does work. So the attacker needs no prior knowledge of the user's browsing habits since they can intercept most IP-based traffic, and then identify the IP addresses that the victim is contacting.

Mitigation

Local network access should be automatically blocked when the local network is using a non-RFC1918 IP range. Put differently, local network access should only be allowed towards RFC1918 IP addresses, i.e., only towards IP addresses that are not routed on the public Internet. Optionally, the user can be warned when the local network is using a non-RFC1918 IP range, and after accepting the warning the user can then still manually enable local network access.

On iOS, the API parameter includeAllNetworks should be set to True while excludeLocalNetworks should be set to False to prevent the attack. Optionally, when the VPN client verified that the local network is using an RFC1918 subnet, the API parameter excludeLocalNetworks can be set to True to still allow access to the local network. I have seen reports that on older iOS versions the usage of these parameters can cause reliability issues, but I didn't experience this myself on recent iOS releases.

Experiments

We confirmed the vulnerability against Linux and iOS.

The following files are attached:

  • vpn_tester.sh and README.md: the tool we used to test VPNs in our research with a short README for this specific vulnerability.
  • mozilla-linux-leak-local.*: example of the attack against Linux. Notice that the client has an IP address in the subnet 216.165.47.0/24 and notice the traffic leak no http://nyu.edu in packets 1109 to 1115. You can use the filter http to see more leaks.

Best regards, Mathy Vanhoef

The original report as published on HackerOne, by vanhoefm. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The VPN client allows local network access for any IP subnet assigned by the local network, without checking that the subnet is a private (RFC1918) range.

Impact

An adversary can leak all IP traffic in a given subnet, or nearly all IP-based traffic by using [redacted]/1 or [redacted]/1, allowing interception of plaintext protocols and learning which websites the victim visits even over HTTPS.

What the attacker needed

Victim connects to malicious Wi-Fi or Ethernet; attacker controls local network DHCP

The fix

Local network access should be automatically blocked when the local network uses a non-RFC1918 IP range, and on iOS the API parameters includeAllNetworks should be set to True and excludeLocalNetworks to False.

How it was found

  1. Configure a router to hand out non-RFC1918 IP addresses for the local network, such as [redacted]/24.
  2. Enable the VPN and try to visit a website whose IP falls in that range, or directly visit the IP address.
  3. Observe that the website does not load and that ARP requests for the IP address appear in Wireshark.
  4. For a rigorous test, use the provided script to create a Wi-Fi network with a non-RFC1918 subnet.
  5. Connect to the created Wi-Fi network and enable the VPN.
  6. Visit a website in the leaked subnet and observe that the HTTP request and response are sent outside the VPN tunnel.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A VPN normally encrypts all your internet traffic and sends it through a secure tunnel. But if your VPN thinks some IP addresses belong to your local network, it sends traffic to those addresses outside the tunnel. A malicious Wi-Fi network can trick the VPN into thinking a large range of public IP addresses are local, so your traffic to those addresses is sent unencrypted and can be intercepted.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Mathy Vanhoef

View all

5 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.