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

protection against unprivileged symbolic links? #2

Open
maltek opened this issue Oct 24, 2019 · 3 comments
Open

protection against unprivileged symbolic links? #2

maltek opened this issue Oct 24, 2019 · 3 comments

Comments

@maltek
Copy link

maltek commented Oct 24, 2019

Hi,

I've been dealing with some privileged code lately that needs to do e.g. chown on paths owned by arbitrary users. There, the most sensible way to deal with symlinks without allowing privesc is to only follow them if the owner of a link and its target match - or if the link is owned by root. (Somewhat like what the kernel does in directories with sticky bits if fs.protected_symlinks is on.)

Do you consider such a protection in scope for this library? (From a quick scan over the code, I couldn't see it already implemented.)

@cyphar
Copy link
Member

cyphar commented Oct 24, 2019

It isn't implemented, though I'm not definitely not against the idea. Though, one problem is that we cannot (as easily) implement it for the kernel-mode driver because that actually does the resolution in-kernel.

Though, I think there is a question about what threat model we are defending against by implementing it -- symlinks will always be resolved within a given Root, so are we saying that even within a Root we want to stop an administrative process from following links that could be bad if an in-container administrative process followed them?

@maltek
Copy link
Author

maltek commented Oct 24, 2019

Yes, that's the threat model I have in mind. Prevent in-container-unprivileged-user from triggering file system changes that could allow it to escalate to in-container-root. (My use-cases aren't actually with containers at all, but I don't think that changes things.)

@cyphar
Copy link
Member

cyphar commented Oct 24, 2019

For the kernel side, I could try to add a RESOLVE_PRIVILEGED_SYMLINKS to a future version of the openat2 patchset which implements those semantics. But I'd like to get openat2 merged first 😉.

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