mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #330] firejail massive breach? Or just a missuse case? #232
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#232
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 @ghost on GitHub (Feb 28, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/330
I have two Firefox'es that I use: One is with:
and the other with:
Today I noticed that I could see my normal /home through the second firefox, and this isn't supposed to happen, right?
I recorded a video so you can see. I can't upload it to Youtube because I use the "private" firefox for Youtube, but I uploaded it to sendspace instead. It's only 13 MB. https://www.sendspace.com/file/zrjep9
@sinkuu commented on GitHub (Feb 28, 2016):
I can't see my /home from the second firefox with firejaill-0.9.39 (git master).
@ghost commented on GitHub (Feb 28, 2016):
I'm using 0.9.38. Is the git version stable enough for day-to-day use?
@sinkuu commented on GitHub (Feb 28, 2016):
I downgraded to 0.9.38 but still my home directory is correctly inaccessible. Upgrading to git version may not fix your problem...
I haven't encountered any issue, however my usage is basic (mostly sandboxing firefox with the default profile).
@chiraag-nataraj commented on GitHub (Feb 28, 2016):
I just tested this and I can't see my original home directory from the new Firefox instance. Then again, I have a highly restrictive profile:
So maybe it's one of those options that's masking this issue if it exists?
@netblue30 commented on GitHub (Feb 28, 2016):
It is a Mozilla Firefox problem. This is the easiest way to reproduce it:
(1) Open a sandbox: firejail --private firefox -no-remote
(2) In URL bar type "/home/username" (replace username). The browser displays the content of your private home directory.
(3) In a new tab type "about:support" and click "Open Directory" button. This opens your file manager (whatever is installed by your desktop environment). Navigate to /home/username in file manager. It displays the content of your real home directory, not the sandboxed home directory as in (2).
The file manager started by Firefox talks over a socket to another file manager instance running outside the sandbox. The instance outside the sandbox opens the window. It is not a security problem, but it will confuse the user regarding downloaded files - the files always end up in the sandboxed filesystem. Always check files and directories using the URL bar of the browser.
By default, a desktop environment always starts a file manager when the user logged in. This instance handles all file accesses, subsequent file manager instances just send messages over some socket.
@chiraag-nataraj commented on GitHub (Feb 28, 2016):
That would explain why I did not have this issue - I run AwesomeWM, not a desktop environment. I also don't have any standalone graphical file browsers installed :D This is certainly an interesting problem. Is there any way to force firefox to open its own dialog as it does on my system instead of relying on the default file manager?
@chiraag-nataraj commented on GitHub (Feb 28, 2016):
Another option would be to see if you can force Nautilus or whatever the default file manager is to open a new instance every time (probably more doable than my first suggestion).
@netblue30 commented on GitHub (Feb 28, 2016):
In LXDE I blacklisted the file manager socket . Now, when I click on "Open Directory" the file manager (pcmanfm) crashes. I guess the more we fix it, the more we break it!
@chiraag-nataraj commented on GitHub (Feb 28, 2016):
Yeah this should probably be done on the file manager end haha :P
@chiraag-nataraj commented on GitHub (Feb 28, 2016):
There is, of course, the simple solution: don't run a file manager daemon! ;)
@ghost commented on GitHub (Feb 29, 2016):
@sinkuu
What desktop environment are you using?
@netblue30
But why does this happen? Anything opened by a sandbox should also be sandboxed. I wouldn't mind if the sandboxed Firefox started a sandboxed socket, if that's possible.
Not according to my video. For instance, I use the private Firefox for Facebook. I downloaded a photo, which should be in the private home, but when I tried uploading this photo to facebook it was like if I was inside my real home, there was no photo from facebook there, only my real files.
@chiraag-nataraj
But KDE is the only DE that works 100% to my needs, in openSUSE. All of the others have serious issues.
@chiraag-nataraj commented on GitHub (Feb 29, 2016):
@amarildojr
It happens because the file manager is already running by the time you start firefox. According to @netblue30, blacklisting the existing socket crashes the file manager. I would look for a way to launch different PcManFM windows with different processes - that may solve this problem?
@netblue30 commented on GitHub (Mar 1, 2016):
@amarildojr
You can always check with the Linux kernel what filesystem a process is seeing. The directory is accessible in /proc//root. Start with a "firejail --tree"
For 20255, 20256, and 20326 you should see the same thing in /proc/PID/root/ (do: sudo ls -al /proc/20255/root/home/username for all processes inside the sandbox). In my example here (LXDE) the filemanager window is not even in the sandbox, but I can see it on the screen. Don't trust filemanager windows started from firefox.
@ghost commented on GitHub (Mar 1, 2016):
MATE also works fine, but only on Debian.
I'm not sure I'll stay here, though. I'll probably go back to Arch, but then again, Arch has the same KDE Plasma 5 as openSUSE.
We'll see how it goes.
Why not? If it can see the filenames I have, so would an attacker.
@chiraag-nataraj commented on GitHub (Mar 1, 2016):
I'm curious - what happens if you actually try opening one of those files? Does it actually load or does it fail with EPERM or something similar to that?
@netblue30 commented on GitHub (Mar 2, 2016):
No, the attacker would not see the files because he doesn't have access to your display, your keyboard and your mouse.
@curiosity-seeker commented on GitHub (Mar 12, 2016):
@netblue30 : Sorry for my ignorance - but could you, please, give a more detailed answer why this is not a security issue? I must admit that I don't understand the technical background of the remark in your last post above. I think understanding this is very important for all Firejail users.
@chiraag-nataraj commented on GitHub (Mar 12, 2016):
@amarildojr: I'm curious as to what happens if you try to open one of the files in your real home directory.
@chiraag-nataraj commented on GitHub (Mar 12, 2016):
@curiosity-seeker: I think this is what @netblue30 means. The thing is that firefox doesn't actually have access to those files (or at least it shouldn't). However, since it connects to a file manager socket that exists outside of the jail, it appears that you can access those files.
@curiosity-seeker commented on GitHub (Mar 13, 2016):
@chiraag-nataraj : Thanks for your reply! I agree that Firefox doesn't have access to those files which are not whitelisted. The question is if an attacker would be able to start the file manager via about:support and use that to see/manipulate any folders/files outside the sandbox. I don't understand yet why this is impossible for an attacker according to @netblue30 .
@netblue30 commented on GitHub (Mar 13, 2016):
@curiosity-seeker
Firefox cannot access and manipulate the memory of the process running outside the sandbox. It can only send messages over TCP/IP or UNIX sockets. In this case it sends a message to an existing file manager process over a UNIX/DBus socket. It is no different than sending messages over to PulseAudio or X11 socket.
@curiosity-seeker commented on GitHub (Mar 13, 2016):
@netblue30 : Thank very much! I'm beginning to understand ;-)
@curiosity-seeker commented on GitHub (Mar 14, 2016):
Sorry for being stubborn! I'm running Fedora 23 with KDE Plasma 5 in a Virtualbox VM and Firejail 0.9.38. firejail --tree gives:
After going to about:support and clicking "Open directory", Dolphin starts. firejail --tree now shows this:
It seems that Dolphin is started within the sandbox. Doesn't that contradict what you said above?
However, Dolphin doesn't show up if I enter sudo ls -al /proc/2377/root/home/hank
I'm confused.
@ghost commented on GitHub (Mar 14, 2016):
@chiraag-nataraj
I could see the files in openSUSE, but not on Arch. It seems Arch's KDE5 is working normally.
@curiosity-seeker commented on GitHub (Mar 15, 2016):
I got the same result as on Fedora on Manjaro (Arch based) with Plasma 5 after Dolphin was launched from about:support:
So again it seems to me that Dolphin is started within the sandbox.
@netblue30 commented on GitHub (Mar 15, 2016):
I think the file manager always starts inside the sandbox, than if it detects another instance running, it sends the message to the main one. If not, it just shows whatever it finds in the sandbox file system.
@curiosity-seeker commented on GitHub (Mar 16, 2016):
Well, another instance of Dolphin was not running. Nevertheless, it shows my complete real file system. Or more exactly: It shows my ~/.mozilla/firefox folder (not only the Firefox profile folder currently used) from where I can go everywhere in the file system.
I've tried it again on Manjaro:
If I chose the tree view in htop I get:
Does that help somehow?
@netblue30 commented on GitHub (Mar 16, 2016):
If it shows all the file system, it means is running outside the sandbox. You can verify that by looking at what the kernel is reporting as a filesystem in /proc/PID/root - you get there a full copy of the file system for each process. So, in your example above, (as root user) look at /proc/19296/root, it should be the same directory tree as /proc/10583/root.
@curiosity-seeker commented on GitHub (Mar 17, 2016):
Thanks, I tried it again:
sudo ls -al /proc/9494/root shows:
And sudo ls -al /proc/3090/root shows:
So the directory tree is identical. This confirms what you're saying. However, I must admit that I have problems to interpret what I'm seeing. From my naive understanding, PID 3090 is a sub-process of the firejailed Firefox PID 3089 running within the sandbox. They are showing the same directory tree as sudo ls -al /proc/3089/root gives:
So why should the fact that PID 9494 shows the same directory tree as PID 3090 (and PID 3089) tell me that Dolphin is running outside the sandbox? I'm very sorry but I don't get it ...
@netblue30 commented on GitHub (Mar 17, 2016):
In your case 3089, 3090, 3122, 3214, 3270, and 9494 should show the same thing. Go for a directory you recognize as being in the sandbox, for example your home directory:
It will list all the files. Blacklisted files should show root read-only, for example .bashrc or .macromedia above.
@curiosity-seeker commented on GitHub (Mar 17, 2016):
Ah, yes! I had made a mistake in my previous post. I had only entered
sudo ls -al /proc/PID/root
instead of
sudo ls -al /proc/PID/root/home/hank
Sorry for my confusion! Now with the correct command the relevant PIDs - including the one for Dolphin - show the same items in my home directory.
So the inference is: Since that Dolphin instance launched in about:support shows my real complete file system, it can not be the PID shown with firejail --tree , hence it must be a process outside the sandbox. Is this the right conclusion?
@netblue30 commented on GitHub (Mar 20, 2016):
Yes, it should be a process outside the sandbox.