Re:Vim/Neovim Arbitrary Code Execution via Modelines
by butteroverflow on Tuesday June 04, 2019 @11:04PM
(#20101140)
Well, you can do it right now with firejail. Start with the default config, it prevents access to many sensitive files; then either add more sensitive locations to blacklist, or blacklist your whole home directory and whitelist whatever is necessary.
I don't recall the exact configuration format, but it's something really simple, like
whitelist ~/src/*
Re:Vim/Neovim Arbitrary Code Execution via Modelines
by oidz on Tuesday June 04, 2019 @08:50PM
(#20100603)
Is this problem not solved by virtual environments or chrooting ? Potentially a simple wrapper script could be created around chroot that only installs the programs you need.
Re:Vim/Neovim Arbitrary Code Execution via Modelines
by the_pwner224 on Tuesday June 04, 2019 @09:11PM
(#20100687)
Chrooting loses global configuration files and libraries and tools that you have installed. This has a similar effect, is not as strong, but is simpler.
For example: I mark ~/school/operating-systems as a development directory. I place git, vim, wget, curl, and make on the blacklist (potentially globally-configured). Additionally I whitelist ~/.config/git for git and ~/.vim for vim. This allows core commands that we consider 'safe' like cd, mv to be run without restrictions - presumably they are only being used manually or from sandboxes tools like Make. But when I execute git from anywhere inside ~/school/operating-systems, it will only be able to R/W inside that directory and within the ~/.config/git directories. Meanwhile read access to system folders lets Make etc. work properly.
With a single global configuration + directory-specific overrides, it remains pretty straightforward and doesn't require a huge time investment like AppArmor/SeLinux do. Meanwhile all non-dev work remains unaffected. If you need to download and build a random program, just mark it as a dev directory and you're pretty safe. It's not perfect, but better than nothing