Running dangerous linux commands in bash enviroment on Windows
Solution 1:
Bash on Ubuntu on Windows doesn't have the same isolation as a VM. There are even mount points to facilitate the use of non-Linux files from inside the Bash environment. For example, /mnt/c
is the Windows C:\
structure. And since Linux programs can access that branch, dangerous commands can damage it.
I tested the total recursive deletion command (inside a Windows VM) and it did a nice job of deleting all the files my Windows account had access to. Once it finished, all my personal files were gone, including the library folders (even Desktop). Of course, the Linux commands were gone too.
For additional destructive science, I reverted the VM back to before the command and then issued it again, but with Bash on Ubuntu on Windows running as administrator. It still made a lot of "access denied" errors because not all Windows files allow full control to Administrators by default, but there was still devastation. On restart, the system bluescreened with CRITICAL_SERVICE_FAILED
.
So yes, dangerous commands inside Bash can affect your host system.