Leakage of traffic in plaintext towards the IP address of VPN server
Mozilla VPN on Linux and Android sends traffic to the VPN server's IP address in plaintext, outside the encrypted tunnel. An attacker who can make a victim visit that IP address can observe the plaintext packets, potentially deanonymising the user or causing reputational damage.
Originally disclosed on HackerOne
- Triaged in 15 days
- Fixed in 8 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 around July/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, meaning your VPN 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 Android sends traffic to the IP address of the current VPN server in plaintext. The impact is low, but it might still be abused to track/deanonymize users and it can have reputational damage since it will cause users to question whether traffic is really encrypted. There is also a hypothetical risk of leaking arbitrary traffic if combined with DNS spoofing.
For instance, in one of our tests, the VPN client was connected to a VPN server at SERVERIP. When then visiting http://<SERVERIP> in a browser, the resulting TCP connection would be initiated outside the VPN tunnel, i.e., the TCP SYN packet will be sent in plaintext. When an adversary can trick a user into visiting this IP address, the packets sent in plaintext can then be abused to track and deanonymize users.
Steps to Reproduce
Manual steps:
- Enable the VPN connection.
- Identify the IP address of the VPN server. In a real attack, an adversary can collect all VPN server IP addresses and try them all. Or the adversary can sniff traffic to identify the server being used.
- In the browser visit
http://<SERVERIP>/. In a real attack, the victim can be tricked into visiting a URL that resolves to this IP address. - In Wireshark use the filter
tcp.port == 80to identify the plaintext TCP SYN packet (or listen on port 443 when using HTTPS).
Semi-automated script:
- See the attached script
vpn_tester.sh. The fileREADME.mdhas instructions on how to use this script. To test for this vulnerability, see the section "Leaks to Server IP address" where the parameter--vpn-serveripis used. - If the script receives the plaintext HTTP request the VPN client is vulnerable.
Impact
Hypothetical Risk (Important Reason to Patch)
If the VPN client would ever use plaintext DNS to learn the IP address of the VPN server, an adversary would be able to spoof the IP address of the VPN server, and then leak traffic to this spoofed IP address. This in fact is possible against several VPN clients of other vendors that we tested. To be clear, your VPN client is not affected by this attack variant, since it doesn't appear to use plaintext DNS to obtain the VPN server's IP address. That said, preventing plaintext leakage to the VPN server's IP address would harden the security of the VPN client, and would make it clear it's not affected by this DNS-spoofing attack variant.
tl;dr: patching this vulnerability hardens the security of the VPN client and we consider this important.
Impact 1: Deanomiyzing Users (Powerful Adversary)
As a more concrete and existing impact of the vulnerability, assume an adversary can trick the victim into loading a website or resource from a given URL (and that the adversary can then see the leaked TCP packets). The adversary can assure that this URL resolves to the IP address of the VPN server that the victim is using. We will now give two examples where doing this has a direct privacy and security impact in practice.
As a first example, assume the victim uses a VPN to visit a sensitive website blocked in their country. The adversary is the country that person is living in and this adversary wants to identify who is visiting this website. For instance, this website may be used by human rights activists, a Torrent website, a prohibited foreign news website, a discussion forum about the country, and so on. It's a realistic assumption that this adversary can influence minor elements of this website, for instance through the following means:
-
If the website is a message board or marketplace, the adversary may be able to create a profile that references an external image. The adversary can then make the victim load an image from an arbitrary URL without having to exploit any vulnerability on the website.
-
Another alternative scenario in which the vulnerability can be abused are typical private messaging applications (Slack, Discord, Telegram, etc). Often, when a link is shared through a messaging application, the client will show a preview of the link by making a request to the URL in the background. Therefore, by sending a link that resolves to the IP address of the VPN server, we can make the victim leak traffic outside the VPN tunnel.
-
The adversary may abuse a (stored) XSS vulnerability on the website. This allows the adversary to make the victim load a page from an arbitrary URL. Note that XSS vulnerabilities are considered common even in the most secure web applications.
-
In targeted attacks, a hostile country or organization may use exploits to gain full control over the sensitive website that the victim is using. For instance, just recently the Genesis Dark Web Market was taken down by several law enforcement agencies. Law enforcement could have used this access to try to deanonymize users of the website by modifying the website such that the victim's browser will try to load resources from a VPN server IP address.
All combined, we can assume the adversary can make the victim's browser load a website from the VPN server's IP address. A powerful adversary can use this ability to deanonymize the user. In particular, a powerful enough adversary, such as a country or cooperating law enforcement agencies, can then monitor the traffic of all its citizens to then see which VPN user is now sending plaintext TCP packets to the VPN server's IP address. All combined, this enables a powerful adversary to deanonymize users of sensitive/blocked websites in their country.
Impact 2: Negative Business Impact (Any Adversary)
As a second example, a less powerful adversary may be able to trick the victim into visiting any URL but may not be able to intercept the leaked plaintext traffic. This would still negatively impact your users and VPN. In particular, a malicious website can make the victim initiate connections to the IP addresses of VPN servers. This would show that your VPN doesn't always encrypt all traffic. Note that there are other VPNs that don't leak this type of traffic in plaintext. So this could have reputational damage because users will now start to doubt whether the VPN will encrypt and protect all traffic.
Redirecting Leaked Traffic
An important remark is that a person-in-the-middle attacker can redirect the plaintext traffic so it gets forwarded to the adversary's own server instead of to the VPN server. For instance, a malicious Linux Wi-Fi hotspot can use the following iptable rule to redirect this leaked traffic to its own local server:
sudo iptables -t nat -I PREROUTING -p tcp -d $SERVERIP --dport 80 -j REDIRECT --to 80
This will redirect the plaintext HTTP traffic to the adversary's local server instead of forwarding it to the VPN server's IP address (this is what the --vpn-serverip parameter of the vpn_tester.sh script does). The adversary can then host their own server and will be able to see the full URL that the victim is trying to access, and the adversary can send any reply back.
Mitigation
On Linux:
- Option 1: The VPN traffic can be given a
fwmarkand policy-based routing can be used such that everything is sent through the VPN tunnel except traffic generated by the VPN client. - Option 2: The VPN process can run under a different user, and then UID-based routing can be used to send all traffic through the VPN tunnel except traffic generated by the VPN process/user.
On Android:
- By default, Android assures that all traffic gets tunneled except encrypted VPN traffic itself (using UID-based routing). There should be no need to call
VpnService.Builder excludeRouteor similar to exclude traffic to the VPN server IP.
Experiments
We tested Linux and Android and confirmed the vulnerability on both OSs.
In my experiments, the adversary acted as a Wi-Fi Access Point using the attached vpn_tester.sh script. I connected with the VPN and used the script to identify the IP address of the VPN server (and confirmed this with Wireshark). The script redirects plaintext traffic on port 80 to the script's web server. Finally, I visited http://<SERVERIP> in a browser (replace that IP address with the VPN server). This causes the browser to load a page with the following content:
<html>
<head>
<title>User is being tracked!</title>
</head>
<body>
This website visit was leaked outside the encrypted VPN tunnel!
</body>
</html>
The resulting network captures are attached:
vpn_tester.shandREADME.md: the tool we used to test VPNs in our research with a short README for this specific vulnerability.mozilla-linux-leak-serverip.*: example network capture of the attack against Linux. See packets 199 to 205 for the example leak.mozilla-android-leak-serverip.pcapng: example network capture against Android. See packet 4288 for an example leak. Use the filterhttpto see all leaks.
Best regards, Mathy Vanhoef
Context
Mozilla VPN is the product under test here, specifically its Linux and Android clients. The finding is part of a larger study on VPN security in which the researcher tested more than 66 VPNs, so Mozilla VPN is one of many clients examined rather than the sole focus. The report was filed as part of a multi-party coordinated disclosure, with public disclosure planned around July/August 2023, and the researcher explicitly states that releasing updated binaries before that date is acceptable as long as the details of the vulnerability are not mentioned.
The behaviour at issue is what a VPN client does with traffic that is addressed to the IP address of the VPN server it is currently connected to. Normally a VPN client tunnels all traffic through the encrypted tunnel, with the encrypted VPN packets themselves being the only traffic that leaves the machine outside it. Here, Mozilla VPN on Linux and Android sends traffic destined for the VPN server's own IP address in plaintext, outside the tunnel. The weakness is classified as cleartext transmission of sensitive information, with low severity.
Setup
The researcher tested two operating systems, Linux and Android, and confirmed the issue on both. The tooling was a script called vpn_tester.sh, accompanied by a README.md with instructions, plus Wireshark for inspecting captures. The script is designed to act as a Wi-Fi access point in the experiments, and it can redirect plaintext traffic on port 80 to its own web server. The relevant section of the README is titled "Leaks to Server IP address" and the relevant parameter is --vpn-serverip.
No account details, client versions or server versions are given in the report.
Finding it
During the broader VPN study the researcher observed that when the client was connected to a VPN server at SERVERIP, visiting http://<SERVERIP> in a browser caused the resulting TCP connection to be initiated outside the VPN tunnel. In other words, the TCP SYN packet was sent in plaintext rather than through the tunnel. The report also says to listen on port 443 when using HTTPS.
The impact was assessed as low, but the researcher notes two reasons it still matters: it can be abused to track and deanonymise users, and it can cause reputational damage because users will question whether their traffic is really encrypted. There is also a hypothetical risk of leaking arbitrary traffic if the issue is combined with DNS spoofing.
Exploitation
Step 1: Connect the VPN
Enable the VPN connection. The client is now connected to a VPN server whose IP address the researcher refers to as SERVERIP.
Step 2: Identify the VPN server's IP address
Identify the IP address of the VPN server. In a real attack, an adversary can collect all VPN server IP addresses and try them all, or sniff traffic to identify the server being used. In the experiments the researcher used the vpn_tester.sh script to identify the address and confirmed it with Wireshark.
Step 3: Make the victim visit the server IP
In the browser, visit:
http://<SERVERIP>/
In a real attack, the victim can be tricked into visiting a URL that resolves to this IP address. In the researcher's own experiment, visiting http://<SERVERIP> in a browser (with the IP address replaced by the VPN server's) caused the browser to load a page with the following content:
<html>
<head>
<title>User is being tracked!</title>
</head>
<body>
This website visit was leaked outside the encrypted VPN tunnel!
</body>
</html>
Step 4: Confirm the plaintext packet
In Wireshark, use the filter tcp.port == 80 to identify the plaintext TCP SYN packet, or listen on port 443 when using HTTPS.
Semi-automated variant
The same test can be run with the attached script:
- Use
vpn_tester.sh, with instructions inREADME.md. To test for this vulnerability, see the section "Leaks to Server IP address", where the parameter--vpn-serveripis used. - If the script receives the plaintext HTTP request, the VPN client is vulnerable.
Redirecting the leaked traffic
A person-in-the-middle attacker can go further than observing the leak: the plaintext traffic can be redirected so that it is forwarded to the adversary's own server instead of to the VPN server. A malicious Linux Wi-Fi hotspot can use the following iptables rule:
sudo iptables -t nat -I PREROUTING -p tcp -d $SERVERIP --dport 80 -j REDIRECT --to 80
This redirects plaintext HTTP traffic to the adversary's local server instead of forwarding it to the VPN server's IP address. This is what the --vpn-serverip parameter of vpn_tester.sh does. With the traffic redirected, the adversary can host their own server, see the full URL the victim is trying to access, and send any reply back.
Captures
The researcher attached the following files:
vpn_tester.shandREADME.md: the tool used to test VPNs in the research, with a short README for this specific vulnerability.mozilla-linux-leak-serverip.*: an example network capture of the attack against Linux. Packets 199 to 205 show the example leak.mozilla-android-leak-serverip.pcapng: an example network capture against Android. Packet 4288 shows an example leak; the filterhttpshows all leaks.
Root cause
The report does not describe the client's implementation or name a specific code path. What it establishes is the behaviour: traffic to the IP address of the current VPN server is sent outside the tunnel in plaintext on both Linux and Android. The mitigation section points at the mechanism that should prevent this. On Linux, the VPN traffic can be given a fwmark and policy-based routing used so that everything goes through the tunnel except traffic generated by the VPN client itself, or the VPN process can run under a different user and UID-based routing used to send all traffic through the tunnel except traffic generated by that process or user. On Android, the platform by default tunnels all traffic except the encrypted VPN traffic itself using UID-based routing, and there should be no need to call VpnService.Builder excludeRoute or similar to exclude traffic to the VPN server IP. The report does not state which of these mechanisms is missing or misconfigured in Mozilla VPN.
Impact
The researcher rates the impact as low and presents it in two parts.
Deanonymising users (powerful adversary)
Assume an adversary can trick the victim into loading a website or resource from a given URL, and can then see the leaked TCP packets. The adversary can ensure that this URL resolves to the IP address of the VPN server the victim is using. The report gives several ways an adversary might influence minor elements of a sensitive website to make the victim load an arbitrary URL:
- On a message board or marketplace, the adversary may be able to create a profile that references an external image, making the victim load an image from an arbitrary URL without exploiting any vulnerability on the website.
- Private messaging applications such as Slack, Discord or Telegram often generate link previews by requesting the URL in the background, so sending a link that resolves to the VPN server's IP address makes the victim leak traffic outside the tunnel.
- A stored XSS vulnerability on the website allows the adversary to make the victim load a page from an arbitrary URL; XSS is noted as common even in secure web applications.
- In targeted attacks, a hostile country or organisation may use exploits to gain full control over the sensitive website. The report cites the takedown of the Genesis Dark Web Market by several law enforcement agencies as an example where such access could have been used to modify the site so that victims' browsers load resources from a VPN server IP address.
With that ability, a powerful adversary such as a country or cooperating law enforcement agencies can monitor the traffic of all its citizens and see which VPN user is sending plaintext TCP packets to the VPN server's IP address. This enables deanonymisation of users of sensitive or blocked websites in their country. The example given is a victim using a VPN to visit a sensitive website blocked in their country, such as one used by human rights activists, a torrent site, a prohibited foreign news site or a discussion forum about the country, where the adversary is the country itself and wants to identify who visits the site.
Negative business impact (any adversary)
A less powerful adversary may be able to trick the victim into visiting any URL but may not be able to intercept the leaked plaintext traffic. Even so, a malicious website can make the victim initiate connections to the IP addresses of VPN servers, which shows that the VPN does not always encrypt all traffic. Other VPNs do not leak this type of traffic in plaintext, so this can cause reputational damage as users begin to doubt whether the VPN encrypts and protects all traffic.
Hypothetical risk
If the VPN client ever used plaintext DNS to learn the IP address of the VPN server, an adversary could spoof that IP address and then leak traffic to the spoofed address. The researcher states that this is possible against several VPN clients of other vendors that were tested, but that Mozilla VPN is not affected by this attack variant because it does not appear to use plaintext DNS to obtain the VPN server's IP address. Preventing plaintext leakage to the VPN server's IP address would harden the client and make it clear that it is not affected by the DNS-spoofing variant. The researcher considers patching this important.
Fix
It gives the following mitigations.
On Linux:
- Option 1: give the VPN traffic a
fwmarkand use policy-based routing so that everything is sent through the VPN tunnel except traffic generated by the VPN client. - Option 2: run the VPN process under a different user and use UID-based routing to send all traffic through the VPN tunnel except traffic generated by the VPN process or user.
On Android:
- Android by default tunnels all traffic except the encrypted VPN traffic itself using UID-based routing. There should be no need to call
VpnService.Builder excludeRouteor similar to exclude traffic to the VPN server IP.
Variants to test
- Test other VPN clients on Linux and Android with the same procedure: connect, identify the server IP, visit
http://<SERVERIP>/, and filter fortcp.port == 80in Wireshark. A positive result is a plaintext TCP SYN to the server IP outside the tunnel, or the script receiving the plaintext HTTP request when run with--vpn-serverip. - Repeat the test over HTTPS by listening on port 443.
- Test the redirect path with the iptables rule against a client that leaks, to confirm that a person-in-the-middle can capture the full URL and return arbitrary content.
What happened, in plain words
A VPN is a tool that creates an encrypted tunnel between your computer and a VPN server. Everything you send is supposed to go into that tunnel, get scrambled, and only then leave your machine. Mozilla VPN is Mozilla's VPN product, and this report is about its Linux and Android apps. The researcher found that when the app is connected to a VPN server, traffic addressed to that server's own IP address does not go through the tunnel. It leaves the computer in plain text, where anyone watching the network can read it.
This was found during a big study of VPN security in which the researcher tested more than 66 VPNs, so Mozilla VPN is one of many products examined, not the only one. The report was filed as part of a coordinated disclosure: several parties were told about related findings, and public disclosure was planned around July/August 2023. The researcher says it is fine to release updated binaries before that date as long as the details of the vulnerability are not mentioned.
The weakness is classified as cleartext transmission of sensitive information, with low severity. Low does not mean harmless: the report explains that the leak can be used to track and deanonymise users, and that it can damage the VPN's reputation because users will ask themselves whether their traffic is really encrypted. There is also a hypothetical risk of leaking arbitrary traffic if the issue is combined with DNS spoofing, which I explain later.
The setup
The researcher tested two operating systems, Linux and Android, and confirmed the issue on both. The main tool was a script called vpn_tester.sh, with a README.md containing instructions. The script is built to act as a Wi-Fi access point, meaning it plays the role of the Wi-Fi router a victim connects to. It can also redirect plain text web traffic on port 80 to its own web server. Port 80 is the standard port for unencrypted HTTP, the protocol browsers use when a site address starts with http:// rather than https://. Wireshark, a program that records and displays network traffic packet by packet, was used to inspect the captures.
The relevant section of the README is titled "Leaks to Server IP address", and the relevant parameter is --vpn-serverip. A parameter is an option you pass to a script on the command line to change what it does.
The report gives no account details, client versions or server versions.
Finding it
During the broader study the researcher observed the following. The VPN client was connected to a VPN server whose address the report calls SERVERIP. When the researcher then visited http://<SERVERIP> in a browser, the resulting TCP connection was started outside the VPN tunnel. In other words, the TCP SYN packet was sent in plain text.
Two terms need unpacking. TCP is the protocol that carries most web traffic; a connection begins with a small packet called SYN, short for synchronise, which is the browser saying hello to the server. A packet is a small chunk of data travelling over the network, and a network capture is a recording of those chunks. If the SYN goes out in plain text, anyone on the same network can see that your machine is talking to that address, and can read what follows.
The same observation applies when listening on port 443, the standard port for HTTPS, the encrypted version of HTTP. The report does not say whether the leak was confirmed on 443 in the experiments; it only says to listen there when using HTTPS.
Exploitation, step by step
Step 1: Connect the VPN
Enable the VPN connection. The client is now connected to a VPN server whose IP address the report refers to as SERVERIP. An IP address is the numeric address of a machine on a network, like a postal address for computers.
Step 2: Identify the VPN server's IP address
Identify the IP address of the VPN server. In a real attack, an adversary can collect all VPN server IP addresses and try them all, or sniff traffic to identify the server being used. Sniffing means passively recording the traffic that passes over a network. In the experiments the researcher used vpn_tester.sh to identify the address and confirmed it with Wireshark. This step matters because the attack only works if the adversary knows which address to aim the victim at.
Step 3: Make the victim visit the server IP
In the browser, visit:
http://<SERVERIP>/
This is a URL: http:// says to use unencrypted web traffic, <SERVERIP> is a placeholder for the VPN server's numeric address, and the trailing / asks for the site's front page. In a real attack, the victim can be tricked into visiting a URL that resolves to this IP address. Resolving means turning a name such as example.com into an IP address; here the trick is to make a name the victim clicks on point at the VPN server's address.
In the researcher's own experiment, visiting http://<SERVERIP> in a browser, with the IP address replaced by the VPN server's, caused the browser to load a page with the following content:
<html>
<head>
<title>User is being tracked!</title>
</head>
<body>
This website visit was leaked outside the encrypted VPN tunnel!
</body>
</html>
Line by line: <html> opens an HTML document, the language web pages are written in. <head> starts the part of the page that holds information about the page rather than visible content. <title>User is being tracked!</title> sets the text shown in the browser tab. </head> closes that part. <body> starts the visible content. This website visit was leaked outside the encrypted VPN tunnel! is the sentence displayed on the page. </body> and </html> close the body and the document.
Step 4: Confirm the plain text packet
In Wireshark, use the filter tcp.port == 80 to identify the plain text TCP SYN packet, or listen on port 443 when using HTTPS. A filter in Wireshark is a rule that hides everything except the packets you care about; tcp.port == 80 means show only TCP traffic on port 80. This step is how you turn a suspicion into evidence: you look at the recording and see the SYN packet going out unencrypted.
The semi-automated variant
The same test can be run with the attached script:
- Use
vpn_tester.sh, with instructions inREADME.md. To test for this vulnerability, see the section "Leaks to Server IP address", where the parameter--vpn-serveripis used. - If the script receives the plain text HTTP request, the VPN client is vulnerable.
The logic is simple: the script pretends to be the network and watches for a request that should have been inside the tunnel. If the request arrives, the tunnel failed to carry it.
Redirecting the leaked traffic
A person-in-the-middle attacker, someone sitting between the victim and the network and able to alter traffic, can go further than watching. The plain text traffic can be redirected so that it is forwarded to the adversary's own server instead of to the VPN server. A malicious Linux Wi-Fi hotspot can use the following iptables rule:
sudo iptables -t nat -I PREROUTING -p tcp -d $SERVERIP --dport 80 -j REDIRECT --to 80
Line by line: sudo runs the command with administrator rights. iptables is the Linux tool that controls network filtering and rewriting. -t nat selects the table that rewrites addresses, the part of iptables that changes where traffic goes. -I PREROUTING inserts the rule at the top of the chain that sees packets before routing decisions are made, so it applies first. -p tcp matches TCP traffic only. -d $SERVERIP matches packets whose destination is the VPN server's address, stored in the shell variable SERVERIP. --dport 80 matches packets aimed at port 80. -j REDIRECT --to 80 is the action: send the packet to the local machine on port 80 instead of forwarding it. The result is that the plain text HTTP traffic goes to the adversary's local server rather than to the VPN server's IP address. This is what the --vpn-serverip parameter of vpn_tester.sh does. With the traffic redirected, the adversary can host their own server, see the full URL the victim is trying to access, and send any reply back.
Captures
The researcher attached the following files:
vpn_tester.shandREADME.md: the tool used to test VPNs in the research, with a short README for this specific vulnerability.mozilla-linux-leak-serverip.*: an example network capture of the attack against Linux. Packets 199 to 205 show the example leak.mozilla-android-leak-serverip.pcapng: an example network capture against Android. Packet 4288 shows an example leak; the filterhttpshows all leaks.
A capture file is a recording of network traffic that can be opened later in Wireshark. Packet numbers let a reader jump straight to the interesting moment.
Why it happens
The report does not describe the client's implementation or name a specific code path. What it establishes is the behaviour: traffic to the IP address of the current VPN server is sent outside the tunnel in plain text on both Linux and Android. The mitigation section points at the mechanism that should prevent this. On Linux, the VPN traffic can be given a fwmark and policy-based routing used so that everything goes through the tunnel except traffic generated by the VPN client itself, or the VPN process can run under a different user and UID-based routing used to send all traffic through the tunnel except traffic generated by that process or user. A fwmark is a label the system attaches to packets so routing rules can treat them differently; policy-based routing means choosing a route based on rules rather than only on the destination address; UID-based routing means choosing a route based on which user on the machine produced the traffic. On Android, the platform by default tunnels all traffic except the encrypted VPN traffic itself using UID-based routing, and there should be no need to call VpnService.Builder excludeRoute or similar to exclude traffic to the VPN server IP. VpnService.Builder is the Android programming interface used to configure a VPN app, and excludeRoute is one of its options for leaving certain destinations out of the tunnel.
Impact
The researcher rates the impact as low and presents it in two parts.
Deanonymising users, with a powerful adversary
Assume an adversary can trick the victim into loading a website or resource from a given URL, and can then see the leaked TCP packets. The adversary can ensure that this URL resolves to the IP address of the VPN server the victim is using. The report gives several ways an adversary might influence minor elements of a sensitive website to make the victim load an arbitrary URL:
- On a message board or marketplace, the adversary may be able to create a profile that references an external image, making the victim load an image from an arbitrary URL without exploiting any vulnerability on the website. An external image is one hosted on another site, so the victim's browser contacts that other site to fetch it.
- Private messaging applications such as Slack, Discord or Telegram often generate link previews by requesting the URL in the background, so sending a link that resolves to the VPN server's IP address makes the victim leak traffic outside the tunnel. A link preview is the small card with a title and image that appears when you paste a link.
- A stored XSS vulnerability on the website allows the adversary to make the victim load a page from an arbitrary URL. XSS, cross-site scripting, is a flaw where an attacker gets their own code to run inside someone else's web page; stored means the malicious content is saved on the site and served to visitors. The report notes XSS is common even in secure web applications.
- In targeted attacks, a hostile country or organisation may use exploits to gain full control over the sensitive website. The report cites the takedown of the Genesis Dark Web Market by several law enforcement agencies as an example where such access could have been used to modify the site so that victims' browsers load resources from a VPN server IP address.
With that ability, a powerful adversary such as a country or cooperating law enforcement agencies can monitor the traffic of all its citizens and see which VPN user is sending plain text TCP packets to the VPN server's IP address. This enables deanonymisation of users of sensitive or blocked websites in their country. The example given is a victim using a VPN to visit a sensitive website blocked in their country, such as one used by human rights activists, a torrent site, a prohibited foreign news site or a discussion forum about the country, where the adversary is the country itself and wants to identify who visits the site.
Negative business impact, with any adversary
A less powerful adversary may be able to trick the victim into visiting any URL but may not be able to intercept the leaked plain text traffic. Even so, a malicious website can make the victim initiate connections to the IP addresses of VPN servers, which shows that the VPN does not always encrypt all traffic. Other VPNs do not leak this type of traffic in plain text, so this can cause reputational damage as users begin to doubt whether the VPN encrypts and protects all traffic.
The hypothetical DNS risk
DNS is the system that turns names such as example.com into IP addresses, like a phone book for the internet. If the VPN client ever used plain text DNS to learn the IP address of the VPN server, an adversary could spoof that IP address and then leak traffic to the spoofed address. Spoofing means answering with a false address so the victim connects to the attacker instead. The researcher states that this is possible against several VPN clients of other vendors that were tested, but that Mozilla VPN is not affected by this attack variant because it does not appear to use plain text DNS to obtain the VPN server's IP address. Preventing plain text leakage to the VPN server's IP address would harden the client and make it clear that it is not affected by the DNS-spoofing variant. The researcher considers patching this important.
The fix
It gives the following mitigations.
On Linux:
- Option 1: give the VPN traffic a
fwmarkand use policy-based routing so that everything is sent through the VPN tunnel except traffic generated by the VPN client. - Option 2: run the VPN process under a different user and use UID-based routing to send all traffic through the VPN tunnel except traffic generated by the VPN process or user.
On Android:
- Android by default tunnels all traffic except the encrypted VPN traffic itself using UID-based routing. There should be no need to call
VpnService.Builder excludeRouteor similar to exclude traffic to the VPN server IP.
Variants to test
- Test other VPN clients on Linux and Android with the same procedure: connect, identify the server IP, visit
http://<SERVERIP>/, and filter fortcp.port == 80in Wireshark. A positive result is a plain text TCP SYN to the server IP outside the tunnel, or the script receiving the plain text HTTP request when run with--vpn-serverip. - Test the redirect path with the iptables rule against a client that leaks, to confirm that a person-in-the-middle can capture the full URL and return arbitrary content.
Glossary
- VPN: a tool that builds an encrypted tunnel between your device and a server, so traffic inside the tunnel cannot be read on the way.
- VPN client: the app on your device that creates and manages the tunnel.
- VPN server: the machine at the other end of the tunnel.
- Tunnel: the encrypted path that VPN traffic takes; traffic outside it is unprotected.
- Plain text / cleartext: data sent without encryption, readable by anyone who can see it.
- IP address: the numeric address of a machine on a network.
- TCP: the protocol that carries most web traffic and starts connections with a SYN packet.
- SYN packet: the first packet of a TCP connection, a hello from client to server.
- Packet: a small chunk of data travelling over a network.
- Port: a number that identifies which service on a machine traffic is meant for; 80 is HTTP, 443 is HTTPS.
- HTTP: the unencrypted protocol browsers use for web pages.
- HTTPS: the encrypted version of HTTP.
- URL: a web address, such as
http://<SERVERIP>/. - Resolve: turn a name into an IP address.
- DNS: the system that turns names into IP addresses.
- DNS spoofing: answering a DNS lookup with a false address so the victim connects to the attacker.
- Sniffing: passively recording traffic on a network.
- Network capture: a recording of network traffic, viewable in Wireshark.
- Wireshark: a program that records and displays network traffic packet by packet.
- Filter: a rule in Wireshark that hides packets you do not want to see.
- Person-in-the-middle: an attacker positioned between the victim and the network who can watch or alter traffic.
- Wi-Fi access point: the device that provides a Wi-Fi network, such as a router or hotspot.
- iptables: the Linux tool that controls network filtering and rewriting.
- fwmark: a label attached to packets so routing rules can treat them differently.
- Policy-based routing: choosing a route based on rules rather than only the destination address.
- UID-based routing: choosing a route based on which user on the machine produced the traffic.
VpnService.Builder: the Android programming interface used to configure a VPN app.excludeRoute: an option of that interface for leaving certain destinations out of the tunnel.- XSS (cross-site scripting): a flaw where an attacker gets their own code to run inside someone else's web page; stored XSS means the malicious content is saved on the site.
- Link preview: the small card with a title and image shown when a link is pasted into a messaging app.
- External image: an image hosted on another site, which the browser must contact to fetch.
- Deanonymise: work out who a user really is behind their VPN or other anonymity measure.
- Coordinated disclosure: telling the affected parties first and agreeing a date for making the details public.
- Severity: a rating of how serious a vulnerability is.
- Parameter: an option passed to a script on the command line to change what it does.