mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3727] Allow external debuggers with --noroot? #2347
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2347
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cbs228 on GitHub (Nov 5, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3727
When
--norootis 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_PTRACEcapability 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-debuggersoption? 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--norootlike this?If I misunderstand how this stuff works, please feel free to enlighten me.
@smitsohu commented on GitHub (Mar 20, 2022):
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.
@smitsohu commented on GitHub (Mar 20, 2022):
In fact it is documented in
ptrace(2)Interesting!