News for hackers. Stuff that matters.
Re:Linux Kernel Lockdown and UEFI Secure Boot by Arbalest on Thursday April 05, 2018 @02:24AM (#16762322)
Let's be clear here. This is about enabling Lockdown when UEFI Secure Boot is enabled by default.

So the concern is essentially that binary distributions, which are going to be responsible for kernel flags, may enable this, whether it is default in the default kernel config or not. As best as I can tell that is the crux of Linus' concerns. MJG suggesting that the kernel flag can be turned off, while true, is not a response which considers the defacto usage which may result.

Re:Linux Kernel Lockdown and UEFI Secure Boot by dingo_bat on Thursday April 05, 2018 @03:06AM (#16762535)
But as Linus said, kernel lockdown has nothing to do with secure boot. Both are separate things. Why tie them together by default? It's like "automatically burn CD" if a CD-R is inserted into the drive. I can burn a CD sometime later. Or I can insert a CD-R and play it, not burn it.
Re:Linux Kernel Lockdown and UEFI Secure Boot by Jasper_ on Thursday April 05, 2018 @03:25AM (#16762653)
From the top: the goal of the lockdown mode is to prevent someone who has UID=0 ("root") in the kernel from being able to modify or tamper with it (ring0 / CPL0 access). This can be done through /dev/mem, kexec, or even by asking a PCI card or FireWire device to DMA into physical system memory. Basically, there are a lot of hooks to tamper with the kernel, and "lockdown" mode turns them off.

Now, this only really makes sense if you are in some sort of trusted untampered environment already: if not, someone with root can stomp a new kernel in /boot/ which gives them a backdoor. So, lockdown without a trusted boot environment is security theater, since you can just take the long road anyway.

Additionally, in a trusted boot environment, the lockdown flag is wanted. If not, "trusted boot" really isn't such: someone that booted through a signed kernel can simply tamper with the kernel anyway after booting up through an init hook. The dangerous part: once they have the ability to tamper with the kernel, they can chainload another operating system and functional as a poisonous bootloader. The danger here is that if an attack like this is seen in the wild, and the attacker used, say, Fedora's kernel signing keys to do the attack, it has the possibility to get Fedora's keys blacklisted by OEMs. Linux would do best not to be used by an attacker as a "malware bootloader".

That means it's reasonable for, by default, lockdown to be informed by the presence of a trusted boot environment.

Re:Linux Kernel Lockdown and UEFI Secure Boot by Doxin on Thursday April 05, 2018 @04:38AM (#16763006)
Presumably in that case you'd also want the kernel to fail loudly when it isn't booting securely. Say you enable lockdown but somehow manage to misconfigure secure boot, You'd much rather have the kernel go "oh whoops I've got lockdown enabled but I wasn't booted securely" than to boot the kernel insecurely without notice.

And just like that it stops being a magically enabled thing and becomes something you have to either have fully on or fully off.

Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @04:42AM (#16763029)
The kernel isn't able to determine whether you booted in a verifiable manner in all cases, so there's functionality that allows the bootloader to make that decision rather than the kernel. But if you don't have a verified boot environment and someone is deliberately attacking you, it's easy for them to fake up your early boot environment such that the kernel believes it's booted securely even if it hasn't been.

If you want to protect against accidents then you can do that in userspace. There's no need for the kernel to be involved.

Re:Linux Kernel Lockdown and UEFI Secure Boot by Jasper_ on Thursday April 05, 2018 @04:47AM (#16763046)
One would hope your system would complain loudly in the BIOS if Secure Boot wasn't on regardless of the operating system. If some malware manages to misconfigure Secure Boot, it can also patch your kernel to remove the complaining.
Re:Linux Kernel Lockdown and UEFI Secure Boot by tjoff on Thursday April 05, 2018 @04:22AM (#16762925)
Wait, all these are protections are useless because someone with root can defeat them? Huh?

These protections should vastly reduce the risks of someone gaining root and make it much harder to do so to a running system with physical access. Or?

Seems to me that it is just as much security theater to pretend that it isn't game over if someone already has root.

edit: and perhaps the (by far?) biggest benefit of lockdown is to make it harder for someone to gain root?

Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @04:25AM (#16762938)
There's a kernel-imposed boundary between being a user and being root. Right now there's also a partial barrier between being root and being the kernel that's fairly easily circumvented. Now that we can protect the on-disk copy of the kernel from root, there's also interest in protecting the in-memory copy of the kernel from root.
Re:Linux Kernel Lockdown and UEFI Secure Boot by tjoff on Thursday April 05, 2018 @10:30AM (#16765200)
Yes. And lockdown helps with (right?):

a) locking root out of kernel

b) locking users from becoming root

I interpret the reasoning as: if we can't do a AND b we won't bother with b. Which is confusing because b is many orders of magnitudes more important than a.

Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @11:10AM (#16765598)
b) is a barrier that's already supposed to exist, so these patches don't have an impact on it.
Re:Linux Kernel Lockdown and UEFI Secure Boot by tjoff on Thursday April 05, 2018 @11:22AM (#16765707)
Supposedly yes, but shoudln't it vastly reduce the attack surface by not having to worry (compared to now) about all device drivers that use DMA (which otherwise is just impossible to keep track of).

In my opinion reducing that attack surface alone on b) has a much higher impact than a) could ever achieve.

Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @12:43PM (#16766503)
The stuff lockdown impacts is stuff that only root can do right now, so in theory it's only handling channels that are irrelevant to b). Users should already be prevented from triggering arbitrary DMA, for instance.
Re:Linux Kernel Lockdown and UEFI Secure Boot by tjoff on Thursday April 05, 2018 @07:33PM (#16769732)
Well, should, again, device drivers are notoriously bad and some protection against that is extremely valuable.
Re:Linux Kernel Lockdown and UEFI Secure Boot by Jasper_ on Thursday April 05, 2018 @11:57AM (#16766074)
a) prevents a temporary breach of b) from turning into a persistent attack. b) is still very important, so important that when b) breaks it is considered a CVE!
Re:Linux Kernel Lockdown and UEFI Secure Boot by salawat on Thursday April 05, 2018 @11:58AM (#16766082)
So... you know, it occurs to me that none of this would be a problem if people understood two things:

A) Computers are tools designed to do whatever the user tells them to do.

B) The original architecture of the Internet assumed a network connecting implicitly trusted users

Stop trying to mess up a perfectly good tool by making it nigh impossible to work with, and redesign a networking/computing infrastructure that doesn't implicitly trust all users as a fundamental assumption.

This type of thing is getting completely out of hand.

If you want security SO badly you are willing to sacrifice billions of potential users freedoms to use their hardware as they see fit, coming up with a second "SECTERNET" architecture should be a price you're willing to pay right?

This pattern of trying to lock a user out of any tier of control of their own machine reeks of the continuing attempts by companies to deprive users of the privilege of ownership.

I realize it may be difficult to see for some, but this is a literal case of the road to Hell being paved with good intentions.

People don't need to be "protected" by building their volition out of the system.

Re:Linux Kernel Lockdown and UEFI Secure Boot by Jasper_ on Thursday April 05, 2018 @04:40AM (#16763015)
"root user" is a term that we choose to mean what we want it to. Some people in the Linux community want to restrict the root user / cap_sys_admin so that even them cannot tamper with a secure kernel or run ring0 code under certain configurations. I think this is a great idea.
Re:Linux Kernel Lockdown and UEFI Secure Boot by caf on Thursday April 05, 2018 @08:01AM (#16763963)
The dangerous part: once they have the ability to tamper with the kernel, they can chainload another operating system and functional as a poisonous bootloader.

Here's the bit I don't get: even if you can't be used as a chainloading malware bootloader, can't you still be used as a slightly more complicated malware bootloader that fires up the victim OS under virtualisation?

Re:Linux Kernel Lockdown and UEFI Secure Boot by gruez on Thursday April 05, 2018 @08:40AM (#16764283)
under secureboot, you would need to get that boot loader signed
Re:Linux Kernel Lockdown and UEFI Secure Boot by caf on Thursday April 05, 2018 @09:49AM (#16764854)
But you are signed - you're a vanilla distro kernel booting a custom userspace that fires up the victim OS under virtualisation.
Re:Linux Kernel Lockdown and UEFI Secure Boot by Jasper_ on Thursday April 05, 2018 @11:47AM (#16765967)
You're suggesting a construction like Blue Pill[0], right, where you have a "malware hypervisor"? The concept is known, security people are aware, it's considered moderately infeasible, and multiple techniques can prevent it[1].

[0] https://en.wikipedia.org/wiki/Blue_Pill_(software) [1] http://northsecuritylabs.blogspot.com/2008/06/catching-blue-...

Re:Linux Kernel Lockdown and UEFI Secure Boot by caf on Thursday April 05, 2018 @08:12PM (#16769950)
That mitigation technique relies on the anti-malware executable starting before the malware does.
Re:Linux Kernel Lockdown and UEFI Secure Boot by pensativo on Thursday April 05, 2018 @03:45AM (#16762755)
This is what @mjg95 should be saying.
Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @04:18AM (#16762901)
This is literally what I have been saying
Re:Linux Kernel Lockdown and UEFI Secure Boot by pensativo on Thursday April 05, 2018 @07:54AM (#16763913)
Apologies, that wasn't relayed to me in what I've read so far. Good luck.
Re:Linux Kernel Lockdown and UEFI Secure Boot by dingo_bat on Thursday April 05, 2018 @06:05AM (#16763384)
> the goal of the lockdown mode is to prevent someone who has UID=0 ("root") in the kernel from being able to modify or tamper with it (ring0 / CPL0 access)

Exactly, and that's why lockdown and secure boot must be discarded. These are attempts to take control away from the user and give it to the OS maker or device manufacturer. This is exactly why I cannot root my android without losing hardware features and this is exactly why ios devices are not general purpose computers.

Fuck these anti-user efforts. They have no place in Linux.

Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @06:13AM (#16763421)
All Linux distributions that support UEFI secure boot allow you to disable any restrictions if you have physical access to the machine. If you have a device vendor who's implemented something more restrictive, blame the device vendor rather than the software.
Re:Linux Kernel Lockdown and UEFI Secure Boot by throwaway2048 on Thursday April 05, 2018 @01:11PM (#16766775)
or blame the FLOSS people working so hard to enable them.
Re:Linux Kernel Lockdown and UEFI Secure Boot by viraptor on Thursday April 05, 2018 @07:30AM (#16763781)
This is only anti-user from one point of view (where jailbreaking is beneficial). It's completely pro-user, where the user wants to ensure that the environment is what they expect it to be. It really depends on who the user is and what they want to achieve.

Otherwise you could describe something like process memory protection the same way: not being able to read/write directly to a root process is taking the control away from the user after all.

Re:Linux Kernel Lockdown and UEFI Secure Boot by shawnz on Thursday April 05, 2018 @10:04AM (#16764970)
> this is exactly why ios devices are not general purpose computers.

What general purpose computation requires root?

Re:Linux Kernel Lockdown and UEFI Secure Boot by teknopaul on Thursday April 05, 2018 @08:06AM (#16763996)
I second this. I use linux because i want root. Linux needs users to be kernel devs. If hardware vendors want to lock down kernels let them patch in the lockdown.
Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @02:47AM (#16762435)
It's something that users are guaranteed the ability to disable for all distro kernels.
Re:Linux Kernel Lockdown and UEFI Secure Boot by Arbalest on Thursday April 05, 2018 @03:03AM (#16762523)
How so? Adding such an ability removes the security right? If someone can set kernel flags, they could just as easily set the lockdown flag. If the package maintainers provide a different kernel image, then you still have the next boot issue. The fact that the shim exists erases any real protection against this.

Therefore the only real protection comes when you put your own keys in. In which case, once again, enable lock down in the kernel config. I imagine that is exactly something enterprise vendors would be looking at.

In the process of writing this, I have come to the conclusion that consumer secure boot is meaningless while the shim exists. The Microsoft approval process is, as I believe you said many years ago, fairly simple anyway. A company telephone number and a fee, if we're looking at other serious malicious actors.

I acknowledge I may be misunderstanding this, and that you've already been over most/all of these issues before. I don't mind if you feel a response is not necessary.

Re:Linux Kernel Lockdown and UEFI Secure Boot by mjg59 on Thursday April 05, 2018 @03:13AM (#16762584)
> How so?

Run sudo mokutil --disable-validation

> Adding such an ability removes the security right?

No, because the mechanism used for this requires proof that you have access to the console - a remote attacker can't do it. A local attacker could, but there's support for passwording it to prevent this (it's equivalent to passwording the firmware setup)

> I acknowledge I may be misunderstanding this

You are, but there's a huge amount of misinformation about this stuff out there that makes it hard to find the actual information, so it's not surprising :)

Re:Linux Kernel Lockdown and UEFI Secure Boot by Arbalest on Thursday April 05, 2018 @03:18AM (#16762607)
I forsee this as a step in many online guides on "how do I [x] on linux"

Edit: Having thought about this some more, I think perhaps we can model this workaround after SELinux. Sure, there were trivial cases (my wine game mmaps 0x0 and now doesn't work, after wunderbar emporium), but more often it was something like "My apache can't read my directory" "Just run setenforce 0 and try again" which then, rather than being followed up with audit2allow, usually results in the search "How to disable SELinux permanently".

The fundamental problem is that, and you've covered this ground plenty of times, Secure boot is not secure by default. We're not really affording much more security for the most vulnerable systems which is run by small time system administrators rather than large tech corporates.

Sure it would be great if we could educate people to protect their chain of trust (and arguably the best solution), but instead what we have is something which hampers usability, and opens the door to people who plan to come around and barricade the door after you.

So by tying in this security by default measure, we could arguably afford and even greater illusion of protection, which runs counter to the intent of extending the protection of secure boot. Anyone willing enough to protect their chain of trust explicitly is also going to be able to research the issue.

The flip side is that SELinux was adopted anyway. If there aren't actually that many server use cases which require this work around, then: Protection, awesome. But unlike SELinux policy, Lockdown policy is baked into the kernel (right?). If there are any issues, there is only one solution: disable Kernel Lockdown, which might be achieved by disabling secure boot validation.