Much ado about SBAT
Much ado about SBAT
Posted Jul 20, 2023 16:30 UTC (Thu) by bluca (subscriber, #118303)In reply to: Much ado about SBAT by gray_-_wolf
Parent article: Much ado about SBAT
Posted Jul 20, 2023 16:49 UTC (Thu)
by gray_-_wolf (subscriber, #131074)
[Link] (27 responses)
sbat,1
And if there is problem with CONFIG_FOO=y, linux wound bump the number to 2, so fedora would produce
sbat,1
While debian
sbat,1
And `the UEFI CA issues an update to SBAT` would be:
sbat,1
Is that correct? That seems like it will be... fun to keep up to date, I guess?
Posted Jul 20, 2023 16:58 UTC (Thu)
by WolfWings (subscriber, #56790)
[Link] (20 responses)
If linux.fedora's changes were the cause of a vulnerability, then linux.fedora's number would increment entirely independently of linux in your example case.
When you carry forward upstreams SBAT lines you can benefit from their generation epochs.
Posted Jul 20, 2023 23:01 UTC (Thu)
by cquike (subscriber, #107549)
[Link] (11 responses)
Posted Jul 20, 2023 23:52 UTC (Thu)
by bluca (subscriber, #118303)
[Link] (10 responses)
Posted Jul 21, 2023 10:19 UTC (Fri)
by dvdeug (guest, #10998)
[Link] (9 responses)
Posted Jul 21, 2023 15:39 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (8 responses)
Posted Jul 21, 2023 20:45 UTC (Fri)
by dvdeug (guest, #10998)
[Link] (6 responses)
Posted Jul 21, 2023 20:53 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (5 responses)
Posted Jul 21, 2023 21:23 UTC (Fri)
by mjg59 (subscriber, #23239)
[Link] (3 responses)
Posted Jul 22, 2023 9:00 UTC (Sat)
by WolfWings (subscriber, #56790)
[Link] (2 responses)
The RFC was expecting that "once you hit /init it's no longer relevant" which would indeed exclude the supermajority of CVEs from ever increment the counter.
But the reality is this: Secure Boot carries forward long past the boot phase into userspace, and if that has a vulnerability that allows sufficient escalation then to the user it is functionally identical to any other secure boot compromise:
Suddenly the OS isn't the one you signed keys and did all the security hoopla for.
Which yes, means that the SBAT scope for "the ENTIRE kernel" includes parts WAY outside of the "boot" portion of things. It also ends up including everything callable from userspace including second-tier stuff like NFS that requires networking and filesystems first, etc.
Maybe a more narrowly defined initial record for 'linux-pre-init' as a component name or something instead that's just the UEFI-stub-to-/init codepath fits what the initial submission expected for a rarely-changing codepath.
But the full 'linux' meta-component would have to update it's counter rather frequently so X-1 fallback would be woefully insufficient and result in 'functionally bricked' systems for various degrees of brickage.
Posted Jul 22, 2023 10:39 UTC (Sat)
by bluca (subscriber, #118303)
[Link] (1 responses)
Posted Jul 27, 2023 4:37 UTC (Thu)
by WolfWings (subscriber, #56790)
[Link]
Took me a'while to realize that, the kernel devs were largely approaching it as "Okay, it's named linux, so you mean the whole kernel then?" thus my suggestion to make it more clearly just the early-boot region that the epoch is covering with a more verbose and narrowly defined name. I think it was causing cognitive overload at times in attempting to use the shortest possible component name.
Coming back with "Any security flaw in the codepath from initial execution up until UEFI ExitBootServices is called" possibly with the modifier "...that allows unsigned code to be executed." as a recurring phrase for "What increments the epoch?" instead of variants on "Whatever those in charge decide." might have had a better cooling effect, and kept the scope much more narrowly defined. Requiring it to only be of concern for signed code would also mean for example unsigned-module mode might be entirely out of scope, etc.
But this is my years of dealing with PCI-DSS/HIPPA/etc compliance audits coming to the fore: Defining the scope as narrowly as possible is a huge part of passing security audits in the real world, and that seems to apply to keeping the epoch number from skyrocketing and becoming real-world-worthless.
Posted Jul 24, 2023 8:41 UTC (Mon)
by paulj (subscriber, #341)
[Link]
I'm pretty sure we've had some articles recently containing discussions about the impossibility of securing filesystems from bugs and exploits, and the need to restrict which user-provided FSes the kernel will mount...
Posted Jul 22, 2023 0:36 UTC (Sat)
by geofft (subscriber, #59789)
[Link]
Specifically - I think this conversation would be more productive if you could define what exactly counts as an exploit that SBAT should protect against / that would merit bumping the SBAT generation number. My understanding of Secure Boot is there are two ways to think about this:
1) An attacker should not be able to produce a bootable system image using other people's signed kernels/bootloaders/shims/etc. that gets them arbitrary code execution in ring 0 before ExitBootServices() has been called.
2) An attacker should not be able to produce a bootable system image using other people's signed kernels/bootloaders/shims/etc. that gets them arbitrary code execution in ring 0 at any time.
The second one is what kernel_lockdown(7) is meant to protect against. But that's a more stringent policy than I think is really possible to achieve at least in the MS UEFI ecosystem. As mentioned, there are the Ubuntu shim/GRUB binaries, and also Windows itself hasn't been treating root -> ring 0 as a security issue (see e.g. http://www.github.com/ionescu007/r0ak which is a worked example of a driver allowing kernel read/write).
If the second definition is what you're actually trying to solve (and I might be out of date here and maybe the Ubuntu shims are now revoked?), it would be worth clearly documenting that, and then people can start producing those exploits. The ksmbd vulnerability mentioned in a sibling comment could quite easily be weaponized. But also a whole lot of other things that have the benefit of starting from a privileged position, like root in the initramfs, are interesting too.
If you're going for the first definition, I think it's worth documenting that too, because there's relatively code that runs before ExitBootServices() - there is some attacker-controlled stuff (command line parsing, initrd loading but not mounting), so an exploit isn't out of the question, but there's very little of it. And that might help the kernel folks get more comfortable with the idea of maintaining a generation number.
Or maybe you're going for some other definition which is not obvious to someone who does pay attention to Secure Boot, which means it'll be even less obvious to the average LKML reviewer.
(Or maybe the practical threat model here is that you want to make sure that attackers can't run code even in ring 3 as root, which means you can't trust the MS UEFI ecosystem and you have to sign all your own kernels/UKIs with your own key that you enroll yourself in DB and KEK... at which point you want to maintain the SBAT generation on your own and not trust anyone else to do it!)
To be clear - I am absolutely on board with criticizing the LKML crowd's refusal acknowledge what sort of bugs are security bugs and treatment of e.g. adding support for a new PlayStation controller's buttons as an "All users must upgrade." stable release that datacenter sysadmins need to care about just as much as they care about remote code execution in kernelspace. But I think that not clearly defining the security goals of SBAT / Secure Boot and saying you're only interested in vulnerabilities with known exploits risks making essentially the same mistake. It's silly to say that a vulnerability with a PoC that gets arbitrary code execution doesn't matter to you because nobody has constructed an exploit against your particular use case: they clearly could, and the only people who benefit from the obscurity are black hat attackers. A bug doesn't become unexploitable by refusing to mention the CVE in the commit message; neither does a bug become unexploitable by pointing out that there are no public exploits.
Posted Jul 21, 2023 7:43 UTC (Fri)
by juliank (guest, #45896)
[Link] (7 responses)
so if you had revocations
linux.fedora,2
and linux,1 was the latest SBAT
linux gets an update, we drop the linux.<anything> and only insert the linux one:
linux,2
Then fedora gets another issue and we have
linux,2
Then linux gets another issue and we have
linux,3
Posted Jul 21, 2023 10:13 UTC (Fri)
by gray_-_wolf (subscriber, #131074)
[Link] (6 responses)
Posted Jul 21, 2023 10:36 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (5 responses)
Posted Jul 21, 2023 13:11 UTC (Fri)
by zdzichu (subscriber, #17118)
[Link] (4 responses)
Posted Jul 21, 2023 15:39 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (3 responses)
Posted Jul 22, 2023 16:32 UTC (Sat)
by zdzichu (subscriber, #17118)
[Link] (2 responses)
What gen numbers they will get in answer?
Posted Jul 22, 2023 16:53 UTC (Sat)
by excors (subscriber, #95769)
[Link] (1 responses)
Posted Aug 4, 2023 8:43 UTC (Fri)
by ghane (guest, #1805)
[Link]
Assume there are two sets of exploits, set A (which Google feels Handset OEMs can fix by themselves quickly) and set B (which need blobs from Qualcomm, etc). These are called (eg) 01 July 2023 and 05 July 2023 (the 1 and 5 are constant).
If you fix set A, you roll out the update, and claim "1 July 2023". You then have time to talk to upstream chip manufacturors, and at some time roll out "5 July 2023".
You cannot claim 1 Aug 2023, (or any future version) however, till 5 July 2023 has been included.
So from a user (and app developer) point of view, any "1" date means you are no more than 1 month behind that month, and a "5" means that you are current till that month.
Posted Jul 21, 2023 1:13 UTC (Fri)
by NYKevin (subscriber, #129325)
[Link] (5 responses)
(I have no idea if the standard allows that, but if the standard is unwilling or unable to accommodate Linux, then any standard-conforming hardware will become effectively unsalable to datacenters and Android manufacturers, so I imagine they would find a way to make it work if it currently does not. Worst case, we would just have linux,1 forever and there would never be a linux,2.)
Posted Jul 21, 2023 8:35 UTC (Fri)
by taladar (subscriber, #68407)
[Link]
At that point we could certainly talk about security theatre though.
Posted Jul 21, 2023 9:12 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (3 responses)
Posted Jul 22, 2023 3:16 UTC (Sat)
by NYKevin (subscriber, #129325)
[Link] (2 responses)
Ultimately, the problem here is that somebody has to bell the cat, and at least historically in the FOSS community, things usually work out best if the person belling the cat is the person who actually wants the cat to wear a bell in the first place. The alternative just leads to the Nebraska problem,[1] which would be very bad in this case as it could leave a large amount of hardware suddenly unbootable.
Posted Jul 22, 2023 4:59 UTC (Sat)
by plugwash (subscriber, #29694)
[Link]
1. If we want our Linux distros to keep booting out of the box on new computers, then we have to play along with the secure boot "ecosystem", which is ultimately controlled by Microsoft.
So it was determined that a more efficient revocation scheme was needed, one that could basically say "any version of software package "x" that is older (in security fix terms) than "y" is vulnerable rather than having to revoke images individually.
Posted Jul 22, 2023 10:44 UTC (Sat)
by bluca (subscriber, #118303)
[Link]
No, Debian is involved too. Not only myself, but the maintainers of the bootloader stack are not only fully aware but also actively working on this, both downstream and upstream in the Shim community.
Much ado about SBAT
linux,1
linux.fedora,1
linux,2
linux.fedora,2
linux,2
linux.debian,1
linux,2
linux.debian,1
linux.fedora,2
Much ado about SBAT
Much ado about SBAT
Is that understanding correct?
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
linux.debian,2
linux.fedora,3
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Fedora backports the fix for 001 in their kernel. Arch backports fix for 002. They need to get new generation ID for their patched kernels, so they ask central authority.
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
Much ado about SBAT
2. UEFI has very limited space for storing revocations, a single revocation incident consumed around half the availble revocation space. It's not at all clear to me what MS would do if revocation space ran out, but it may well not be nice for Linux.
Much ado about SBAT