mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #4206] [NOT SURE IF BUG] multiple instances of same application started via "firejail --private $PROG" not isolated but share data #2579
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#2579
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 @mirko on GitHub (Apr 21, 2021).
Original GitHub issue: https://github.com/netblue30/firejail/issues/4206
I'm starting a firefox instance explicitly via
firejail --private firefoxand start browsing.Then I'm starting a second firefox instance again via
firejail --private firefoxwhile the first one is still running.A bit confused I noticed, that while typing an URL it autocompletes to sites I browsed in the first instance.
Bug and expected behavior
Describe the bug.
The instances started via
firejail --private $PROG(in my case PROG=firefox) are not isolated from each other and share data.What did you expect to happen?
Every instance of $PROG started via
firejail --privatebeing fresh and isolated from other instances.No profile and disabling firejail
firejail --private --noprofile firefoxin a terminal?nothing
Reproduce
Steps to reproduce the behavior:
firejail --private firefoxfirejail --private firefoxand access data stored by instance started in (1)Environment
lsb_release -a,screenfetchorcat /etc/os-release)firejail --version) exclusive or used git commit (git rev-parse HEAD)firejail version 0.9.64.4If it's not a bug, on a scale from 1 to 10: how silly is it me being surprised by this behaviour?
@ghost commented on GitHub (Apr 21, 2021):
There's some confusion here. Both issue title and the above issue description seem to suggest you are seeing this behavior with all applications. Yet IMO this is mainly focussing on firefox, which has a set of parameters of its own, like
--no-remoteand--new-instancethat explain what you're seeing. So no, IMO this isn't a bug in firejail, but a lack of understanding the application you're trying to sandbox (Firefox). See #1319 for example.To be clear, can you provide another example of an application that shares data besides running multiple firefox instances? On a side note, we have discussions too now, so when unsure if you have a bug, might be more appropriate to open a discussion thread instead.
Hard to answer. It's always good practice to get familiar with the ins and outs of the applications you want to sandbox. In this case I'd suggest running
firefox --helpand consult the upstream help pages if some of these app-internal options are unclear.@mirko commented on GitHub (Apr 22, 2021):
Hey, thanks for your answer.
Yes, I'm atm only seeing this behaviour with firefox, which obviously doesn't mean it's only happening with firefox.
Since you're using the term "sandboxing" yourself, I have to admit I indeed would expect an application being sandboxed/jailed, it being isolated to a degree that above described behaviour is /not/ happening when sandboxing it with the most restricting option the sandboxing suite provides me with (in this case
firejail --private) - regardless of the IPC features the to be sandboxed application implements.As you're saying it's not firejail but firefox, I have to assume firejail is not sandboxing the applications I'm using firejail on to the degree I expected firejail to do.
Don't get me wrong, I'm not blaming / fingerpointing here and quite well understand what's happening on the technical level here, but it seems I used firejail with wrong assumptions, mainly, that the processes are being isolated from each other and only share a bare minimum of resources necessary for their basic functionality (audio, video on the higher level, potentially a couple of sockets (e.g. dbus, etc.) on the lower level), but do not do IPC / expose such data to unrelated processes (*).
And I'm kind of afraid it's not only me having this assumption.
(*) I know that in this very scenario it's not "processes" but one single process and calling
[firejail --private] firefoxhere just triggers the running instance to open a new window. But from the user's perspective and its assumptions the behavioural implications can be pretty severe.@smitsohu commented on GitHub (Apr 22, 2021):
As @glitsj16 pointed out, something worth trying would be to start Firefox with
--no-remote. Alternatively you could also try the Firejail option--env=MOZ_NO_REMOTE=1, the outcome should be exactly the same.Firejail could set the MOZ_NO_REMOTE environment variable also automatically. In fact it's already in the source, it just was never uncommented. Not sure about the reason, but I suppose it's because this behaviour is (or used to be) quite convenient when opening links in email clients.
6b4f6f4834/src/firejail/env.c (L123)@ghost commented on GitHub (Apr 22, 2021):
Maybe we need some kind of OSD-notification system to inform users of these kinds of potential issues/unexpected behaviours. It's fine to have error and warning messages in the code, but you need to be in a terminal starting apps from CLI with --ignore=quiet to catch any of this, let alone understand what's being communicated. And allthough we don't have data on how people use firejail on a daily basis, I think it's pretty safe to assume a 'regular' user is GUI-oriented. Quite a complex topic all in all. But it never hurts to contemplate improvements...
@smitsohu commented on GitHub (Apr 22, 2021):
@mirko If you wonder how to interrupt the IPC by means of sandboxing, you may want to give Firejail's
--x11=*options a try.@ghost commented on GitHub (Apr 22, 2021):
@smitsohu I'm wondering if MOZ_NO_REMOTE (and potentially other) environment variables could be moved from the code to the profiles themselves. Or at least also included in (some) profiles, so users would be more aware of their relevance. Any thoughts on that?
@mirko commented on GitHub (Apr 22, 2021):
Given I'm running wayland and using firefox natively within wayland (
MOZ_ENABLE_WAYLAND=1), I believe the--x11-options won't have any effect when not residing in X11 environments(?)@mirko commented on GitHub (Apr 22, 2021):
Just for clarification, what - on technical level - makes firefox actually detecting there's already an instance running and hence deciding to communicate via what exactly with the first instance so it triggers the opening of a new window there? SHM? D-Bus? Some (other kind of) socket?
@smitsohu commented on GitHub (Apr 22, 2021):
Ok, then we have a new issue 😃
Looks like they are using D-Bus on Wayland.
@smitsohu commented on GitHub (Apr 22, 2021):
@glitsj16 That's an interesting idea. It should be possible at least for those environment variables that don't have to be computed.
And maybe excluding KDE_FORK_SLAVES because it has small security implication on its own (controls if code runs inside or outside the sandbox if D-Bus is not disabled); so in this case
includein default profiles would be somewhat more unreliable than the way it works currently.@rusty-snake commented on GitHub (Apr 22, 2021):
RELATED: #4050
#3290
Gives the UX somebody expects but does not tight the sandbox.
@smitsohu commented on GitHub (Apr 22, 2021):
@glitsj16 @rusty-snake Probably you are right, it is more an issue in Firefox.
How about adding the FAQ as a comment to the profile?
The setup suggested in the FAQ though still leaves the possibility of lesser trusted Firefox instances (say an online casino profile) messing with more trusted instances (say an online banking profile) at filesystem level, because all instances whitelist the same ~/.mozilla directory.
Strict isolation would require something like
--privateor--private-home=.mozillaor--tmpfs=~/.mozilla --tmpfs=~/.cache/mozilla(in order to keep the real Downloads folder accessible) or--private=with per profile home directoriesall of which doesn't fit well in a default profile.
@chiraag-nataraj commented on GitHub (May 5, 2021):
I actually set this up, along with a mechanism for generating temporary Firefox profiles (cleaned on exit), using my private-profile.sh and this configuration file.
@mirko, you may be interested in that script. Because I store all of my profiles in
~/.config/mozilla/firefox, just running plainfirefox(or even plainfirejail firefox) will create a brand new profile and it will not know about the existing permanent and temporary profiles.@rusty-snake commented on GitHub (Jun 10, 2021):
I'm closing here due to inactivity, please fell free to request to reopen if you have more questions.