wsb-detect: detect if you are running in Windows Sandbox
wsb-detect enables you to detect if you are running in Windows Sandbox (“WSB”). The sandbox is used by Windows Defender for dynamic analysis, and commonly manually by security analysts and alike. At the tail end of 2019, Microsoft introduced a new feature named Windows Sandbox (WSB for short). The techniques used to fingerprint WSB are outlined below, in the techniques section. Feel free to submit a pull request if you have any fingerprinting ideas 🎉. I’ve been messing around with it now and then, I will have more on Windows Sandbox coming soon.
Windows Sandbox allows you to quickly, within 15s, create a disposable Hyper-V based Virtual Machine with all of the qualities a familiar VM would have such as clipboard sharing, mapping directories, etc. The sandbox is also the underlay for Microsoft Defender Application Guard (WDAG), for dynamic analysis on Hyper-V enabled hosts and can be enabled on any Windows 10 Pro or Enterprise machine. It’s not particularly interesting but nonetheless could prove useful in implant development. Thank you to my friend Jonas L for guidance when I was exploring the sandbox internals (more to come on this).
The image for the sandbox seems to be built on Saturday, December 7, 2019, 9:14:52 AM – this is around the time Windows Sandbox was released to the public. This check cross-references the creation timestamp on the mountmgr driver.
This method will check if the current username is WDAGUtilityUserAccount, the account used by default in the sandbox.
This method will use GetAdaptersAddresses, walk over the list of adapters, and compare the DNS suffix to mshome.net – which is used by default in the sandbox.
Checks if the raw device \\.\GLOBALROOT\device\vmsmb can be opened, which is used for communication with the host over SMB.
On startup, search under the RunOnce key in HKEY_LOCAL_MACHINE for a command which sets the password never to expire.
Checks for the OfficePackagesForWDAG in the current root drive, which seems to be used for Windows Defender Microsoft Office emulation.
Checks for CExecSvc.exe, which is the container execution service, handling a lot of the heavy lifting.
A more generic method when it comes to sandbox detection, however from tests the Windows doesn’t seem to be verified as legitimate in the VMs
Copyright (c) 2020 Lloyd