mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5827] Allow --caps.keep and newprivs for --chroot #3103
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#3103
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 @azurvii on GitHub (May 12, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5827
Description
I read from the manpage of the version I use (0.9.72 from debian bookworm) for
--chroot:If the sandbox is started as a regular user, nonewprivs and a default capabilities filter are enabled..It seems these are not just default but enforced with no option to alter. e.g. I could not apply
--caps.keep:My ask is to allow people to use these flags in chroots. If the security risk is high, making another mandatory flag (like
--i-like-danger) just to confirm that the user would know what they are doing, to allow this combination to work.I found a similar/same issue, #3567. Though my target program of issue is
podman, vscode/other chrome-based apps. Chrome-based apps could use no sandbox as a workaround, but not all apps have alternatives.@rusty-snake commented on GitHub (May 12, 2023):
This would allow privilege escalation.
@azurvii commented on GitHub (May 13, 2023):
That is what I asked in the title. But I may not have the insights you implied in the sentence.
Could you help to expand a bit more on that, as in how much different are the options used in a regular firejail jail comparing to a firejail chroot?
@rusty-snake commented on GitHub (May 13, 2023):
It would allow every process that can start firejail to become root.
@azurvii commented on GitHub (May 16, 2023):
You mean on the host anyone could invoke
firejail --chrootto obtain root, if caps and newprivs are allowed? How to achieve that if the given options are available?@rusty-snake commented on GitHub (May 17, 2023):
A the point where you can run host-suid with a manipulated root there are just to much ways that you could implement this in a safe way.
Possible exploit ideas contain opening file-descriptors before starting firejail or passing them over a Unix socket, tampering with system libraries or the dynamic linker, ...
@azurvii commented on GitHub (Jun 8, 2023):
I found some examples here, of using
chdir()and open file descriptor with root inside chroot, to break out chroot and become root on the host.I think this would be a problem for a shared system (many users, potentially malicious, could login). For most personal laptop / workstation use cases that only one user logs in, I think this should be less of a problem.
I know one of purposes to run "jail"s is to sandbox untrusted code. However, for this specific feature request, I intend to use chroot to just have a separate place for a system -- I'd like to not have a bunch of
-devpackages, dev tools, etc. on my host. It's much easier to recreate a chroot than reinstalling my host system if I mess something up inside the chroot. I'm responsible for potentially malicious code inside chroot. If anything could do harm inside chroot, it would do the same anyway if I run it outside. I'm not using chroot as a security sandbox, but rather a separate space for a different setup. I thinkchroot's the original idea was not for security, but justto test its installation and build system(ref). That is, I don't mind if things inside chroot can break out. I just need the tools to be able to install and run within the chroot.docker runprovides--privilegedand--cap-addflags, which IMO is similar to what this feature request.dockercan be run with sudo, or by anyone in adockergroup (I think this is a popular setup when installing docker).Why not use
chrootordockerinstead then? Firejail does a much better job setting up a usable GUI chroot.But I agree this carries certain security risk, similar to
docker's--privileged. I think if guarded by a global option (in/etc/firejail/firejail.config), or checking whether a user has permission to run in this mode (maybe afirejailgroup, like thedockergroup fordocker), or both, this should be a useful feature for firejail chroot.