-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store the switch.py rootfs files somewhere else or remove their /etc/shadow files for security reasons. #19
Comments
Nevermind, Roli, there are bigger problems with protecting the shadowfile now since 14951: |
I was about to create a separate directory for rootfs-s and just set
As you can see, the non-active etc/passwd has the correct attributes, but is still displayed with 777 permissions. Created a file on my desktop from Windows, tried to set 000 on it, and all it did was set the read-only attribute on the file:
I'll continue experimenting. Maybe I can do something using Windows permissions which would not allow WSL to go into that directory, yet my script can work with it freely, preferably without admin rights. |
As long as you are the owner of the folder (which you are, since it's under your AppData) you can grant or deny yourself permission, and that will also work under WSL:
Unfortunately, under newer WSL which supports running Windows commands, you can just run the I don't think this issue can be solved on my end, other than just making sure the switcher will always sync the passwd/shadow, therefore overwriting any malicious changes. |
Alternatively, I could introduce an optional "elevated security" option, which requires the scripts to run under admin, and would change the ownership of the non-active rootfs folders to something other than the regular user, so you won't be able to use But, you can run WSL as admin, (as Windows Admin, not root) at which point you can use |
Yeah, force-syncing will work. |
Hiya Roli, I found a kind of security flaw in the design of the distro switcher.
Suppose you have a no-goodnik on your bash install through ssh. Right now, if you've used the WSL-switcher, they can just go do
cd /mnt/c/Users/Username/AppData/Local/lxss
then if there is any other rootfs than the default one, say
rootfs_ubuntu_xenial
, they can just enter that withcd
and read off of/etc/shadow
.Two possible solutions: One, regenerate/delete the
/etc/passwd
and/etc/shadow
files inswitch.py
, or store therootfs_distro_tag
folders inside of%localappdata%\lxss\rootfs\sbin
, since Microsoft protects viewing that from bash, and bash prevents non-root users from viewing it (because of the nature of sbin).The text was updated successfully, but these errors were encountered: