mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #7070] blink-common: Is caps.keep sys_admin necessary? #3476
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#3476
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 @cobratbq on GitHub (Feb 19, 2026).
Original GitHub issue: https://github.com/netblue30/firejail/issues/7070
Sorry for dumping this out-of-the-blue, just close if unwanted. I'm browsing profiles for ideas because I'm writing a new profile, then I find this and wonder if it really necessary, that capability
SYS_ADMINis preserved inblink-common.profile?bbb9787070/etc/profile-a-l/blink-common.profile (L30)This seems like overreaching, and I can only imagine the chromium sandbox to be the reason for this. This is buried deep, and affects chromium-based browsers and electron-apps alike.
Description
Security-esque question.
Steps to Reproduce
bbb9787070/etc/profile-a-l/blink-common.profile (L30)Expected behavior
I would expect
SYS_ADMINto be dropped due to it being quite powerful.Or, if really necessary, maybe makes sense to add a comment stating why it is necessary(?)
Actual behavior
It keeps
SYS_ADMINand is buried quite deep, impacting chromium and electron apps alike.Behavior without a profile
N/A
@cobratbq commented on GitHub (Feb 19, 2026):
I checked on Debian trixie, and when removing
CAP_SYS_ADMIN, the sandbox seems to work just fine. From thegit blamereport, it seems to trace back to a formerchromium-sandbox.profile.Now, without
CAP_SYS_ADMIN(removed fromblink-common.profile), if I runchrome://sandboxI get everything but non-broker-ptrace, but I haveptrace_scoperestricted in sysctl. (I did use--ignore=apparmor, but Debian's apparmor profile seems to screw up without using/usr/bin/firejailtoo.)--debugreports:set caps filter 40000.Someone with more knowledge should verify, but I think
sys_admincan just be removed from the profile. It seems to create an unnecessarily large hole in restrictions.@kmk3 commented on GitHub (Feb 20, 2026):
It looks like it was added in the following commit:
021607388("add caps.keep to chrome/chromium", 2017-05-22)The main issue is that what chromium uses might depend on multiple system-level
things, like apparmor and ptrace that you mentioned and potentially also
unprivileged user namespaces.
In the sense that if something is not available, it might fall back to
trying to increase privileges.
It would be good to check the chromium source code to see what exactly it uses
this capability for and under what conditions, to see what would be affected if
the capability is removed.
Same for
sys_chroot.@cobratbq commented on GitHub (Feb 20, 2026):
I wanted to ask the above, but then I received an update which prevents Debian's chromium from running completely. So I am not sure how to interpret previous results.
I was thinking of adding
sys_ptraceas ptrace is known to be used, and may be of influence depending on configuredkernel.yama.ptrace_scopesetting (1for parent-process,2for ptrace-capability,3to disable completely).I would think unprivileged user-namespaces don't require a capability, but then there are some restrictions w.r.t. apparmor and sysctl settings that prevent certain combinations. I can't speak about anything else yet.
@kmk3 commented on GitHub (Feb 20, 2026):
To clarify, I mean in the sense that unprivileged user namespaces might be
disabled system-wide (like with ptrace).
In which case the program might see that it is unavailable, raise privileges
and try again or just raise privileges and do it in another way entirely (such
as by bind-mounting paths, etc).
@cobratbq commented on GitHub (Feb 20, 2026):
This is incorrect. I forgot to disable AppArmor, and AppArmor was still blocking it because of user-namespaces being unavailable.
Facts:
chrome://sandboxreports effective results of acquired level of sandboxing (and claims "You are adequately sandboxed.", on Debian)firejail --debugdemonstrates changing capabilities in "Set caps filter 40000". (Withoutsys_admin, with onlysys_chrootkept.)denied="userns_create"); or through--restrict-namespaces=userkernel.yama.ptrace_scope=2reports same sandboxing results whether whether or notsys_ptracesyscall preserved. (I need to try with value1. Value3always blocks.)sys_chrootalso does not seem to be required. (Effective sandboxing results do not change when removed.)firejaildepends on a correct apparmor profile or, conversely, allows disabling AppArmor (--ignore=apparmor) in case there isn't. It is out of your control anyways.net,pid,usercgroup,ipc,mnt,time,utsI understand your position on checking the sources. However, I wonder if we can reasonably derive what we need to know from behavior. I have removed preservation of any capabilities. It doesn't complain; it starts. The quality of the sandbox is not affected in a reported/detected way. Except, in case of mentioned namespace-restrictions, the application refuses to start if absent through whichever means.
@cobratbq commented on GitHub (Feb 21, 2026):
With user-namespaces disabled via
sysctl user.max_user_namespaces=0, chromium is forced to look forchrome-sandbox(setuid), and then requiresCAP_SYS_ADMIN. It fails to start ifchrome-sandboxis not available. I have not found another capability that accomplishes the same thing. (I.e. chromium behaves differently withuser.max_user_namespaces == 0.)chrome://sandboxmarks the SUID-sandbox as "yellow", instead of green, hinting at inferior solution.In my understanding, it is not possible to set separate permissions/capabilities on a different executable? I.e. they're managed on the "live process".
So, I see possibilities that I haven't explored:
CAP_SYS_ADMIN(or otherwise possibility to create namespaces) tochrome-sandbox? (Yes, you cannot rely on this, strictly speaking, as I stated myself.)NONEWPRIVSto conditionally grantCAP_SYS_ADMINspecifically tochrome-sandbox? (Also explicitly mentioned for--nonewprivsparameter.)user-namespaces-available, which I don't think exists.If user-namespaces are available, then
caps.drop allis possible/viable without affecting sandboxing effectiveness, according tochrome://sandbox.@kmk3 commented on GitHub (Feb 21, 2026):
It's nice to see that
chrome://sandboxmakes it clear enough when it'sworking vs not.
This is more or less what I expected.
Thanks for all the testing.
Maybe a conditional could be added for unprivileged user namespaces.
Example:
The negation part (
?!) does not exist currently, but it could easily be added.Also, note that any change to blink-common would affect all blink-based
programs, including electron-based ones, not just chromium and derivative
browsers.
@rusty-snake
Thoughts?
@rusty-snake commented on GitHub (Feb 21, 2026):
8ffeed77da/etc/profile-a-l/blink-common.profile (L24-L27)@rusty-snake commented on GitHub (Feb 21, 2026):
So all what you need is
@kmk3 commented on GitHub (Feb 21, 2026):
That would be nice, but unfortunately it looks like conditionals do not work
for
include:From
man firejail-profile:@rusty-snake commented on GitHub (Feb 21, 2026):
Yeah, would need to inline it. However the point was more on not need
?!and being more than caps.@cobratbq commented on GitHub (Feb 21, 2026):
Layer 1 Sandbox:
Namespace(green), orSUID(yellow, this ischrome-sandbox), orNone(red)PID namespaces:
yes/noNetwork namespaces:
yes/noSeccomp-BPF sandbox:
yes/noSeccomp-BPF sandbox supports TSYNC:
yes/noPtrace Protection with Yama LSM (Broker):
yes/noPtrace Protection with Yama LSM (Non-broker):
yes/noOr, all disabled and all red (None, no, no, ...) when started with
--no-sandbox.@kmk3 commented on GitHub (Feb 25, 2026):
I agree that conditionals +
includewould be nicer (and less verbose), butmaking conditionals work with
includein the code seems considerably morecomplicated than just adding
?!.(At least considering a previous experience of trying to add
profile_add("include ...")to some part of the code, seeing that it does notwork, trying to make
profile_add()work withinclude, then giving up aftermany hours.)
Thoughts on adding
?!for the time being?It might be useful for other conditionals as well (I vaguely remember wanting
to use a negated conditional before).
@rusty-snake commented on GitHub (Feb 25, 2026):
Four lines with ? or four negated lines with ?!. I see difference.
@cobratbq commented on GitHub (Mar 5, 2026):
Also, the boolean for
has-user-namespacesshould probably be derived from multiple indicators. Chromium behaves differently when receiving permission-denied on attempt to create namespaces, than it does whenuser.max_user_namespaces = 0.@rusty-snake commented on GitHub (Mar 5, 2026):
EPERM vs ENOSPC. I would say they are available if a test-helper can
unshare(CLONE_NEWUSER).@cobratbq commented on GitHub (Apr 10, 2026):
Yes, and I've ran into this again, and I wonder if firejail needs to support
--restrict-namespaces=user:ENOSPCsyntax such that it is configurable what "signal" to send when rejecting (user-)namespaces. Considering that at least Chromium behaves differently depending on this response, i.e. if firejail could reject withuser:ENOSPC, then Chromium would likely default tochromium-sandboxas fallback. (Firefox shows the same err-message regardless ofEPERMorENOSPC.)