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

Suggested configuration is not secure #4

Closed
randomstuff opened this issue Sep 19, 2017 · 4 comments
Closed

Suggested configuration is not secure #4

randomstuff opened this issue Sep 19, 2017 · 4 comments

Comments

@randomstuff
Copy link

randomstuff commented Sep 19, 2017

The suggested configuration is not secure:

^scp -p( -d)? -t( --)? /srv/reprepro/incoming(/[^ /]*)?$
^chmod 0644 /srv/reprepro/incoming/[^ /]*$
^reprepro ( -V)? -b /srv/reprepro processincoming foobar$

The first and second regex can be abused to execute arbitrary commands:

SSH_ORIGINAL_COMMAND='scp -p -t /srv/reprepro/incoming/&echo    owned' /usr/lib/restricted-ssh-commands test.conf 

where a TAB is used instead of spaces between echo and owned.

/ is blacklisted but a rm -rf / can be executed using $(printf "\x2f") for example.

The documentation should probably warn about the dangers of accepting TAB CR LF $ "" '' `` & ; and so on in the regex.

@carnil
Copy link

carnil commented Sep 21, 2017

Bug report in Debian: https://bugs.debian.org/876392

@bdrung
Copy link
Owner

bdrung commented Sep 28, 2017

Thanks for reporting the bug.

@bdrung bdrung closed this as completed in 4f7e1b8 Sep 28, 2017
@bdrung
Copy link
Owner

bdrung commented Sep 28, 2017

Can you review the man page changes in commit 4f7e1b8? I will prepare a new release if you are happy with the docs.

@randomstuff
Copy link
Author

I think including . in the pattern allows you to use /srv/reprepro/incoming/.. ;) and escape into /srv/reprepro/. Apart from that it looks good.

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

3 participants