How to Test for an IPv6 Leak When Using a Proxy

Published:

12 minute read

Acar Diveroli
Written by: Acar Diveroli
Two cables from a dual-stack device: the white IPv4 cable runs through the proxy box, the blue IPv6 cable bypasses it

An IPv6 leak is when, with the proxy on, some connections go straight to the internet from your device's own IPv6 address. It happens when the proxy applies only to certain apps or only to IPv4 traffic. A device with both an IPv4 and an IPv6 address tries IPv6 first if the site has an IPv6 address. So a test page that only shows IPv4 displays the proxy IP, and the leak goes unnoticed. This post covers the causes of the leak, how to test for it with curl and a browser, and how to close it.

Three ways traffic leaks

IPv6 traffic skips the proxy in three ways. In all three the connection raises no error, the page loads, and the problem only shows when you look at the address.

An app that ignores the proxy setting. A proxy is not an operating system rule: each app reads it on its own. On Windows, Chrome and Edge use the system proxy setting, while Firefox has its own settings screen. Most command-line tools read an environment variable or their own option. In our test, with HTTPS_PROXY set, curl and Python's urllib module went through the proxy. The fetch function in Node.js 24.22.2 never touched the proxy and raised no error either.

A setup that only captures IPv4. Some setups capture traffic at the network layer rather than in the app. Tools that create a virtual network adapter and router rules belong to this group. If the rule was written only for IPv4, IPv6 packets leave by the usual route. Linux is the typical example: iptables applies only to IPv4, and IPv6 needs a separate ip6tables rule set.

An app with its own network stack. Games, voice call apps and some desktop programs open connections with their own code. Some use UDP, and an HTTP proxy does not carry UDP. That traffic goes out directly, whatever the proxy setting says.

DNS queries and WebRTC in the browser bypassing the proxy is a separate topic. We cover it in our post on WebRTC and DNS leaks.

What an IPv6 address reveals

An IPv6 address is usually a public address assigned to the device itself. Unlike IPv4, there is no single shared address that every device at home hides behind. The first 64 bits of the address are the prefix and show the network your provider assigned to your line.

For outgoing connections, devices use temporary addresses whose ending changes at random. This changes the second half of the address, not the prefix. A leaked IPv6 address therefore shows which provider and which line you connect from.

The second effect concerns location. If you use the proxy to get an exit in a specific country, a request that arrives directly over IPv6 is, for the site, a visit from another country. Most large sites publish both an IPv4 and an IPv6 address. Your browser also tries IPv6 first. If IPv6 leaks, these sites see your address, not the proxy IP. We explain how a device chooses between the two protocols in IPv4 vs IPv6.

Testing on the command line

The test compares two measurements. First record your real addresses with the proxy off, then repeat the same queries with the proxy on. Three ipify addresses work as echo services: api.ipify.org returns IPv4 only, api6.ipify.org IPv6 only, and api64.ipify.org either of the two.

With the proxy off:

bash
curl -4 https://api.ipify.org
curl -6 https://api6.ipify.org

The first command prints your IPv4 address (for example 203.0.113.24), the second your IPv6 address (for example 2001:db8:4f2a:10::7). If the second command stops with curl: (6) Could not resolve host, your device has no working IPv6. In that case there is no IPv6 to leak either. In Windows PowerShell, curl is an alias for another command, so type curl.exe.

If you use a tool that turns the proxy on at the network layer, run the same two commands again with the tool on. For a proxy configured in an app, pass it explicitly in the command:

bash
curl -x http://user:pass@pr.proxynet.io:8000 \
  https://api64.ipify.org
curl -x http://user:pass@pr.proxynet.io:8000 \
  https://api6.ipify.org

There is a trap here. With an HTTP proxy, curl does not resolve the target name itself; it sends the name to the proxy in a CONNECT request. So -4 and -6 set the protocol you use to reach the proxy, not the target. In our test, -6 -x http://localhost:8899 made curl resolve localhost to ::1. It could not connect to the local proxy, which listened on IPv4 only.

Read the result of the IPv6 query like this:

Result of the IPv6 queryMeaning
Your own IPv6 addressLeak: IPv6 traffic does not enter the proxy
Another IPv6 addressThe proxy carries IPv6 traffic
CONNECT tunnel failed, response 502The proxy has no IPv6 exit, and no leak
Could not resolve host (no proxy)The device has no IPv6

In the third row the IPv6 path is closed. There is no leak, but you cannot reach a target that has only an IPv6 address either.

Testing in the browser

The browser test makes the same comparison through a page. With the proxy on, open https://api.ipify.org and https://api6.ipify.org in separate tabs. The first should show the proxy's IPv4 address. The second should either show an IPv6 address of the proxy or not load at all. If you see your own IPv6 address, the browser's IPv6 traffic does not enter the proxy.

For a more detailed view, open test-ipv6.com. The page is run by APNIC Labs and is not tied to any VPN or proxy brand. It shows the IPv4 and IPv6 addresses the site sees on separate lines. If one of your real addresses appears there with the proxy on, you have a leak.

The browser test only measures the browser. Another app on the same computer may be leaking. To check step by step whether the proxy works at all, see how to test a proxy.

Watching an app's connections

For an app you cannot point at an echo address, look at the connection table. If the app uses the proxy, all its open connections go to the proxy server. If you see another IPv6 address as the remote address, that connection goes out directly.

On Windows, this PowerShell command lists the connections established over IPv6 and the program that owns each one:

powershell
Get-NetTCPConnection -State Established |
  Where-Object { $_.RemoteAddress -like '*:*' -and $_.RemoteAddress -ne '::1' } |
  Select-Object RemoteAddress, RemotePort, OwningProcess,
    @{n='Process'; e={ (Get-Process -Id $_.OwningProcess).ProcessName }}

This command shows TCP connections only. For apps that use UDP, Wireshark is a better fit. The display filter ipv6 and tcp.flags.syn == 1 and tcp.flags.ack == 0 isolates newly opened IPv6 TCP connections, and ipv6 and udp isolates IPv6 UDP traffic. If you see a destination other than the proxy's address, that app is the source of the leak.

Closing the leak

The fix is to route IPv6 traffic into the proxy or to close that path on purpose. There are three ways, depending on the cause.

Set the proxy explicitly in the app. Check the app's documentation for where it reads the proxy from, and set it there. In curl -x is enough, in Python an environment variable or the client's proxy parameter. In Node.js 24.5.0 and later, fetch reads the environment variable only when explicitly asked to:

bash
NODE_USE_ENV_PROXY=1 \
HTTPS_PROXY=http://user:pass@pr.proxynet.io:8000 \
node app.js

The same setting is also available as node --use-env-proxy app.js. In our test, with this variable the fetch request went through the proxy.

Extend the network-layer rule to IPv6. The tool or router rule that captures traffic must also cover IPv6. On Linux, write the ip6tables equivalent of your iptables rules. If the tool has an IPv6 option, turn it on. If not, block IPv6 traffic with the firewall on that machine only. A blocked connection does not leak, it just closes.

Choose the proxy by target. If your targets also accept IPv6 and you want an IPv6 exit, an IPv6 Proxy carries that traffic inside the proxy. A proxy with an IPv4-only exit does not leak either, but it cannot reach targets that have only an IPv6 address.

The cost of disabling IPv6

Disabling IPv6 in the operating system hides the leak, it does not fix the cause. An app that ignores the proxy setting now goes out with your real IPv4 address. The test page shows an empty IPv6 line, but the traffic is still outside the proxy.

Disabling has its own cost too. Microsoft does not recommend disabling IPv6 or its components on Windows. It notes that some Windows components may not work in that case. The option it recommends is the "prefer IPv4 over IPv6" setting. This setting is made in the registry and requires a restart.

That setting is not a leak fix either. It only changes the order for targets with both addresses; it does not change whether traffic enters the proxy. Use disabling IPv6 only as a temporary diagnostic step: if the problem disappears when you turn it off, what you are looking for is a rule that bypasses the IPv6 path.

Troubleshooting

The combination of results shows where the leak is:

  • The IPv4 query shows the proxy address, the IPv6 query your own address. The setup only captures IPv4. Extend the network-layer rule to IPv6.
  • Both queries show your own addresses. The app does not read the proxy setting at all. Set the proxy in the app's own settings.
  • curl shows the right address, the app the wrong one. The two read the proxy from different places. Node.js fetch is the known example.
  • The IPv6 query stops with 502. The proxy has no IPv6 exit. That is not a leak, but you cannot reach targets with only an IPv6 address.
  • The browser is clean, another program is suspect. Check the connection table and find which program owns the IPv6 addresses outside the proxy.

How we tested

We ran the commands on December 1, 2026, on Windows 11 with curl 8.22.0, Python 3.13.17 and Node.js 24.22.2. We used a local Python proxy that logged every CONNECT request with its target. The proxy listened on 127.0.0.1 only. We started each scenario in a new process and determined whether the request went through the proxy by checking the proxy log.

The test machine had no public IPv6 connectivity. So the curl -6 command without a proxy stopped with code (6). The IPv6-only target returned 502 through the proxy. We did not observe a real IPv6 leak on this machine. The finding that an app bypasses the proxy was seen over IPv4, with the same mechanism. The connection table command ran and returned an empty list, since the machine had no IPv6 connections.

The bottom line

Test with two measurements: your real addresses with the proxy off, and the IPv4 and IPv6 queries separately with the proxy on. If there is a leak, set the proxy in the app's own settings or extend the network-layer rule to IPv6. For apps that use UDP, choose a SOCKS5 Proxy that carries UDP. Above all, don't trust a test page that only shows IPv4: the leak sits exactly where that page doesn't look.

Sources

Frequently asked questions

What is an IPv6 leak?

It is when, with the proxy on, some connections go out directly from your device's own IPv6 address. It happens when the proxy applies only to certain apps or only to IPv4 traffic. The site sees your public IPv6 address instead of the proxy IP. That address shows your provider and the network of the line you connect from. Since the connection raises no error, you only notice it by checking the address.

How do I test for an IPv6 leak?

With two measurements. First record your real addresses with the proxy off, using curl -4 https://api.ipify.org and curl -6 https://api6.ipify.org. Then repeat the same queries with the proxy on. If the IPv6 query shows your own address, you have a leak. If you see another IPv6 address or a connection error, your IPv6 traffic is not leaving outside the proxy.

The IP check site shows the proxy IP. Can there still be a leak?

Yes. If the page loads over IPv4 only, it never sees your IPv6 traffic. If your setup only captures IPv4, that page shows the proxy address. At the same time, sites with both addresses see your IPv6 address. So use a test page that shows IPv4 and IPv6 addresses on separate lines, or separate echo addresses.

Does disabling IPv6 fix the leak?

No. Disabling IPv6 hides the leak, it does not fix the cause. An app that ignores the proxy setting then goes out with your real IPv4 address. Microsoft does not recommend disabling IPv6 on Windows and notes that some components may stop working. The lasting fix is to set the proxy in the app's own settings or to extend the network-layer rule to IPv6.

Why does curl -6 behave differently with a proxy?

Because with an HTTP proxy, curl does not resolve the target name itself. It sends the target to the proxy in a CONNECT request, and the proxy resolves the name. In that case -4 and -6 only set the protocol you use to connect to the proxy server. To see whether the target opens over IPv6, query an echo service that has only an IPv6 address, such as api6.ipify.org.

Does Node.js fetch read the proxy environment variables?

Not by default. In our test, the fetch function in Node.js 24.22.2 skipped the proxy with HTTPS_PROXY set and raised no error. From Node.js 24.5.0 and 22.21.0, the NODE_USE_ENV_PROXY=1 environment variable or the --use-env-proxy option turns this support on. With that setting the same request went through the proxy. On older versions you need to pass the proxy in code, with the ProxyAgent class from the undici package.

Ask ChatGPTAsk Claude