mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #2401] CVE-2019-5736 #1602
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#1602
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 @SkewedZeppelin on GitHub (Feb 13, 2019).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2401
Is firejail vulnerable to this? It seems to be a common implementation issue when using privileged namespaces.
runc, docker, k8s, lxc, and flatpak have all had patches issued for it.
See
0a8e4117e76400238d08cd2142888f@smitsohu commented on GitHub (Feb 13, 2019):
This blog post has some additional details and seems to indicate that Firejail is not vulnerable, the key part being
Firejail has everything in one binary and in general outlives the sandboxed process. In other words, Firejail's situation is more similar to LXC than to runc, with the added advantage that we don't have an equivalent to the
lxc-attachbinary - it's the same Firejail binary all over, including for--join.Only killing a master process with a signal other than SIGTERM or SIGINT (e.g.
pkill -9 firejail) might potentially invalidate this assumption, but this is just a guess, and it is impossible to do from inside the sandbox due to the pid namespace.In any case
--norootis expected to defend against this.@smitsohu commented on GitHub (Feb 14, 2019):
After playing with publicly available exploit code, I can confirm there is a problem if following conditions are met:
kill <pid>) or SIGINT (ctrl+c). This cannot be done from inside the sandbox (because of the pid namespace), and also it cannot be done from the outside without root privileges. As only root him/herself is able to kill the sandbox in this way, this kind of attack is not relevant with regards to Firejail's SUID property.Because this is a sandbox escape, the obligatory read-only mount and
private-binare no mitigations. I couldn't win the race for writing the payload, but it was possible to truncate the Firejail binary to length zero.So for the time being, if your sandboxes are root and you need to hard kill a sandbox (
kill -9 <pid>), preferably send the signal to the second firejail process rather than the first one (checkfirejail --tree).@netblue30 ?
@ghost commented on GitHub (Feb 15, 2019):
@smitsohu Is this what happens currently when using
firejail --shutdown=foo? Or in other words, is the --shutdown=name/pid construct affected by this in any way? Just trying to understand the code, especially https://github.com/netblue30/firejail/blob/master/src/firejail/shutdown.c@SkewedZeppelin commented on GitHub (Feb 15, 2019):
@glitsj16 it sends a SIGTERM and if after 10 seconds it hasn't closed it sends a SIGKILL.
I am unsure which process it goes to.
@ghost commented on GitHub (Feb 15, 2019):
@SkewedZeppelin I noticed the SIGTERM/SIGKILL routine, thanks for explaining. If I read shutdown.c correctly, the SIGKILL goes to the child first. But I'm at best a beginner with C. And I was unsure too if that corresponds with what smithsohu refers to as first/second firejail process. Currently I don't have any firejail sandbox running as root, so I shouldn't have to worry about this. Sorry for the noise here, it's reassuring to see CVE's are getting proper attention/discussion in firejail!
@smitsohu commented on GitHub (Feb 15, 2019):
@glitsj16 yes,
--shutdownalways kills the second firejail process/child first:--shutdownaccepts pids and sandbox names. If a sandbox name was passed, firejail will translate it to the pid of the first process/firejail parent, but a user can pass the pid of the second process/firejail child as well....If pid is the parent, the child will be force-killed first (though the timespan between the two kills is very short). If pid is the child, it is the target of the second force-kill, and the parent terminates regularly.
Anyway,
firejail --shutdown=sthitself is another running instance of the firejail binary that outlives the sandbox that is being shut down, so I guess this should be safe.@smitsohu commented on GitHub (Feb 17, 2019):
And that was wrong,
--shutdownalso had this problem (now fixed in shutdown.c)@ghost commented on GitHub (Feb 17, 2019):
👍
@t4777sd commented on GitHub (Apr 29, 2019):
For clarification, did profiles with noroot protect against this even if the parent process was killed before the child?
@smitsohu commented on GitHub (Apr 30, 2019):
I would say yes,
norootdefends in any case. The attacker being root is a necessary precondition, otherwise there is no write permission on the Firejail binary.Edit:
while the above is true in most scenarios, some capabilities (like setuid, dac_override) allow to work arounddoesn't apply, as the new user namespace has no capabilities in the parent namespacenoroot. So if a way exists to somehow acquire one of these capabilities, at least one option out ofnonewprivs/seccomp*/protocol/memory-deny-write-execute/caps.drop=allwould be necessary in addition tonoroot.@reinerh commented on GitHub (May 31, 2019):
This issue got CVE-2019-12499 assigned.
@reinerh commented on GitHub (May 31, 2019):
@netblue30 Can you please update the CVE status page? https://firejail.wordpress.com/download-2/cve-status/
@netblue30 commented on GitHub (Jun 8, 2019):
LTS version also released, CVE status page updated - https://firejail.wordpress.com/download-2/cve-status/