TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Linux under WSL2 can be leaking

314 pointsby Volineover 4 years ago

24 comments

AndrewDuckerover 4 years ago
So, if I&#x27;m understanding correctly the Linux system gets access to the raw Ethernet system, and so bypasses the Windows firewall. Seems not entirely unreasonable - if you want Linux to use a firewall then install one into it.<p>But it should definitely be well publicised&#x2F;documented, because otherwise people won&#x27;t realise they have a gaping hole in their greens m defences.
评论 #24642171 未加载
评论 #24646206 未加载
评论 #24643820 未加载
ncmncmover 4 years ago
For reference, this kind of problem is avoided on QubesOS (another, Xen-based, hypervisor system) by routing all traffic through another VM that entirely owns the network hardware. I run my Wireguard on that VM.<p>The host OS image, dom0, also routes its network traffic through that VM, to get updates. (It doesn&#x27;t trust the updates it gets that way; it checks their signatures.)<p>QubesOS provides another VM as a dedicated firewall just to route untrusted guests&#x27; traffic through, first. With enough cores, it all runs fast.<p>For many users, all guest VMs are untrusted. Dodgy programs like browsers get their own VMs, spun up as needed and discarded. That does take a fair bit of RAM; my maxed-out 16GB laptop notices the strain. But memory is cheap these days, if you have the sockets to put it in.<p>As an aside, dom0 also mediates access to the UI hardware, including display RAM. Each guest can run X, but its pixels are copied to the real display by dom0. Guest VMs can&#x27;t see one another&#x27;s pixels or input traffic. dom0 also mediates access to audio and video streams, and can route them to selected VMs as needed. (In a future release they plan to manage the display in its own VM, because display drivers are a big attack surface of their own.)<p>It all works astonishingly well.<p>Incidentally, this model of a hypervisor with all the user-level OSes as VMs, including the host, originated at IBM in the 1960s. That worked in a megabyte or two, which seemed like a lot at the time.
评论 #24661652 未加载
smarx007over 4 years ago
The title is wrong. The VPN traffic does NOT leak. What leaks is the traffic that the VPN software tries to block when the VPN connection is not active. Mullvad uses Windows Firewall to block all internet access if VPN is not active (if the user configured so) and WSL2 bypasses this by not going through Windows Firewall. When the VPN is active, WSL2 traffic IS tunneled through the VPN.<p>UPD: The solution may be to have Windows Firewall rules apply to WSL2 or have Mullvad control Linux internet access through on-the-fly UFW settings update or completely disconnect internet (but that likely does not work nicely and is why Mullvad went for the Windows Firewall based solution in the first place).
评论 #24642563 未加载
评论 #24643829 未加载
评论 #24643766 未加载
评论 #24643497 未加载
wing-_-nutsover 4 years ago
A bit off topic, but this sort of transparency is why I don&#x27;t mind paying $6 &#x2F; mo for a vpn when mullvad&#x27;s competitors are much cheaper. Their wireguard support is great, and their speeds are much faster than what I got through openVpn on pia.
评论 #24641979 未加载
评论 #24643589 未加载
评论 #24642594 未加载
评论 #24643957 未加载
评论 #24643146 未加载
donor20over 4 years ago
The idea of the a linux distribution is going to be using the WINDOWS firewall?? seems a bit crazy to me.<p>I expect the distributions on WSL to use their own firewall - that&#x27;s half of the fun of using WSL.<p>PLEASE don&#x27;t push fake news like this that results in distribution on WSL having to deal with &#x2F; modify the window firewall - that would be a total nightmare!
评论 #24644721 未加载
Volineover 4 years ago
We have tested a few other VPN clients from competitors and found that all of them leak in the same way. The way Microsoft has implemented virtual networking for Linux guests makes it very difficult to properly secure them.
评论 #24641844 未加载
评论 #24641779 未加载
评论 #24641678 未加载
jeroenhdover 4 years ago
Potential workaround: is it possible to configure VPN clients to _ignore_ the WSL2 runtime and instead run a VPN client inside WSL2?<p>That way the Linux network config can deal with the Linux side of things and the Windows network config can deal with the Windows VPN routing.<p>Of course you can just configure OpenVPN inside WSL2 and also run a VPN on the desktop but that&#x27;s tunnels in tunnels and that way madness and network issues lies.
评论 #24641905 未加载
评论 #24641796 未加载
sally1620over 4 years ago
This is the exact reason I didn&#x27;t try running weird VPN configs like this. The reliable way is to run Linux inside a VirtualBox and have it connected to VPN on its own.<p>Currently, I run Linux on a Xen domU and configure VPN client inside the guest.<p>PS: I don&#x27;t want all my traffic to go through VPN. Especially things like Netflix or Youtube where VPNs are blocked (and VPN BW is lower anyway).
评论 #24642586 未加载
评论 #24641975 未加载
dagaciover 4 years ago
Let me get this right: Installing WSL2 causes HyperV to be installed. When Hyper-V is installed, HyperV replaces Windows as the Machine Host. Therefore Windows itself becomes a guest OS of Hyper-V, and the installed Linux also becomes a guest of HyperV.<p>So what mullvad would prefer is that Linux traffic to be routed through the adjacent Windows Guest by default, so that the windows software can control the Linux network traffic.<p>I think a better solution would be to explore creating a VPN solution for HyperV OS itself if possible...
stefan_over 4 years ago
If you run your VPN tunnel on the same machine that is emitting your super-serious must-be-tunneled traffic, you are always just one configuration mishap or even software exploit (if you happen to be a Firefox Tor browser user) away from revealing your real connection.
kodablahover 4 years ago
I have noticed similar simply because the Cisco AnyConnect client doesn&#x27;t work with WSL2 and is a known issue [0]. But that seemed to be blocking traffic instead of just allowing all traffic over non-VPN. However, openconnect does work fine as does the UWP-based AnyConnect client. I wonder how those latter two are successful tunneling traffic (or if it&#x27;s only if they are started before the wsl2 vm is).<p>0 - <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;WSL&#x2F;issues&#x2F;4277" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;WSL&#x2F;issues&#x2F;4277</a>
评论 #24643186 未加载
评论 #24643444 未加载
ani-aniover 4 years ago
This is due to Hyper-V, which is being rolled out on Windows 10 and required for WSL2. The OS is now running as a VM, and virtualized programs like WSL2 are running alongside - these VMs can&#x27;t control each other&#x27;s traffic. It&#x27;s interesting that a feature meant to improve sandboxing actually makes firewalling and VPN more difficult, in its current state. I think the the proper fix is at the Hyper-V level, which might need to explicitly manage firewall and VPN features.
评论 #24646804 未加载
Bedon292over 4 years ago
Docker on Windows can run on WSL2 backend as well. So I assume this would also apply to Docker traffic too.<p>Other interesting note, Docker Windows does some funky stuff with firewalls too. It puts and any&#x2F;any exception in the firewall when you install it [1]. So may also be important to know with VPN stuff.<p>[1] <a href="https:&#x2F;&#x2F;twitter.com&#x2F;richturn_ms&#x2F;status&#x2F;1270766764356366336" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;richturn_ms&#x2F;status&#x2F;1270766764356366336</a>
评论 #24642820 未加载
wanderrover 4 years ago
Related issue with some workarounds that people are reporting various levels of success with: <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;WSL&#x2F;issues&#x2F;5068" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;WSL&#x2F;issues&#x2F;5068</a>
j0057over 4 years ago
Strange then that the WSL2 guest gets a RFC1918 private address, because that would imply that the host is NATing traffic to and from the guest. However that does not happen through the ordinary Hyper-V NAT routing machinery -- at least Get-NetNat shows nothing in Powershell and in fact multiple people have reported broken WSL2 networking because they had leftover NAT rules from old Hyper-V VM&#x27;s. It would help to have some conceptual documentation here about what WSL2 is doing.
Animatsover 4 years ago
Why would someone run a VPN client on Linux under Windows, anyway, as opposed to just running it on Windows?
评论 #24642579 未加载
maple3142over 4 years ago
A little bit off-topic, but I have a problem with WSL2 and Wireguard for Windows. When I enable Wireguard for Windows, WSL2&#x27;s default DNS server will stop working, but directly setting dns server to 8.8.8.8, 1.1.1.1 or something similar works.
xnyanover 4 years ago
I can’t re-create the issue with the mullvad client, or on my work-issued laptop with the Cisco Any-Connect VPN. Everything is dropped the second the VPN goes up.
darumderumover 4 years ago
As I can bypass Kaspersky SSL interception for basically the same reason, I see this as a win and hope it won&#x27;t change
crb002over 4 years ago
Is there a wireshark config for WSL2 so you can browse traffic? eBPF support in WSL2 sufficent?
agustifover 4 years ago
I can&#x27;t even get mine to work or install at my work machine...
siproprioover 4 years ago
WSL 2 also leaks memory, by default it consumes up to 4GB. It&#x27;s awful.
AcerbicZeroover 4 years ago
&quot;WSL2 uses Hyper-V virtual networking and therein lies the problem&quot;<p>Pretty much sums it up.
shmerlover 4 years ago
Using WSL should be a very last resort anyway. Just use Linux straight on your hardware if you have a choice and ditch Windows.
评论 #24642532 未加载
评论 #24642329 未加载
评论 #24643137 未加载
评论 #24645268 未加载
评论 #24642012 未加载
评论 #24642142 未加载
评论 #24642256 未加载
评论 #24641853 未加载