Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firejail worsen security? #3046

Closed
TNTBOMBOM opened this issue Nov 18, 2019 · 51 comments
Closed

Firejail worsen security? #3046

TNTBOMBOM opened this issue Nov 18, 2019 · 51 comments
Labels
question_old (Deprecated; use "needinfo" or "question" instead) Further information is requested

Comments

@TNTBOMBOM
Copy link

TNTBOMBOM commented Nov 18, 2019

Hi,

Firejail/firetools included by default in Whonix Anonymous OS distro for the security benefits of sandboxing, but recently discussion appeared that Firejail is worsening the security of the OS and i will copy (with rearranging) the arguments here:

  • High rate or hole of privilege escalations: references CVEs and Seclist discussion.

  • Firejail bulky code and complexity increases security threats and surface attack

  • Review from bubblewrap/flatpak maintainer Simon McVittie: here

  • Review from security guy like Daniel Micay: here

and thus if any sandboxing tool to be used is Bubblewrap. (full discussion can be found here)

^^^ These are the arguments posted in our forums, i hope only experts to reply on these issues and i hope the replies to be technical and not biased.

(sorry if this is not a bug, but i want to hear your thoughts about it)

ThX!


Note by @kmk3: There are multiple discussions in this repository related to
this topic; see also the following (meta-)discussion, which links to this issue
and others:

@FOSSONLY
Copy link

First of all, it should be noted that the predominantly numerous security gaps, all of which were significantly discovered in the period 2016/2017 by an audit. At that time Firejail was still a brand new project, and anything but really mature. The initial flaws were addressed recently, and Firejail has since been hardened in many ways. There's even an AppArmor profile, which adds hardening to Firejail itself to effectively prevent potential problems. Furthermore, you should always take a close look at security holes, especially as some of the CVEs could only be exploited under local, rare, difficult, or completely absurd conditions. And from today's point of view, Firejail has undergone an enormous development, not least due to the great community behind it, and now has only rare or minor security holes.

It's also not fair to compare Firejail with Flatpak or the underlying Bubblewrap which is used by Flatpak. Both pursue completely different goals. But if you strictly consider the question of security, then suid binaries like Firejail and Bubblewrap are basically problematic. Especially since the protection of suid binaries has always been difficult. The future Landlock LSM offers a much better foundation and would allow any process without root rights to lock itself in an effective sandbox. And this with an extremely minimal attack surface on the part of the Landlock LSM.

@madaidan
Copy link

First of all, it should be noted that the predominantly numerous security gaps, all of which were significantly discovered in the period 2016/2017 by an audit. At that time Firejail was still a brand new project, and anything but really mature. The initial flaws were addressed recently, and Firejail has since been hardened in many ways.

That still does not get rid of the fact that firejail has large attack surface now. Just because vulnerabilities were fixed in the past, doesn't mean it's all fine now.

Also the comments from the two experts linked above were not in 2016/2017.

Furthermore, you should always take a close look at security holes, especially as some of the CVEs could only be exploited under local, rare, difficult, or completely absurd conditions.

And every firejail CVE was easily exploited. Please point out a single known firejail vulnerability that was only exploitable under "completely absurd conditions".

It's also not fair to compare Firejail with Flatpak or the underlying Bubblewrap which is used by Flatpak.

We are not comparing firejail with flatpak and bubblewrap is fair to compare to firejail.

But if you strictly consider the question of security, then suid binaries like Firejail and Bubblewrap are basically problematic.

Bubblewrap is much less problematic as it has minimal attack surface unlike firejail. Bubblewrap also doesn't need to be suid. It only needs to be suid when unprivileged user namespaces are disabled.

@FOSSONLY
Copy link

That still does not get rid of the fact that firejail has large attack surface now. Just because vulnerabilities were fixed in the past, doesn't mean it's all fine now.

In 2017 yes, but now not. And even if there might be more security holes found in Firejail, Bubblewrap isn't immune against new security holes too.

And every firejail CVE was easily exploited. Please point out a single known firejail vulnerability that was only exploitable under "completely absurd conditions".

Why not take Firejail 0.9.60 and demonstrate a successful outbreak? If that's so easy, then this should be no problem.

Example: CVE-2019-12499

To take advantage of this, Firejail must be run as root, which never happens in 99.99% of cases. This sandbox must be killed (e.g. SIGKILL) as root on the host to the right time, which also never just happens. These are conditions that are realistically never to be found, which makes this vulnerability little relevant. A sandbox that is started as root is basically insecure, and would also be a risk in the case of Bubblewrap.

We are not comparing firejail with flatpak and bubblewrap is fair to compare to firejail.

Not really, especially since Bubblewrap is functionally very minimalistic and represents the opposite of Firejail. In principle Bubblewrap does not have the slightest claim to be something comparable to Firejail, and serves only as a minimal basis for other programs.

Bubblewrap is much less problematic as it has minimal attack surface unlike firejail. Bubblewrap also doesn't need to be suid. It only needs to be suid when unprivileged user namespaces are disabled.

Less code does not mean that this code offers less attack surface than that of more extensive software. Even the supposedly smallest program can have extremely critical security gaps. It may be advantageous to reduce code if necessary, but this is not a guarantee for qualitative code. It is also not possible to make a well-founded statement about whether Firejail or Bubblewrap offers the larger attack surface, especially since it depends strongly on the conditions. Practically neither of them currently offers any program within the sandbox a real chance to extend privileges, and that's exactly what matters. And of course Bubblewrap requires suid rights, especially since user namespaces are quite questionable from a security point of view. The doubts about this have by no means been dispelled. In the worst case, you inevitably compromise yourself, which is why user namespaces are not always activated.

@Vincent43
Copy link
Collaborator

There are two distinct scenarios:

  1. app/service runs inside firejail sandbox
  2. app/service runs outside firejail sandbox

Firejail significantly reduces attack surface for 1 (it may vary across different profiles) and increases attack surface for 2 (more or less). Everyone have to decide themselves what net attack surface impact is for them.

Granting access to firejail for untrusted local unprivileged user may be not good idea (this is scenario for which most of past cve were applicable). The question is if today's desktop linux systems are multi-user focused (with some of them being untrusted). I heard many opinions from developers of projects like kernel or systemd stating that's not the case.

Yes, bublewrap has less additional attack surface for scenario 2 but merely installing bubblewrap does nothing for scenario 1 unless someone write special wrapper for it with profiles for many specific apps. Something like that, let's call it Firewrap or Bubblejail would be interesting, perhaps more secure solution than firejail but for now it doesn't exist.

@madaidan
Copy link

madaidan commented Nov 18, 2019

In 2017 yes, but now not.

No, it still has large attack surface.

And even if there might be more security holes found in Firejail, Bubblewrap isn't immune against new security holes too.

I never said it was. It's just far less likely for it to have security holes due to its reduced attack surface.

To take advantage of this, Firejail must be run as root, which never happens in 99.99% of cases. This sandbox must be killed (e.g. SIGKILL) as root on the host to the right time, which also never just happens. These are conditions that are realistically never to be found, which makes this vulnerability little relevant.

Sure, that's like the only CVE with moderate complexity. Most other CVEs are very easy to exploit. Take CVE-2017-5207 for example in which a few commands was enough to get full root access #1023

A sandbox that is started as root is basically insecure, and would also be a risk in the case of Bubblewrap.

Not as much as firejail. The only known sandbox escape in bubblewrap was CVE-2017-5226 in which an attacker could abuse the TIOCSTI ioctl which if anything, is the kernel's responsibility.

Not really, especially since Bubblewrap is functionally very minimalistic

That's why it's so good.

Less code does not mean that this code offers less attack surface than that of more extensive software.

I know. Bubblewrap's entire design is to have as little attack surface as possible. For example it doesn't even interface with raw syscalls for seccomp filters (you have to create your own seccomp filters with seccomp_export_bpf) and has really simplistic command line parsing containers/bubblewrap#317 (comment)

Meanwhile firejail is constantly adding attack surface with pointless options like nodbus which are basically just over complicated blacklist rules.

@madaidan
Copy link

Firejail significantly reduces attack surface for 1

Sure, it can but firejail's large attack surface makes it far more easier to escape.

The question is if today's desktop linux systems are multi-user focused (with some of them being untrusted).

No, it's not just if it's a multi-user system. An attacker can compromise an unsandboxed program and then exploit vulnerabilities in firejail.

but merely installing bubblewrap does nothing for scenario 1 unless someone write special wrapper for it with profiles for many specific apps.

That's what I'm planning to do.

@Vincent43
Copy link
Collaborator

Vincent43 commented Nov 18, 2019

Sure, it can but firejail's large attack surface makes it far more easier to escape.

Easier than for unsandboxed app? Obviously no. Was there a cve that worked inside sandbox?

No, it's not just if it's a multi-user system. An attacker can compromise an unsandboxed program and then exploit vulnerabilities in firejail.

Yes, however I consider scenario when malware author writes script that will compromise some app and then go for firejail as rather unlikely. 95+ systems won't have firejail installed. The situation would be different when they have unlimited time and tries like local users have. Also when someone gets arbitrary code execution then they already won even without root access. Most things that matter will be available freely inside home.

That's what I'm planning to do.

Great, please share your code.

@madaidan
Copy link

Easier than for unsandboxed app?

No, I meant easier than bubblewrap.

Was there a cve that worked inside sandbox?

Yes.

CVE-2019-12589

CVE-2019-12499

CVE-2017-5940

CVE-2017-5206

CVE-2017-5180

CVE-2016-9016

Yes, however I consider scenario when malware author writes script that will compromise some app and then go for firejail as rather unlikely.

Firejail is a setuid program with large attack surface. Many malware authors would go after it as it's such a vulnerable target.

@Vincent43
Copy link
Collaborator

No, I meant easier than bubblewrap.

It depends on what bubblewrap sandbox would do. By default it does nothing but I agree that strong bubblewrap sandbox may be safer than firejail's one.

CVE-2019-12589

It makes seccomp ineffective in certain, rare circumstances. It doesn't add additional attack surface on system.

CVE-2019-12499

It works only when firejail is run as root, again it doesn't add additional attack surface on system.

CVE-2017-5940

Exploit need to be run outside sandbox

CVE-2017-5206

It makes seccomp ineffective in certain, rare circumstances. It doesn't add additional attack surface on system.

CVE-2017-5180

Exploit need to be run outside sandbox

CVE-2016-9016

This is sandbox escape but It doesn't add additional attack surface on system. Bubblewrap was also affected and fixed it couple of months after firejail did
.

So to conclude above, none of those cve allowed to raise privileges when run inside sandbox in comparison to unsandboxed case. The point that attack surface is decreased in scenario 1 stands then. Obviously sandbox-escapes work inside sandbox but they don't increase attack surface on system.

Firejail is a setuid program with large attack surface. Many malware authors would go after it as it's such a vulnerable target.

Malware authors usually try to target as many users as possible (that's why they don't give a s*hit about linux in general 😄 ). It may be different if we're talking about high-value individuals but again, what they do after gain code exec is secondary issue.

@Vincent43 Vincent43 added the question_old (Deprecated; use "needinfo" or "question" instead) Further information is requested label Nov 19, 2019
@madaidan
Copy link

CVE-2017-5940

Exploit need to be run outside sandbox

It doesn't.

https://www.cvedetails.com/cve/CVE-2017-5940/

"which allows local users to conduct sandbox-escape attacks"

CVE-2017-5180

Exploit need to be run outside sandbox

It doesn't.

https://www.cvedetails.com/cve/CVE-2017-5180/

"which allows local users to conduct sandbox-escape attacks"

So to conclude above, none of those cve allowed to raise privileges when run inside sandbox in comparison to unsandboxed case.

That's not what you asked. You asked for vulnerabilities that could be exploited from within the sandbox, not full priv esc from the sandbox.

If you want full priv esc, then the attacker could have exploited one of the sandbox escape vulnerabilities I listed above and then exploited another priv esc vulnerability in firejail once they're outside the sandbox.

Malware authors usually try to target as many users as possible

So they would want to target one of the most popular linux sandboxing programs, firejail.

@smitsohu
Copy link
Collaborator

smitsohu commented Nov 19, 2019

@madaidan The descriptions are misleading, unfortunately. You need to read the code and understand the vulnerabilities. There is no sandbox escape there (from the running sandbox), the primary problem is the privesc (edited).

i hope only experts to reply on these issues and i hope the replies to be technical and not biased.

There are already so many false claims in this thread that I don't know where even to start.

@smitsohu
Copy link
Collaborator

Anyway, the thing is that there is little point to discuss Firejail version 0.9.38 or 0.9.44.

Firejail changes very fast, and what will be upcoming 0.9.62 has not so much to do with the early versions that were hit by these vulnerabilities. It would be very cool if we could discuss the present and not the past.

@madaidan
Copy link

Anyway, the thing is that there is little point to discuss Firejail version 0.9.38 or 0.9.44.

Firejail changes very fast, and what will be upcoming 0.9.62 has not so much to do with the early versions that were hit by these vulnerabilities. It would be very cool if we could discuss the present and not the past.

I am discussing the present and in the present, firejail still has far too large attack surface and is still recommended against by security experts.

@smitsohu
Copy link
Collaborator

smitsohu commented Nov 19, 2019

I am discussing the present and in the present, firejail still has far too large attack surface and is still recommended against by security experts.

Well, my impression currently is a bit that some other security experts also just point to these mistakes of the past. They have been fixed!

Also I don't buy into the argument that there are too many options. Many of Firejail's options don't do anything even remotely dangerous, and others are just interfaces provided for convenience, such as the cited nodbus option. Which is a nice example by the way: Not only is nodbus particularly harmless (I'm honestly curious how this option increases attack surface)... if you don't provide something like nodbus, all you do is putting the burden for doing something wrong on the shoulder of the user.

@smitsohu
Copy link
Collaborator

Not as much as firejail. The only known sandbox escape in bubblewrap was CVE-2017-5226 in which an attacker could abuse the TIOCSTI ioctl which if anything, is the kernel's responsibility.

Only a side note, the only difference between Firejail and Bubblewrap with regards to CVE-2019-12499 is that Firejail got a CVE assigned (it was requested by the project) and Bubblewrap did not get a CVE assigned... now, there are well founded reasons both to assign and to not assign a CVE in that particular case, but when comparing the projects, it would be fair to mention that the reasons not to assign a CVE apply to Firejail as well :)

@netblue30
Copy link
Owner

@madaidan

Once inside a sandbox - firejail, bubblewrap, or any other seccomp sandbox - you can not exploit any SUID executable present in the system. It has to do with the way seccomp is handled by the kernel. The attack surface of the program that configured seccomp becomes irrelevant. In other words, if you get control of a firefox running in a sandbox, the kernel wouldn't let you exploit the program that started the sandbox.

CVEs: - most of them were reported by the people associated with the project. Most of the time we already had a new release out with the fix. We did get some CVEs from outside people, mostly SUSE guys. Also, they suggested the current user restriction we put on firejail executable (see man 5 firejail-users). So big thanks to all CVE authors.

@TNTBOMBOM

High rate or hole of privilege escalations: references CVEs and Seclist discussion.

Already explained above. We don't really care about the optics.

Firejail bulky code and complexity increases security threats and surface attack

Yes, they do increase it. The attack surface visible to somebody outside the sandbox is large. Don't use this on enterprise servers, or any other multiuser system. Firejail was built for single-user desktops.

Review from bubblewrap/flatpak maintainer Simon McVittie: here

We don't seem to be very popular with bubblewrap people.

Review from security guy like Daniel Micay: here

He doesn't seem too happy about flatpak/bubblewrap either. From the link:

Really, people just like saying that their preferred software stack is secure, or that open source software is secure, when in reality it's not the case. Desktop Linux is falling further and further behind in nearly all of these areas. The work to try catching up like Flatpak is extremely flawed and is a failure from day 1

You guys can use whatever you want, firejail or bubblewrap. In my opinion it is irrelevant. I would suggest what you are missing in whonix is some serious mandatory access control system (MAC). You already have some apparmor support, you need to beef it up and expand it to all applications you run, with strong profiles for all of them. By strong I mean 100 lines or longer each one of them. You can evaluate apparmor profiles by counting apparmor lines the same way you can evaluate attack surfaces by counting C code lines.

Here in firejail we can get away with one single (small) apparmor profile shared by 100 applications because we target the home user market. In whonix you talk about political disidents, whistleblowers, repressive environment, reporting on organized crime... The security you intend to provide should be about 10x better than what we give to Linux home users with firejail. This means an absolutely crazy apparmor setup.

Just my opinion... I don't know if it is going to help, but I wouldn't waste time debating firejail/bubblewrap.

@adrelanos
Copy link
Contributor

Quote @smitsohu #3046 (comment)

The descriptions are misleading

If the CVE descriptions are misleading, do you have security advisories, summaries or something? Or how do I learn more about these?

@smitsohu
Copy link
Collaborator

smitsohu commented Nov 19, 2019

Just to add, it is possible to configure Firejail in a way that the attack surface becomes smaller. As a rule of thumb, less attack surface means less powerful (which probably does not come as a surprise).

One thing is the NO_NEW_PRIVS bit. Bubblewrap sets it unconditionally, and Firejail keeps a switch force-nonewprivs in /etc/firejail/firejail.config (maybe we could have it as a compile time option, too).
The problem is that with NO_NEW_PRIVS you cannot sandbox all apps any more. For example, it breaks Chromium on Debian, as Chromium relies on a setuid binary for its own sandboxing.

You can also take a look at other switches in /etc/firejail/firejail.config, for example the restricted-network switch. Debian enables this one by default since Buster.

@smitsohu
Copy link
Collaborator

If the CVE descriptions are misleading, do you have security advisories, summaries or something? Or how do I learn more about these?

@adrelanos No. But the exploit was published, you can find it here

@adrelanos
Copy link
Contributor

Trying to wrap my head around this. First, terminology.

First @madaidan was the first one to say full priv esc from the sandbox.
Then @smitsohu said full priv esc.

full priv esc might mean many things? It supposed to mean full privilege escalation from user to root to kernel?

full priv esc from the sandbox means suppose an exploit running in a firejail sandbox (run as user, not root, I suppose) has lead to root or kernel level access?

If my understanding is correct, @madaidan thinks running without firejail, the compromised application would have been "stuck" under the user account. (Ignoring other ways it might escalate from user to root or kernel for the sake of this discussion.) But since it was run under firejail, the attacker could have escalated to root or kernel privilege? In other words, was worse off than not using firejail?

@M83tUt3
Copy link

M83tUt3 commented Nov 19, 2019

The argument that a setuid binary with a large attack surface is a potential threat seems fair to me. I'm wondering though, isn't this what LTS tries to address by stripping out some features? How much of a difference in code complexity does it make?

Daniel Micay's work is on an OS that that desktop Linux could pretty much never compete with in terms of security to begin with. He seems to not like neither setuid nor unpriviliged namespaces, and has spoken out against Flatpak as well. I don't think Bubblewrap is going to be much better in his eyes, aside for its decreased attack surface (which is arguably important).

Edit:
Also a genuine question: I'm on a single user system. If something malicious runs outside of a sandbox under my own user I consider myself pwned anyway as I'm on X and it's standard desktop linux simply doesn't protect you in this case. Do I not benefit from running certain applications such as a browser, or obscure pip packages under Firejail?

@topimiettinen
Copy link
Collaborator

Regarding BPF, Bubblewrap allows any random BPF code from user, which could be questionable. Firejail compiles BPF filters by itself (in a sandbox), so the contents are known. It would be easy to allow loading of user BPF filters.

Bubblewrap does not allow application level IP firewalling. Then Firejail has higher level features like X11 sandboxing and it can also make throwaway copies of files to the sandbox.

It's easy to compare SLOC counts, but then you should compare which part of that is running privileged and which is sandboxed.

The major point with Firejail is that it is very easy to setup and has lots of profiles for common applications. This makes it very easy for non-expert desktop user to improve security. Otherwise, I think @Vincent43's theoretical Firewrap/Bubblejail could combine best of both programs. Getting to the same level of ease for end user as with Firejail would not be trivial and it would require changes to Bubblewrap too.

One feature that MS Windows has that neither Firejail nor Bubblewrap have is full OS virtualization. Firejail could use KVM to make a small VM with tiny OS, which could then control the OS/application interface better than very limited BPF ever can. For example, this intermediate OS could force cache flushes for each system call entry and exit, to prevent Meltdown-like problems with speculative execution. Doing it always in host OS would hit the performance badly, so it is not done there, but for a single non-performance critical application it wouldn't matter.

@smitsohu
Copy link
Collaborator

smitsohu commented Nov 19, 2019

@adrelanos that ancient exploit, bug fixed years ago, depends on sandbox setup, and there is no immediate way to trigger a sandbox setup from inside a running sandbox. If you wanted to craft a successful attack from inside a sandbox like that, you would need to make additional assumptions, like reuse of the directory and evading detection. Admittedly, that CVE is a bit in a grey zone (which is why I updated my comment afterwards).
I don't think this is the right place to discuss the semantics of "sandbox escape". If there is desire for further discussion in that regard, let's do it in a separate issue.

@FOSSONLY
Copy link

After reading all the positions, it is noticeable that too much emphasis is placed on favorite software and false facts. I think we can say that both firejail and bubblewrap had shortcomings, as well as their individual strengths and weaknesses, and equally have potential for improvement. And given that we're all interested in creating more security, the focus should be on learning from each other to effectively advance linux security.

It has been argued that firejail-LTS also exists. I'd also like to know how this differs from regular firejail, and if it wouldn't potentially make sense to make firejail-LTS the default. The question is to what extent the missing features would really be missing, or whether they were actually used. What do you think? Personally, I would have to admit that, despite extensive use, only a fraction of the functionality is really used. On the other hand, the reduction of functionality is not a basic solution for more security. What do you think about systemd to check all code of firejail and bubblewrap via fuzzit, coverty, oss-fuzz etc.?

@Vincent43
Copy link
Collaborator

What do you think about systemd to check all code of firejail and bubblewrap via fuzzit, coverty, oss-fuzz etc.?

systemd?

@madaidan
Copy link

@smitsohu

Well, my impression currently is a bit that some other security experts also just point to these mistakes of the past. They have been fixed!

Nobody has said they weren't fixed. Firejail still has too large attack surface even though you fixed a few vulnerabilities in the past.

Only a side note, the only difference between Firejail and Bubblewrap with regards to CVE-2019-12499 is that Firejail got a CVE assigned (it was requested by the project) and Bubblewrap did not get a CVE assigned

Do you have a source on bubblewrap also being vulnerable?

@netblue30

Once inside a sandbox - firejail, bubblewrap, or any other seccomp sandbox - you can not exploit any SUID executable present in the system.

I know. I never said you could. I've only said an app inside firejail can get priv esc after breaking out and then exploiting a priv esc vulnerability in firejail since they now have access.

Don't use this on enterprise servers, or any other multiuser system. Firejail was built for single-user desktops.

No, it's not just multi-user systems. An unsandboxed program can still exploit vulnerabilities in firejail even though it's a single-user system. I've already explained this.

He doesn't seem too happy about flatpak/bubblewrap either.

Flatpak is not the same as bubblewrap. I've already said this.

Micay does recommend bubblewrap.

https://github.com/thestinger/playpen

"use bubblewrap if you need more functionality "

I've already said this too in the forum post linked above which nobody seems to have read.

I would suggest what you are missing in whonix is some serious mandatory access control system (MAC). You already have some apparmor support, you need to beef it up and expand it to all applications you run, with strong profiles for all of them.

We're already working on confining everything with apparmor using a full system policy https://github.com/Whonix/apparmor-profile-everything

Bubblewrap is still important though as apparmor can't do namespaces or seccomp.

@adrelanos

full priv esc might mean many things? It supposed to mean full privilege escalation from user to root to kernel?

No, I mean from user to root.

But since it was run under firejail, the attacker could have escalated to root or kernel privilege?

No. Apps in firejail aren't anymore likely to gain root but apps outside of firejail (including sandbox escapes) can exploit vulnerabilities in firejail to gain root.

@topimiettinen

Regarding BPF, Bubblewrap allows any random BPF code from user, which could be questionable.

No, that's not true. If you try to use anything other than a valid seccomp filter, it will give an error:

bwrap: prctl(PR_SET_SECCOMP): Invalid argument

Bubblewrap does not allow application level IP firewalling.

That's a good thing. Unprivileged users should not have access to netfilter administration code. It exposes far too much attack surface and is one of the reasons unprivileged user namespaces are such a security risk.

Then Firejail has higher level features like X11 sandboxing

It's easy to do that in bubblewrap and I've done it many times before.

It's easy to compare SLOC counts, but then you should compare which part of that is running privileged and which is sandboxed.

Bubblewrap drops privileges properly.

The major point with Firejail is that it is very easy to setup and has lots of profiles for common applications.

Exactly. Firejail focuses too much on usability and making itself easy to use which increases attack surface substantially.

Otherwise, I think @Vincent43's theoretical Firewrap/Bubblejail could combine best of both programs. Getting to the same level of ease for end user as with Firejail would not be trivial and it would require changes to Bubblewrap too.

I've thought of making a wrapper for bubblewrap that makes it easier to use for a while now.

@netblue30
Copy link
Owner

@M83tUt3

Also a genuine question: I'm on a single user system. If something malicious runs outside of a sandbox under my own user I consider myself pwned anyway as I'm on X and it's standard desktop linux simply doesn't protect you in this case.

So you can have bad people compromising regular programs, and bad people compromising sandboxed programs. Hopefully we can take care of the ones attacking the sandboxed app.

Do I not benefit from running certain applications such as a browser, or obscure pip packages under Firejail?

The idea would be to sandbox as many apps as possible. At least the network-facing programs, and software not included in your package manager you install manually - like obscure pip packages. The sandbox defends only against external threats, and is useless for the ones that are already inside your system.

@netblue30
Copy link
Owner

@FOSSONLY

It has been argued that firejail-LTS also exists. I'd also like to know how this differs from regular firejail, and if it wouldn't potentially make sense to make firejail-LTS the default. The question is to what extent the missing features would really be missing, or whether they were actually used.

We tried to remove rarely used features, debug tools and so on. It was about 40% of the code.

On the other hand, the reduction of functionality is not a basic solution for more security.

I agree with that. The attack surface is still large. I estimate about 10% of the users are going for LTS. I'm not sure what they go for, the reduced attack surface or the stability. My guess would be the stability. Some people people say the version in Debian stable could be considered an ESR version.

@topimiettinen
Copy link
Collaborator

@madaidan The BPF program could be evil while not being invalid. I don't see how firewalling could increase attack surface (on the contrary), what do you mean?

@netblue30
Copy link
Owner

@madaidan

I think we gave you all the information you requested., just read our responses again. I'm closing the discussion for now.

@TNTBOMBOM
Copy link
Author

Thank you guys for all the comments been put here, i really appreciated. Wish for you all the best and success and thank you for making the (technological) world better 💟

@dm17
Copy link

dm17 commented May 28, 2020

Interesting thread. So many differing opinions and argumentation in the security community - especially when it comes to Linux (because there are so many options: apparmor, SELinux, lxc, docker, firejail, etc). Hoping to find a source that consolidates all of this better soon.

@crocket
Copy link
Contributor

crocket commented Oct 29, 2020

Sorry for chiming in late.

@madaidan What sandbox alternatives do you recommend if I was a political dissident in a tyrannical environment?
Just plain AppArmor?

@Vincent43
Copy link
Collaborator

I don't think any simple sandbox solution is enough for extreme scenarios. I would advice to look at holistic security solutions like QubesOS however this would need to reinvent the way you use the system.

@madaidan
Copy link

What sandbox alternatives do you recommend if I was a political dissident in a tyrannical environment?
Just plain AppArmor?

I'd generally recommend AppArmor or, preferably SELinux, along with bubblewrap. AppArmor doesn't make other sandboxing solutions redundant as it still can't utilize seccomp or namespaces. Applications confined under a strict AppArmor policy are still exposed to a considerable amount of kernel attack surface unless paired with a decent seccomp filter. We're working on sandbox-app-launcher for use in Whonix: https://github.com/Whonix/sandbox-app-launcher

I would advice to look at holistic security solutions like QubesOS however this would need to reinvent the way you use the system.

Security within the VMs is still important when using QubesOS. You should use a strict sandbox inside a VM for defense in depth.

@crocket
Copy link
Contributor

crocket commented Oct 31, 2020

@madaidan I looked into AppArmor and SELinux. It's cumbersome to configure SELinux because its configuration is spread across multiple places. I prefer AppArmor's simpler configuration model.

How are you going to filter dbus? bubblewrap doesn't do dbus filtering.

Where do I find you for discussing sandbox security?

@madaidan
Copy link

How are you going to filter dbus? bubblewrap doesn't do dbus filtering.

AppArmor supports fine-grained D-Bus restrictions, or you can use separate users like sandbox-app-launcher does.

Where do I find you for discussing sandbox security?

https://forums.whonix.org/t/system-wide-sandboxing-framework-sandbox-app-launcher/9008/

lucasbeiler added a commit to lucasbeiler/arch_install_sh that referenced this issue Jan 8, 2021
Currently, I create my own sandboxing mechanisms using bubblewrap, seccomp-bpf and AppArmor. Also, Firejail is supposed to be somewhat insecure: netblue30/firejail#3046
lucasbeiler added a commit to lucasbeiler/arch_install_sh that referenced this issue Jan 11, 2021
Currently, I create my own sandboxing mechanisms using bubblewrap, seccomp-bpf and AppArmor. Also, Firejail is supposed to be somewhat insecure: netblue30/firejail#3046
lucasbeiler added a commit to lucasbeiler/arch_install_sh that referenced this issue Jan 11, 2021
Currently, I create my own sandboxing mechanisms using bubblewrap, seccomp-bpf and AppArmor. Also, Firejail is supposed to be somewhat insecure: netblue30/firejail#3046
lucasbeiler added a commit to lucasbeiler/arch_install_sh that referenced this issue Jan 11, 2021
Currently, I create my own sandboxing mechanisms using bubblewrap, seccomp-bpf and AppArmor. Also, Firejail is supposed to be somewhat insecure: netblue30/firejail#3046
lucasbeiler added a commit to lucasbeiler/arch_install_sh that referenced this issue Jan 11, 2021
Currently, I create my own sandboxing mechanisms using bubblewrap, seccomp-bpf and AppArmor. Also, Firejail is supposed to be somewhat insecure: netblue30/firejail#3046
@crocket
Copy link
Contributor

crocket commented Sep 9, 2021

Here's another perspective on security and privacy.

Firejail has its flaws, but it is the only thing that does what I want. I decided to use firejail after agonizing over the choice between firejail and bubblewrap.

bubblewrap doesn't execute programs in an existing network namespace. firejail does. I really want to execute programs in tor network namespace which forces applications to connect to the internet over tor. I could even create VPN network namespaces.

The privacy benefits are immediately tangible, and if I sandbox all potentially compromising programs that I run with firejail, net attack surface of my system may get reduced.

Often, security and privacy don't mix well together. Google's chrome browser is intent on infringing user privacy, but it is the securest browser. I don't want to voluntarily offer my information to big tech companies like google and microsoft.

For big tech companies, safety and security are code words for control. I mean when big tech companies talk about security, they actually mean control. Control of user data is one form of control. They(windows, MacOS, and google chrome) may be better for security, but the additional security they provide is just another way to make sure that they are the only ones that collect user data and that a user's system is locked down so that they don't have any freedom with their operating systems. Secure boot is one example. It may help a user prevent hackers from modifying boot process, but microsoft has tried and failed for many years to prevent windows computers from installing linux through secure boot.

Privacy is the reason that I keep my smart phone off unless I absolutely need it for SMS verification or other things. Smart phones may be locked down tightly, but they will leak your location to big tech companies like apple and google. Big tech companies have been known to give their users' location data to government agencies. Even if you turn off location tracking, location tracking stays alive in the background until you turn off your phone.

Without freedom and privacy, security doesn't mean much. Let's hope that landlock LSM gives birth to a better sandbox platform in the future.

He who gives his freedom for safety gets none of them. - Thomas Jefferson

@dm17
Copy link

dm17 commented Sep 9, 2021

Often, security and privacy don't mix well together. Google's chrome browser is intent on infringing user privacy, but it is the securest browser. I don't want to voluntarily offer my information to big tech companies like google and microsoft.

I have good news for you :) https://github.com/Eloston/ungoogled-chromium

Privacy is the reason that I keep my smart phone off unless I absolutely need it for SMS verification or other things. Smart phones may be locked down tightly, but they will leak your location to big tech companies like apple and google. Big tech companies have been known to give their users' location data to government agencies. Even if you turn off location tracking, location tracking stays alive in the background until you turn off your phone.

And more good news: https://grapheneos.org/

@crocket
Copy link
Contributor

crocket commented Sep 9, 2021

https://github.com/Eloston/ungoogled-chromium

I think qutebrowser and librewolf are better in terms of privacy than ungoogled-chromium. Librewolf specifically focuses on eliminating telemetry.

And more good news: https://grapheneos.org/

I don't know whether grapheneos prevents location tracking. Cell towers, GPS, WiFi, and bluetooth constantly track smartphone location. But, grapheneos seems better for privacy than android.

@dm17
Copy link

dm17 commented Sep 9, 2021

https://github.com/Eloston/ungoogled-chromium

I think qutebrowser and librewolf are better in terms of privacy than ungoogled-chromium. Librewolf specifically focuses on eliminating telemetry.

Yes, but to have great privacy you need better security than a Firefox fork, right? But I suppose you've mitigated that using firejail. Back when I compared all of them, ungoogled-chromium had the lowest amount of telemetry - but would like to hear what ungoogled-chromium has that qutebrowser and librewolf don't - if you know...

And more good news: https://grapheneos.org/

I don't know whether grapheneos prevents location tracking. Cell towers, GPS, WiFi, and bluetooth constantly track smartphone location. But, grapheneos seems better for privacy than android.

It is hard to find good references on such things. GOS doesn't have any tracking in the OS, but it is hard to know what cell towers can accomplish with the closed source radio firmware. The GOS developer is very open for discussion (in the chat rooms) if you can determine anything that they've missed: https://grapheneos.org/contact
You can prevent any app from having GPS access, unless it requires it to run - but then that is your choice to allow it.

@crocket
Copy link
Contributor

crocket commented Sep 9, 2021

Yes, but to have great privacy you need better security than a Firefox fork, right? But I suppose you've mitigated that using firejail. Back when I compared all of them, ungoogled-chromium had the lowest amount of telemetry - but would like to hear what ungoogled-chromium has that qutebrowser and librewolf don't - if you know...

I'm going to be honest. I assumed that qutebrowser and librewolf would offer better privacy than ungoogled-chromium because

  • librewolf specifically focuses on eliminating telemetry
  • qutebrowser uses QtWebEngine instead of stripping the google parts from google chrome. I assumed QtWebEngine would have stripped telemetry better than ungoogled-chromium because QtWebEngine is literally just a component upon which to build customized browsers. ungoogled-chromium's only apparent focus is to remove google from google chromium. It doesn't focus much on eliminating telemetry.

You can prevent any app from having GPS access, unless it requires it to run - but then that is your choice to allow it.

Location data are still accessible from government and big tech companies even if apps don't have access to location. Smartphone location data are used for contact tracing which is just a cover for taking away freedom of movement and freedom of assembly. As I wrote, for big tech companies, security is just another way to lock down options and control users. They have better security because they want more control. Security that leads to more oppressive control is not a good form of security.

@rusty-snake
Copy link
Collaborator

rusty-snake commented Sep 9, 2021

ungoogled-chromium has removed all telemetry, it does not do any network connections without user interaction.

Be aware that some source to get ungoogled-chromium update very later/irregular => worst security (unpatched public vulnerabilities).

@SkewedZeppelin
Copy link
Collaborator

SkewedZeppelin commented Sep 9, 2021

Since the topic is derailed:

browser

Firefox + arkenfox.js + uBlock Origin is great. My brace provides that out of the box. Brace also provides a enterprise policy override to harden Chromium.

I also provide Mull for that same configuration on Android.

Android ROM

For devices not supported by GrapheneOS, I offer DivestOS.

Location

You might also want to see this and this and also this and this.

@crocket
Copy link
Contributor

crocket commented Sep 10, 2021

Anyway, the point is

  • Firejail improves privacy by enabling users to quickly sandbox applications with profiles and to execute programs in existing network namespaces. Bubblewrap itself is not designed to be used directly by users. No front-end for bubblewrap covers the use cases of firejail, yet.
  • Firejail's attack surface is large. But, in perspective, the attack surface of a web browser is at least million times larger than that of firejail. Firejail could improve security to a degree if I sandbox all dangerous applications like telegram and skype and web browsers and media players with firejail. Arbitrary code execution as a user can be as devastating as arbitrary code execution as root because sensitive data are accessible by the user that runs large applications like firefox.
  • While a better alternative is desirable for better security, there is none, yet.
  • Firejail should try to reduce attack surface by separating privileged parts into separate binaries.

@dm17
Copy link

dm17 commented Dec 6, 2021

Anyone have a security comparison for running browsers in flatpak vs firejail vs podman vs docker (non-root)?

@crocket
Copy link
Contributor

crocket commented Dec 7, 2021

flatpak isn't just a sandbox. It is also a packaging standard. If you don't agree with flatpak as a packaging standard, you don't want to use it. You may not like the way specific flatpak packages are packaged.

Docker is a reproducible application container. Each application container comes with its own configurations. If you want to meddle with container's built-in configurations, you better create a new container. Creating a new container is cumbersome.

Podman is a drop-in replacement for docker.

Flatpak, docker, and podman don't have as much flexibility as firejail. Firejail lets you configure your applications as you like. You use flatpak, docker, and podman when you want to just accept pre-built application configurations. They are good for sharing pre-configured applications in corporations, but they are cumbersome for individuals.

If you want something comparable to firejail, you better create an application sandbox on top of bubblewrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question_old (Deprecated; use "needinfo" or "question" instead) Further information is requested
Projects
None yet
Development

No branches or pull requests