Execution
Windows Subsystem for Linux (WSL)
WSL cheat sheet: Lxss registry key, WSL1 rootfs vs WSL2 ext4.vhdx, bash_history inside distros, wsl.exe execution traces, wsl$ share access and evasion.
- Location
- HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss
- Proves
- A Linux distribution was installed for a user, where its file system lives, and that WSL binaries were executed
- Timestamps
- Lxss subkey LastWrite (FILETIME, UTC), Prefetch/Amcache times for wsl.exe (UTC), Linux inode times inside the distro (Unix epoch, UTC)
- Retention
- Distros persist until unregistered (wsl --unregister deletes the rootfs or ext4.vhdx); Windows-side traces follow Prefetch and Amcache retention
- Access
- Per-user NTUSER.DAT and the distro folder; ext4.vhdx is locked while the WSL2 VM runs: shut down WSL or copy from VSS
- Evidence of
- ExecutionAnti-forensics & deletion
- Type
- Registry
- Windows
- 1011
- KAPE target
- RegistryHivesUserPrefetchAmcache
- Velociraptor
- Windows.Triage.Targets:RegistryHivesUserPrefetchAmcache
Tools
Compare all tools- Registry ParserIn browser
- Prefetch ParserIn browser
- Amcache ParserIn browser
- Disk Image ParserIn browser
- ShellBags ParserIn browser
- LNK ParserIn browser
- Registry ExplorerGUI
- PECmdCLI
- AmcacheParserCLI
- Arsenal Image MounterGUI
- The Sleuth KitCLI · open source
- PlasoCLI · open source
- VelociraptorPlatform · open source
What it is
The Windows Subsystem for Linux runs Linux user space on Windows 10 and 11. WSL1 translates Linux system calls through a kernel driver (lxss.sys / lxcore.sys) and stores the Linux file system as ordinary NTFS files. WSL2 runs a real Linux kernel in a lightweight Hyper-V utility VM, with the distro's file system inside an ext4.vhdx virtual disk. For an investigator a WSL distro is a second operating system on the same disk: its shell history, SSH keys, cron jobs and dropped tools are Linux artifacts, and most Windows telemetry never sees what happens inside it.
Location
| Source | Path |
|---|---|
| Registered distros | HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss\{GUID} in each user's NTUSER.DAT |
| Default distro | DefaultDistribution value under ...\Lxss |
| Store distro folder | %LOCALAPPDATA%\Packages\<PackageFamilyName>\LocalState\ (for example CanonicalGroupLimited.Ubuntu..._79rhkp1fndgsc) |
| WSL1 file system | <BasePath>\rootfs\ (NTFS files, Linux metadata in extended attributes) |
| WSL2 file system | <BasePath>\ext4.vhdx |
| Imported distros | Any folder passed to wsl --import; always read BasePath |
| User WSL config | %USERPROFILE%\.wslconfig; inside the distro /etc/wsl.conf |
| Windows binaries | C:\Windows\System32\wsl.exe, wslhost.exe, wslconfig.exe, bash.exe; Store-delivered WSL under C:\Program Files\WSL\ on recent versions |
What it proves
- Installation: an Lxss subkey shows a distro was registered for that user, with its name and storage path.
- Execution of WSL: Prefetch and Amcache entries for
wsl.exe,bash.exe,wslhost.exeor the distro launcher (ubuntu.exe,kali.exe) prove WSL was started, and when. - Linux activity:
.bash_history,/var/log,/tmp,/etc/passwd, crontabs and SSH material inside the distro show what was done in Linux. - File exchange: paths like
\\wsl$\Ubuntu\home\...or\\wsl.localhost\...in ShellBags, LNK files and Jump Lists prove Windows applications browsed the Linux file system. Inside Linux,/mnt/c/...in shell history shows the reverse.
It does not give you per-command Windows evidence. Linux processes run under WSL do not generate Prefetch files for the ELF binaries, and in WSL2 they run inside a VM outside most Windows process telemetry. Absence of Linux history is also weak evidence: HISTFILE can be unset, and history is only flushed when the shell exits cleanly.
Key fields
| Value (Lxss\{GUID}) | Meaning |
|---|---|
DistributionName | Name used by wsl -d (Ubuntu, kali-linux, a custom import name) |
BasePath | Folder holding rootfs\ (WSL1) or ext4.vhdx (WSL2) |
PackageFamilyName | Store package; empty for wsl --import distros, which is worth noting |
DefaultUid | Linux UID used at login (0 = root by default) |
Flags | Bit field; on current builds bit 0x8 indicates WSL2. Do not read the Version value as the WSL version: it reflects the file system format |
State | Registration state (1 = installed) |
Timestamps
- Lxss subkey LastWrite (FILETIME, UTC): registration or last configuration change (conversion, default user change).
- Prefetch / Amcache for WSL binaries: first and last launches in UTC.
- ext4.vhdx $SI modification time: roughly the last time the WSL2 VM wrote to the distro.
- Inside the distro: ext4 inode times (atime, mtime, ctime and crtime) in Unix epoch, UTC. In WSL1, Linux times are stored in NTFS extended attributes alongside normal NTFS timestamps, so both sets exist and can disagree.
Retention and clearing
A distro persists until wsl --unregister <name>, which deletes the rootfs or ext4.vhdx without prompting; the Lxss key disappears with it. The deleted VHDX may be recoverable from unallocated space or Volume Shadow Copies, and the $MFT and USN journal keep its file name and deletion time. Uninstalling the Store app also removes the package folder. Windows-side execution traces follow normal Prefetch and Amcache retention.
Collection
# Registered distros for the current user
Get-ChildItem 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss' |
ForEach-Object { Get-ItemProperty $_.PsPath } |
Select-Object PSChildName, DistributionName, BasePath, Flags, DefaultUid, PackageFamilyName
wsl --list --verbose
:: Stop the VM so ext4.vhdx is no longer locked, then copy it
wsl --shutdown
robocopy "%LOCALAPPDATA%\Packages\<PackageFamilyName>\LocalState" E:\case\wsl ext4.vhdx /COPY:DAT
On a triage image, collect every user's NTUSER.DAT, the LocalState folders and any custom BasePath. For WSL1, copying rootfs with Windows tools loses Linux permissions and extended attributes; prefer a raw image or an NTFS-aware collector.
Parsing tools
- Registry Explorer / RegRipper for the Lxss key in offline hives.
- PECmd and AmcacheParser for WSL binary execution.
- Arsenal Image Mounter,
qemu-nbdorguestmounton Linux to mountext4.vhdxread-only; The Sleuth Kit and Plaso (dfVFS) can read VHDX and ext4 directly. - Once mounted, treat it as a Linux system: shell histories,
auth.log, crontabs,~/.ssh, package manager logs. The linuxforensics.app cheat sheets cover those artifacts in depth.
Investigation tips
- On a server or finance workstation, any Lxss key is worth a question. Check whether the WSL optional feature or
VirtualMachinePlatformwas enabled recently and by whom. PackageFamilyNameempty plus an oddBasePathmeanswsl --importof a custom tarball: attackers use this to bring a preconfigured distro with tools already inside.- Attackers favour WSL2 to run Linux tooling (scanners, tunnels, credential tools) out of reach of Windows EDR hooks. Network connections from WSL2 appear to come from the VM's virtual adapter; correlate with firewall logs and SRUM for
wslhost.exeor thevmmem/vmmemWSLprocess. - Search Windows artifacts for
\\wsl$and\\wsl.localhostpaths, and Linux history for/mnt/c/Users/: that is where data crosses between the two worlds. DefaultUid0 means the distro logs in as root, which removessudotraces fromauth.log.
Related artifacts
- Prefetch Files (.pf)Windows Prefetch cheat sheet: .pf location per version, run count, the last eight run times, referenced files, retention limits and how to parse.
- Amcache.hveAmcache.hve cheat sheet: file and program inventory keys, SHA-1 hashes, PE metadata, timestamps and why an entry alone does not prove execution.
- ShellBagsShellBags cheat sheet: BagMRU and Bags keys in UsrClass.dat and NTUSER.DAT, shell items, folder timestamps, deleted and USB folders, and parsing with SBECmd.
- LNK shortcut filesLNK cheat sheet: Recent folder shortcuts, first and last open times, embedded target timestamps, volume serial, network share and TrackerDataBlock MAC.
- Master File Table ($MFT)$MFT cheat sheet: FILE records, $SI vs $FN timestamps, resident data, deleted records, sequence numbers, timestomping checks and MFTECmd parsing.
- USN Journal ($UsnJrnl:$J)USN journal cheat sheet: $UsnJrnl:$J and $Max, record fields, reason flags, parent references, default size, rollover, fsutil and MFTECmd parsing.
- Mounted Disk Images (ISO, IMG, VHD, VHDX)Mounted disk images cheat sheet: ISO/IMG/VHD/VHDX mounts, VHDMP events, MountedDevices, LNK and Jump List traces, Mark-of-the-Web gaps and a detection workflow.
- Installed Programs (Uninstall Keys, MSI, AppX)Installed programs cheat sheet: Uninstall keys, MsiInstaller events 1033/11707, cached MSIs, AppX packages, winget logs and Amcache to date software installs.
Glossary terms
- NTUSER.DATThe per-user registry hive stored in each Windows profile and loaded as HKEY_CURRENT_USER, rich in user activity and persistence traces.
- Anti-forensicsTechniques used to destroy, hide or falsify evidence, such as log clearing, timestomping, wiping and deleting shadow copies or the USN journal.
- Evidence of executionArtifacts that show a program actually ran on a Windows system, as opposed to merely existing on disk, and how strongly each one supports that claim.
- Registry key LastWrite timeThe single FILETIME stored in every registry key that records when the key or one of its values was last changed, in UTC.
- Alternate Data Stream (ADS)An additional named $DATA stream attached to an NTFS file, invisible in Explorer, used for Mark of the Web and sometimes to hide data.
Guides
- Evidence of Execution: Prefetch, Amcache, BAM and MoreProve a program ran on Windows, not just existed: Prefetch, ShimCache, Amcache, BAM, UserAssist, SRUM, PCA, WER and 4688 compared, with parsing commands.
- Detecting Windows Anti-Forensics: What Survives the CleanupDetect log clearing, timestomping, secure deletion, VSS deletion and Defender tampering on Windows, mapped to MITRE ATT&CK, with the traces each one leaves.
- User Activity Forensics: ShellBags, LNK Files and Jump ListsProve which files and folders a Windows user opened, and when: ShellBags, LNK files, Jump Lists, MRU keys, Office Trust Records and Timeline, correlated.