Security musings

No, and this is far from the only problem caused by BeOS legacy, as BeOS was designed long before security became such a worry as it is today.

chroots are ineffective because you can easily discover files outside of it (by queries, by asking the mount server about mounted disks) and get quite a bit of things done to a file with just knowing its inode and device.

There is a lot of memory sharing that gives applications more access than they should have to app_server data (including the framebuffer) and writing a keylogger is also trivial. Since a lot of things run as add-ons, they don’t spawn their own processes, making them harder to detect.

The defence is to keep your computer offline or use an operating system designed with all these problems in mind. I don’t think the Haiku team is staffed well enough to work on such issues. For now you get a bit of security by obscurity (few people know Haiku well enough to set up such an attack), but that will not hold for long if an Haiku user was to be targetted by something like this.

Anyway, what did you expect, all your apps are running as the root user with way too much access to everything…

4 Likes

What do you think could or should be done to make Haiku safer. At least the direction in which Haiku development should move should be defined. That security could be achieved in a defined future.

I think this part can be fixed with small effort. It should be possible to run GUI session and applications from non-root user and implement some permission confirmation dialog when running applications that need root privileges. It do not need to implement proper multi-user support.

3 Likes

I don‘t think posix multiuser is the tool to use here, there are way more ressources than just file directory entries that need to be checked for what application may use them.
And even for those the posix model is insufficient. (e.g a chat app uploading a photo should only have access to it once, for upload, and afterwards lose the access)

I don’t think that it is realistic to design and implement some principally new permission and access control system as part of Haiku project with current available developers resources.

5 Likes

It doesn’t have to be “principally new”. OpenBSD is doing some syscall protections. AppArmor on Linux also implements finegrained permissions. From a user perspective, something like Android, where you can grant high-level permissions to each app (access files, access camera, acces microphone, access geolocation, …) seems a good idea: finegrained enough that it is useful, but high level enough that it is not too complicated to configure.

Anyway, the decision will be made by whoever actually implement the things, as usual. So if someone think it is fun and interesting to implement running things as different users, it can happen first. If someone wants to implement an OpenBSD style system, it can happen first as well.

1 Like

All this systems still use classic UNIX users and don’t run everything as root user. So I think making running GUI session from non-root user is good place to start.

3 Likes

No, apparmor does not work on posix permissions. Neither does SELinux, OpenBSD pledge, FreeBSD extended filesystem flags etc.

The app_server should likely not need access to random files it doesn‘t need. Sure, but there are other much more pressing concerns like every application beeing able to use the network stack, even if not designed too (e.g by code injection)

All this features works in addition to POSIX users, not instead it. As you can see, applications in Linux/*BSD are not started from root by default. POSIX users are not declared deprecated feature.

sshd is started as root by default and employs seperation of concerns to make this „safe“

On OpenBSD it uses pledge to make sure it does not get access to files it should not have access to not posix users

It will simply be killed if it tried to open a file descriptor after it has declared (via the pledge call) That it has dropped this capability and won‘t use it in the future.

Individual SSH connections are run from specific UNIX user, not root.

Fortunately, Capsicum exists, so one does not have to reinvent the wheel.

From a user perspective, something like Android, where you can grant high-level permissions to each app (access files, access camera, acces microphone, access geolocation, …) seems a good idea: finegrained enough that it is useful, but high level enough that it is not too complicated to configure.

No, it’s backward: instead of asking for permission to use all microphones in the system, a program should wait until the user gives it a microphone it can use. The user provides a microphone using a system dialog window.

Same with files: a simple application has no access to files and calls the system file dialog to get a file.

1 Like

Posix multiuser allows to quickly solve the problem of a regular application being able to alter files in /system or in a boot partition. That’s a big improvement over the current state of things.

1 Like

Android does both. It can grant access to the microphone prior to starting an app using system settings, or an app can request access to the microphone once it started through a specific notification.

or an app can request access to the microphone once

Again, you don’t want to give an access to the microphone. You want to give a microphone to an app. The right user interface metaphor is facilities, not access.

I actually don’t quite understand what the difference between “giving the app access to the microphone” and “giving the microphone to the app” is. Isn’t it just a different way in phrasing the UI, but essentially technically the same?

3 Likes

You know how Javascript apps running in the browser can read files from your local drive, but only if you open them explicitly using a file dialog, or with drag&drop? It doesn’t get access to all your files forever more. Just the one you hand over each time. That’s the difference.

So instead of giving access to the microphone once (maybe at install time, or on first use) the app needs to ask for permission to use the microphone everytime it needs it? I think I still don’t quite grasp the difference, sorry :frowning:

Isn’t it just a different way in phrasing the UI, but essentially technically the same?

Mechanics is same, but phrasing implies fine granularity. So for example, this is big no:

Why? Because it does not allow the user to pick which microphone the application is allowed to see. The application should not be aware of any microphones but the one given by the user. Moreover, the user should be able to provide any audio source as a virtual microphone.

Another important detail: if user decides not to provide a microphone, this should be indistinguishable from the situation when there’s no microphones at all.

5 Likes

Think of it as getting consent to touch another person. Even if you do, it’s not blanket permission to do anything, and it’s not permanent.

1 Like