Cool find by @nieldk - if you isolate an asset in MDE (Microsoft Defender), Windows Subsystem for Linux still allows all network traffic (including internally!). So if you're a threat actor, just install WSL, setup SSH or some such and persist access post isolation.

I suspect MS probably need to revisit this one as the attack surface looks rich and unconsidered. E.g. network connections in WSL aren't even logged by Defender.

https://sec1.dk/blog.html

Sec1 Security blog

I had a quick look at the Defender/WSL (Windows Subsystem for Linux) thing at lunch.

It's pretty comical, it looks like the WSL team have unfortunately undercut Defender. E.g. you don't even need to port a backdoor to Linux to maintain access on isolation -- you can just run a Windows trojan in Wine (works in WSL) & the network traffic isn't inspected, logged in Advanced Hunting Query or blocked on isolation. Also WSL can access any local or network files. And it ships built into Windows OS.

Good news, MS have revisited the Defender/WSL issue where network traffic is not inspected/logged (and asset containment is fully bypassed) in Microsoft Defender for Endpoint. Now has a logo and a name - #ShadowBunny. https://infosec.exchange/@nieldk/110198058070907150
nieldk :verified: 💻 (@[email protected])

Attached: 1 image Happy to annonce MS acknowledging my Defender bypass, and a “patch” will be produced ✌️ #shadowbunny. Thanks to @cirriustech for logo ;) which will be added to my blog https://sec1.dk/blog.html this weekend

Infosec Exchange
For anybody tracking #ShadowBunny - it still works as a way to evade device isolation in MDE.

The #ShadowBunny vulnerability in MDE persists over 6 months later - if you contain an endpoint in MDE, Windows Subsystem for Linux apps can all still access the internet.

So if you’re a threat actor, enable WSL from control panel and SSH back to yourself - if the org detects you, your access persists. It also allows internal network access, too.
https://infosec.exchange/@nieldk/111241070277583473

PhreakByte (@[email protected])

7 months ago I reported #shadowbunny-as-a-service to MSRC, one month ago they “hope to have an answer in a few days” lol

Infosec Exchange

As an update to the #ShadowBunny thread - WSL is now being abused by a ransomware threat actor.

WSL opens up a whole attack surface on Windows. The Defender EDR integration is crap, and an optional bolt on.. and other EDR providers have basically no visibility. It’s a mess.

https://www.bleepingcomputer.com/news/security/qilin-ransomware-abuses-wsl-to-run-linux-encryptors-in-windows/

Qilin ransomware abuses WSL to run Linux encryptors in Windows

The Qilin ransomware operation was spotted executing Linux encryptors in Windows using Windows Subsystem for Linux (WSL) to evade detection by traditional security tools.

BleepingComputer
@GossiTheDog as I noted sideways, finally the year of Linux on the desktop

@GossiTheDog Do you have any idea if this is different than enabling hyper-v and running malware from a small VM? Does WSL give more access than mounting C:/ in a VM? Or is visibility worse than from VMs?

I don’t know exactly how WSL works but in my head it’s just tighter integration with a light Linux VM.

@FarmerDenzel @GossiTheDog WSL has a LOT more attack surface. Imagine running a Linux VM on Windows, except you have all the attack surface of Windows plus the Linux VM. If one gets compromised, consider both compromised.

You can even execute WinPEs from within WSL. And the reverse, sending commands to the LinuxVM works as well, using WSL.exe to pass commands directly in.

Not terribly difficult to detect unauthorized use of WSL, but as Kevin says, don’t depend on the Defender EDR plugin. It only supports the default Ubuntu, and doesn’t even show up in Defender dashboard unless it is used for at least 30 minutes.

@GossiTheDog I’m merely surprised it took this long
@GossiTheDog God damnit your feed gives me nightmares sometimes man.
@GossiTheDog any thoughts on detections related to the installation of WSL?
@GossiTheDog It seems to me that this should be solved by the new Mirror mode (https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/) which is available in the Release Preview insider ring.
With this new mode Windows Defender Firewall Rules also apply to WSL. Also you can set WSL to use the Host OS DNS client instead of its own which should also improve on the detection side. It's also possible to add firewall rules only applying to WSL.
Windows Subsystem for Linux September 2023 update

There is a new release for the Windows Subsystem for Linux (WSL) with new features and bug fixes! Check out the summary below, and read on to learn more about new experimental features, and some significant quality improvements. Experimental features We know that WSL is used for a wide array of workflows and we want to help you get the best performance and quality experience from these workflows.

Windows Command Line
@faebudo @GossiTheDog The CIS baseline suggests disabling Internet Connection Sharing but also warns it will break internet access for WSL. Seems like this would be a way to contain these systems.
@GossiTheDog So Defender is working on the wrong level? What exactly are they using to implement that isolation in the first place?
@GossiTheDog luckily third party EDR/EPP can… um…

@GossiTheDog I told 2+ years ago to some red teamer friends that WSL is a gold mine for this exact reason.

Security still depends on Imagination.

@GossiTheDog
Do you need a 'business' sku or can wsl use Home?

@GossiTheDog obligatory stupid question: is this the same behavior in WSL 1 and 2?

I would expect this behavior in WSL 2, due to it having a full Linux kernel - lots of things get hidden from Windows. Whereas since WSL 1 is emulation, lots more is visible, because it’s *technically* just Windows executables.

@TindrasGrove @GossiTheDog

WSL 1 stores its “file system” in a regular folder.

WSL2 uses an ext4 partition in a separate VHDX virtual drive.

I think that might make a difference.

@GossiTheDog I assume they did it so that WSL does not run too slow on Windows. Would same apply to anything else running using Virtual Machine Platform?
@GossiTheDog but just think of the performance gains!
@GossiTheDog What in the mother of fuck fuck

@GossiTheDog That was the first thing I noticed a while back when WSL2 launched. Running nmap as a Windows executable would trigger a port scanning alert from the client, but running nmap under a Linux distro with WSL2 didn’t and Defender didn’t log any of the traffic.

Always seemed like a bit of an oversight.