-
Notifications
You must be signed in to change notification settings - Fork 588
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
Allow external debuggers with --noroot? #3727
Comments
I think your observations and conclusions are correct, and I can reproduce a Yama bypass in unprivileged user namespaces. IMHO this is a bug in the kernel. Or at least it should be documented somewhere that unprivileged user namespaces break Yama's promises. |
In fact it is documented in
Interesting! |
When
--noroot
is specified, firejail creates a user namespace with an effective UID of 0, making it owned by the root user.Because the user namespace is owned by root, it is not possible to
ptrace(2)
or attach debuggers which are outside of the sandbox to processes which are inside of the sandbox. Doing so requires theCAP_SYS_PTRACE
capability on the whole system.Normally, I think this is desired behavior, and
user_namespaces(7)
tell us why:This means that any other process running under the same user account has all the capability superpowers, including to attach debuggers. This bypasses the default Yama restriction on Ubuntu and other systems, which denies ptrace without an existing parent/ancestor relationship between processes.
Sometimes we do want to attach external debuggers. mumble-voip/mumble/issues/4506 is a good example of this: we want to allow an unprivileged process to reach in and issue ptrace and memory-reading calls to the process(es) running in the sandbox.
Does it make sense to offer an
--allow-external-debuggers
option? This option might create the user namespace under the real UID of the invoking user—and not root. Would this have other, potentially nasty side-effects? Does it even make sense to use--noroot
like this?If I misunderstand how this stuff works, please feel free to enlighten me.
The text was updated successfully, but these errors were encountered: