Comment

Comment by LukeShu

The article claims that things like Bash's restricted mode are ineffective. It gives the example:

    parent$ bash --restricted
    child$ cd ..
    bash: cd: restricted
    child$ pwd
    /home/rjones
    child$ bash
    grandchild$ cd ..
    grandchild$ pwd
    /home
where the escape is that 'child' was able to create the non-restricted shell 'grandchild'. If you think that properly configuring a restricted bash shell is a simple as executing `/bin/bash --restricted`, then you need to read the manual. The restricted shell can execute arbitrary programs in $PATH; to deploy a restricted Bash shell, you'll need to construct a PATH with whitelisted programs that it is safe to execute. The restricted Bash cannot adjust PATH, and it cannot execute programs outside of PATH.

Something like:

     $ PATH=/etc/restricted-bin bash --restricted
where /etc/restricted-bin contains symlinks to or stub-wrappers for programs that the restricted shell should be able to use.
parent LukeShu 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton