-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Defining a threat model #279
Comments
I am still working on the formalization of the threat model. However, I presented a wide overview of the security model at my talk at the LSS (see slide 6 of the LSS presentation). It is nothing fancy, it simply tries to apply the concepts behind Android/ChromeOS/ClipOS on a classic linux. AppAmor (or SElinux) is only a MAC system, therefore, it cannot implement by itself the full security construction (that is not the purpose of this project anyway).
This is exactly what this project is trying to do. All resources are defined under variables or abstractions.
Can you give example of such escape? The current architecture allows some escape but mostly due to rules such as
That's not how apparmor (or SElinux) works. AppArmor restrictions apply to everyone, root or not. A confined process needs the (Note: there is exactly the same construction with SELinux on Fedora and on Android/ChromeOS) Ultimately, you can even remove the root user and only consider capability based program. Eg:
A lot of profiles are needed as dependencies of other bigger program. For example, Also, it is both more secure and easier to work with a profile architecture that consist of a lot of simple profiles than a few set of big profiles (that would need to allow everything). Finally, the end goal of the project is to prevent the execution of a process that does not have a profile. This requires to have simple basic profiles - or to put everything in a single profile that would not confine anything - |
Any unfiltered access to IPC services like dbus, X11 or write permissions in @HOME (with access to configuration files). Terminal device files are also an issue. I'm certain there are more but these are the few I read about here If preventing these escapes is an objective there is probably quite a few profiles that are affected and I'm not sure it can even be prevented without restricting the expected functionality in some cases.
If a process has permissions for a subset of privileged actions (like capabilities) there is often a way to work around it. For many capabilities there are ways to become full root which makes capabilities difficult to access. If I recall it correctly among the affected capabilities that allow to gain full root are net_admin and sys_ptrace
That makes sense
Not sure I see the big picture yet but I suspect there is some benefit to it, even if I am uncertain how much exactly, especially due to the point about capabilities above. It probably makes exploitation harder by requiring additional steps at the very least. |
I am not claiming the current rules are perfect. However, all of this is already in place:
People usually complain because it is too paranoid... not too weak. You are more than welcome to give example of thing that could be improved. Ideally, I could even write a linter to autodetect possible issue in profiles.
This is sys_admin that is well known to be overloaded. However:
Furthermore, please note that having a given capability is usually not enough. For example:
So the risk is more to have rules that would be too wide (eg: To me, as of today, the risk would come more from an unconfined process than to a profile that is too weak. Again, it does not mean they are all perfect... |
After reviewing the profiles I do admit that most are a lot better then I initially thought, especially the file permissions.
Any profile that includes abstractions/X or abstractions/X-strict while running X11 is vulnerable to both sandbox escape and possible priv escalation in case of an available root shell in an X11 window. POC:
That seems like a good idea. At least something like checking some common control files like .bashrc for write permissions.
This actually sums it up pretty well. |
Regarding you POC, this is a concern, obviously. However:
From my testing, the solution (for gnome) would be to remove the following rule:
It is however problematic as it is required for all program using xwayland. I don't really care of xorg itself as it is deprecated. I will look for a stable solution for (x)wayland.
Rule 2 is quite clear about this:
Having profiles that break a normal use of a program is the reason why one the first result of the "apparmor" (or selinux) keyword on Google is something like "how to disable this shit". Security is a journey, it will be better tomorrow than today, and it is by far better today than yesterday (without |
Most applications today already support wayland but may also try X11 when available and add this to the profile when automated generation tools are used. A possible solution could be to allow only connections to the wayland socket and to block xwayland when it is not absolutely required. (which would remove support for all X11 desktops, but as you said those are deprecated anyway) |
That's more complex that it looks like. For instance, on Gnome over wayland, if you deny Not to mention that it would break all programs using xwayland (cf Rule 2) Also, (on wayland again) xwayland is only used when it is absolutely required. So maybe I could remove
That's a no go, (cf Rule 2)
Nitpicking a big: That's not how the profiles are generated, and it is not how app works too (they use what is provided to them: running wayland UI on Xorg would not work, the opposite only works thanks to xwayland). |
I use AppArmor to restrict access to files in |
Looking through this repository and reading the documentation has left me wondering what the threat model for this project might be.
To cite the concept documented here https://apparmor.pujol.io/concepts.html
We take inspiration from the [Android/ChromeOS Security Model](https://arxiv.org/pdf/1904.05572v2.pdf), and we apply it to the Linux world
The Android security model has well defined security boundaries that specifies what objects (files, contacts, devices like cameras) can be used by which application. The resulting architecture ensures that both apps and services are isolated without any known ways to escape the isolation.
Reading the profiles in this repository, most rule sets allow several ways to escape the isolation through IPC methods, writeable configurations or device files. I'm trying to see the benefit in this approach as it does not seem like any of the profiles are intended to prevent this escape, so all they do is to close a few of the most direct attack vectors while leaving plenty open to circumvent the isolation completely. (I very much like the audit logging in combination with apparmor that is basically a decent IDS, though this does not seem to be the focus either)
Related to this is also the question what benefit it has to isolate services without major attack surfaces (parsing file formats or connecting to the net) like
top
or administration tools likelvm
. To extend the question, why isolate root applications at all when they can simply remove the apparmor filter altogether?From my perspective, this would include most profiles currently present in this repository, especially the administration tools like systemd-*, lvm and everything that required root to begin with.
Perhaps I am just overlooking something big here in which case the documentation may need an update to specify what use case this project intends to serve.
In any case, I would like to add that this repository seems to be the only available collection of apparmor profiles that appear to be well maintained and I appreciate the work put into this (documentation is especially well put together).
The text was updated successfully, but these errors were encountered: