Skip to content
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

Install script causes $LD_LIBRARY_PATH to include cwd. #276

Open
wapiflapi opened this issue Feb 2, 2019 · 1 comment
Open

Install script causes $LD_LIBRARY_PATH to include cwd. #276

wapiflapi opened this issue Feb 2, 2019 · 1 comment

Comments

@wapiflapi
Copy link

wapiflapi commented Feb 2, 2019

The install scripts causes .bashrc to source ~/torch/install/bin/torch-activate which in turn exports some environnement variables. This is defined here https://github.com/torch/distro/blob/master/install.sh#L168

There is an issue with the way LD_LIBRARY_PATH is handled:

export LD_LIBRARY_PATH=/home/wapiflapi/torch/install/lib:$LD_LIBRARY_PATH

When $LD_LIBRARY_PATH didn't exist or was empty before, it will now end with a colon this means the last "path" after said colon is empty which causes the linker to look in the current working directory for libraries.

This is a security issue because unexpected code can get run simply by visiting "untrusted" directories (for example checking out a git repo or cd-ing into a tarball.)

Demo:

wapiflapi@box:/tmp/demo$ export LD_LIBRARY_PATH=""  # Plausible initial state.
wapiflapi@box:/tmp/demo$ head -c4k /lib/x86_64-linux-gnu/libc.so.6 > libc.so.6 # corrupted libc.
wapiflapi@box:/tmp/demo$ ls
libc.so.6
wapiflapi@box:/tmp/demo$ . ~/torch/install/bin/torch-activate
wapiflapi@box:/tmp/demo$ ls
Bus error
wapiflapi@box:/tmp/demo$ echo $LD_LIBRARY_PATH # This is why.
/home/wapiflapi/torch/install/lib:
wapiflapi@box:/tmp/demo$ 
@jainal09
Copy link

Thank me later!
Use this docker file for torch installation!
https://github.com/runwayml/alpha_models/blob/master/densecap/Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants