Slashdot Mirror


OpenBSD Will Get Unique Kernels On Each Reboot (bleepingcomputer.com)

An anonymous reader quotes a report from Bleeping Computer: A new feature added in test snapshots for the upcoming OpenBSD 6.2 release will create a unique kernel every time an OpenBSD user reboots or upgrades his computer. This feature is named KARL -- Kernel Address Randomized Link -- and works by relinking internal kernel files in a random order so that it generates a unique kernel binary blob every time. Currently, for stable releases, the OpenBSD kernel uses a predefined order to link and load internal files inside the kernel binary, resulting in the same kernel for all users. Developed by Theo de Raadt, KARL will work by generating a new kernel binary at install, upgrade, and boot time. If the user boots up, upgrades, or reboots his machine, the most recently generated kernel will replace the existing kernel binary, and the OS will generate a new kernel binary that will be used on the next boot/upgrade/reboot, constantly rotating kernels on reboots or upgrades. KARL should not be confused with ASLR -- Address Space Layout Randomization -- a technique that randomizes the memory address where application code is executed, so exploits can't target a specific area of memory where an application or the kernel is known to run. A similar technique exists for randomizing the memory location where the kernel loads -- called KASLR. The difference between the two is that KARL loads a different kernel binary in the same place, while KASLR loads the same binary in random locations. Currently Linux and Windows only support KASLR.

31 of 162 comments (clear)

  1. Effects on overall speed? by randomErr · · Score: 4, Interesting

    The rebuilding process shouldn't be that long. Especially if most of the modules are (mostly) precompiled. But with the random order that things will be re-compiled, will a bad order effect the overall performance of the system?

    --
    You say things that offend me and I can deal with it. Can you?
    1. Re:Effects on overall speed? by DaMattster · · Score: 4, Informative

      Enough regression testing has been performed on the technology and no performance loss was noticed. I run a -current snapshot on my laptop and the boot speed and overall performance is just as good as OpenBSD 6.1 without KARL.

    2. Re: Effects on overall speed? by Zero__Kelvin · · Score: 4, Informative

      They won't be recompiled, they will be relinked. Hopefully this happens in the background when the system is up, not at boot time.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    3. Re:Effects on overall speed? by Z00L00K · · Score: 4, Insightful

      My concern over the technology is that it also can cause a non-deterministic behavior for the platform making it hard to capture elusive bugs. This means that you would need to have a way to be able to load a kernel that's mapped identically to the last time when you perform your test and development.

      Bugs that only appears when you have a certain constellation and load order are sometimes wasting weeks of work.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    4. Re: Effects on overall speed? by Carewolf · · Score: 2

      This is a good clarification. Macs already do this:
      https://developer.apple.com/li...

      No, not as far as I can tell. There is a difference between linking and relinking like this. Technically Linux kernels are also linked with their drivers in initrd when loaded, but that is separate from this new randomized relinking.

    5. Re: Effects on overall speed? by ls671 · · Score: 4, Informative

      well from TFS:

      If the user boots up, upgrades, or reboots his machine, the most recently generated kernel will replace the existing kernel binary...

      So it sounds the relinking happens when the system is running and the new kernel is used on next reboot.

      --
      Everything I write is lies, read between the lines.
    6. Re:Effects on overall speed? by BarbaraHudson · · Score: 3, Interesting

      Great way to insert a malicious blob for the normal one, and no ability o checksum the entire kernel to detect it.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    7. Re:Effects on overall speed? by windwalkr · · Score: 4, Interesting

      This is certainly true (and I'd assume that kernel devs might be running with this turned off, or some kind of historical logs kept to track what state their kernel was in during a bug) but it's equally true that exercising things in this way could reveal bugs which were otherwise exceedingly rare, leading to better overall code quality.

      In practice, I would think that read-write data structures are more likely to exhibit this kind of problem though, not the read-only code. There are certainly edge cases (timing changes, etc.) but it's not like an off-by-one error is going to affect you, like it might with data.

    8. Re:Effects on overall speed? by Anonymous Coward · · Score: 2, Interesting

      My concern over the technology is that it also can cause a non-deterministic behavior for the platform making it hard to capture elusive bugs. This means that you would need to have a way to be able to load a kernel that's mapped identically to the last time when you perform your test and development.

      Bugs that only appears when you have a certain constellation and load order are sometimes wasting weeks of work.

      This kind of thing might also expose bugs that were not exposed before, and that, in itself is a good thing. Of course they would likely be very hard to find bugs...

    9. Re:Effects on overall speed? by jellomizer · · Score: 2

      I would say the extra time used for this process is an acceptable trade-off for enhanced security. Uniformity is the biggest security risk that these systems face. If the bad guys knows where all the pieces are on a lot of systems, then they know how to successfully target their attacks.

      That being said, there is a lot of effort in protecting the core system, but protecting your home directory, is where the valuable data normally is. I would like to see Operating systems setup with Application level security with User level security. Right now the main workaround is having the particular application run logged in as a user. I would like to see the applications have their own security permissions outside of the user account.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    10. Re:Effects on overall speed? by Zontar_Thing_From_Ve · · Score: 2, Interesting

      My concern over the technology is that it also can cause a non-deterministic behavior for the platform making it hard to capture elusive bugs. .

      Or they could just simply not fix the bugs to take care of that. True story here. I work for a Fortune 500 company in their IT department and I joined them when my previously employer, a startup, was bought out by my current employer. A guy in my management chain was a huge OpenBSD fan, so he made us run some servers using it. Nothing in production used it, but we had some test systems that did. I know I know. Running something in test that isn't like production.... So anyway, he loved OpenBSD with a passion and we couldn't get rid of it while he was there, even though it wasn't used in production at all. We ended up finding a gigantic bug that made OpenBSD's kernel panic and we could make it panic at will. It was caused by a specific piece of hardware in our servers that ran OpenBSD. We and others told Theo and he admitted it was a real problem, but he said he wasn't going to fix it because too few people had this specific hardware. So manager dude finally admitted we couldn't go on like this because not only could we crash the servers at will, they crashed a lot on their own if we did nothing because of the bug. So we replaced all our OpenBSD installations with RedHat and never went back to OpenBSD.

    11. Re:Effects on overall speed? by TheRaven64 · · Score: 2, Informative

      This is a concern. The work appears to be based on work from UPenn, which compiled everything with -ffunction-sections and -fdata-sections (if you don't do this, it turns out that you leak enough information to find gadgets quite easily) and re-linked programs in a random order on each run (there's a lot of subsequent work on doing it more often, such as the ReRANZ paper at VEE this year). It's not too difficult to debug, because you record the random number seed with the binary and include it in core dumps, which lets someone else reconstruct the exact implementation. The other concern is that randomising the link order has been shown (ASPLOS 2015) to have around a plus or minus 20% impact on performance. Having that variation across reboots for the kernel could be quite frustrating.

      --
      I am TheRaven on Soylent News
    12. Re:Effects on overall speed? by AmiMoJo · · Score: 2

      Surely if you have the capability to insert such a blob into the kernel, you can easily defeat any attempt to checksum it. Just intercept attempts to read the kernel binary and return an unmodified one.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    13. Re:Effects on overall speed? by unrtst · · Score: 2

      You filed a bug report, right? Where is that? (you didn't really provide enough info so that it could be found, even if it existed - like what hardware caused the bug?)

    14. Re:Effects on overall speed? by 101percent · · Score: 2

      I don't see the issue. Some guy was playing around with an isolated OpenBSD machine and found a bug that results in a DoS, and you go directly to Theo rather than filing a bug report (on the project that founded transparent development decades ago). I'm sorry but shit story.

    15. Re: Effects on overall speed? by KiloByte · · Score: 2

      If the attacker can read root-only files, you've already lost. And you can opt to have no debug info.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    16. Re:Effects on overall speed? by TheRaven64 · · Score: 2

      That variation is already present in every linked program anyway.

      To a degree, yes, though in practice it's fairly deterministic and so you tend to only explore a smallish part of the overall space by accident.

      This just changes the dice-roll from only once at build time to each and every boot time. Surely it would suck more to get a randomly slow link at build time and then be stuck with it?

      Not really - predictable slowness is a lot easier to reason about and work around than unpredictable slowness. On a single machine, knowing that something will take 12 minutes is a lot easier to deal with than finding that yesterday it took 8 but today will take 12. Trying to debug a performance problem in userspace code can be very painful if the OS is unpredictable. In a networked system, if every node takes 100ms to respond, that's annoying, but if they all take 80-120ms to respond then your overall performance is typically limited by the 120ms (Twitter is a good example of this: their response time was limited by the fact that, on average, at least one of the machines that needed to respond to create a page for the user would be in the middle of a GC cycle and so respond a lot more slowly than the rest. They fixed it by forcing GC on a fixed interval so that all machines were slow for a few ms, then fast again for a while until the next GC tick).

      --
      I am TheRaven on Soylent News
  2. Some more detail over at undeadly.org by badger.foo · · Score: 5, Informative
    You will find more details over at the OpenBSD Journal site (undeadly.org), specifically the stories KARL - kernel address randomized link and the followup Kernel relinking status from Theo de Raadt. These and other items will also turn up on the project's Innovations page.

    And for that whirlwind tour of what's good in that system, take a peek at my OpenBSD and you slides.

    --
    -- That grumpy BSD guy - http://bsdly.blogspot.com/
  3. Re:What are the (dis)advantages? by richy+freeway · · Score: 5, Funny

    New is always better.

  4. Just one missing component by Anonymous Coward · · Score: 2, Funny

    All OpenBSD needs now is to adopt systemd. Then it wil be totally secure. And more cromulent.

  5. Re: What are the (dis)advantages? by zwarte+piet · · Score: 4, Interesting

    I wouldn't see how if they only change the order in which object files are linked, the routines themselves should be the same and have the same exploit working for them unless the exploit relies on changing code in a fixed position of ram, but then a simple search function to locate the routine to be exploited can be added.

  6. Re:What are the (dis)advantages? by lpq · · Score: 4, Informative

    Similar to the pluses and minuses of Address Space Randomization. Right now, in the static part of the kernel, different subsystems are linked together into 1 binary that is loaded into memory at boot. Along with the assumption that the different subsystems could be linked together in many valid orders, that link could be done when the kernel boots so the different sections of the kernel would load in different places relative to each other. in memory.

    The problem would be when 1 compilation or binary kernel becomes widely distributed such that malware could rely on the relative positions of different subsystems in memory. Using that knowledge might make it easier for malware to make use of different subsystems at run time -- on the premise if you know where 1 is, you know where all the rest are. If you can load subsystems, unpredictably at boot, it would be harder for today's malware to make use of. Instead, the malware would have to replicated the loading algorithm and try to reproduce the load order by calculation to make the same use of those subsystems -- another level of difficulty for malware wanting to use existing subsystems.

    Static load order would be most problematic for embedded binaries that come off a ROM and less so for binaries distributed by a large distro. It's also more problematic if the subsystems are linked together in the same order at compile time (which, AFAIK, they are for the linux kernel).

    That link order could potentially be randomized at link time which would have a large amount of the same benefit as the boot-time randomization for end-user-systems that are locally compiled (with some pluses & minuses).

    I don't know that the benefit of this feature has been quantified or is easily quantifiable. The deficits of this feature I would think minimal in a production (non-development/non-debuggable) product.

  7. The advantages by guruevi · · Score: 5, Informative

    Lots of people here asking about the advantages - here is the laymans explanation.

    So typically with ASLR you load a kernel blob into a randomized space and then it just sits there. An attacker (e.g. an evil hypervisor) could search the entire address space for the kernel or in some other way hook into the kernel binary and then simply count up or down address spaces or more likely pass an evil payload to load exploits against specific parts of the kernel from there. Since you always know which parts come first, you can craft payloads so that it gets passed or overflows until it reaches the vulnerable piece of code.

    What this is doing, it randomized the kernel and subsequently the entire kernel even though it sits in the same spot and you could still find or hook into it, you can't simply count up and down anymore to find the bad piece of code nor can you be guaranteed that weak boundary checks will pass your payload, because even though the system has hooked your vulnerable piece of code somewhere, it's not going to be in the same spot.

    It's basically more fine grained ASLR where you break the program (the kernel) down further in smaller pieces to be randomized.

    --
    Custom electronics and digital signage for your business: www.evcircuits.com
  8. Doesn't uptime defeat this? by jfdavis668 · · Score: 5, Interesting

    Since a lot of servers are up and running for seriously long times, the kernel won't change often. Also, since there are a finite number of permutations, it wouldn't be that hard to find the memory location you are looking for.

    1. Re:Doesn't uptime defeat this? by guruevi · · Score: 5, Informative

      The idea is that when you have hundreds of machines, even though their uptime is high, they'll still all be running 'different' kernels.

      To be able to find a memory location, you have to pretty much already run as root. This is to prevent exploits before they get to that point. Eg. if you have a weak TCP/IP stack and you send an 'evil bit' that overflows the buffer, you're no longer guaranteed that by filling the next n buffers you will be able to execute shell code.

      Once you can search through the memory, you've gotten to a much farther point.

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
  9. Stable and secure nix distros by BBCWatcher · · Score: 2

    Yes, z/OS.

  10. Ooold. by SharpFang · · Score: 4, Funny

    Had it on my 486 that ran Gentoo, and not just with the kernel but most of apps. By the time Emerge World completed and I'd need to reboot for the upgraded kernel to start up, a new version was already available, and Emerge World ran right after start, on whatever updates happened during the previous run would finish about the time another kernel was available.

    --
    45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
    1. Re:Ooold. by ausekilis · · Score: 2

      Who wants their processor to be idle all the time? "Couch-processors" have shorter lifespans than their well-exercised brethren and are more susceptible to diseases and viruses. Gentoo was ahead of the curve by creating an exercise program for all processors.

  11. Re:Secure Boot ? by ledow · · Score: 2

    Not that I know a lot about it but...

    You sign the new kernel with the same signing key as the previous one.

    But, that's not how it works. It's the kernel loader that's signed for Secure Boot, and then the kernel loader is free to use any further verification it likes of what it loads, what it checks, and how.

    Part of why Secure Boot is "no more secure" in most configurations, because you're just certified that you're booting GRUB/whatever in most circumstances, which can be misconfigured to be quite open (which is what most people want - just a way to boot a free OS using a signed bootloader).

    But even if it was signed, it doesn't mean that it can't be unique to the machine in question, it's just a matter of using a chain of certificates, but that's out of "Secure Boot"'s hands and into the hands of the kernel loader configuration.

  12. Re: Effects on overall speed? Only on Windows... by tepples · · Score: 2

    I don't see how 3-year uptime correlates with the oft-repeated "just save your session, log out, shut it down, and start it back up again" workaround for missing or broken hibernate support on particular chipsets in laptop or desktop computers.

  13. Don't think I like this by m.dillon · · Score: 3, Insightful

    If I understand this correctly, the kernel is being relinked and rewritten to the boot partition. That's instant fail in my book.... at least for us, the boot partition is sacrosanct. We do *NOT* write to it except when specifically upgrading a system. We do not do ad-hoc or automated writes to it because years of experience has shown that most corrupted boots (aka machine -> non-working) are due to unexpected events occurring while a filesystem is being written to.

    The rename trick is not a solution (there's the 'ideal' atomic, and then there is the reality. That storage devices can fail in many different ways even while writing a particular sector, that are unrelated to that sector).

    So, honestly, I think OpenBSD is making a huge mistake here. I can see randomization at load-time, but relinking and rewriting the kernel binary on every boot? No. Bad bad bad idea.

    ASLR or equivalent is close to useless anyway. Malware has found ways around it, it makes debugging and bug reproducability difficult (which arguably is more important... that bugs get found and fixed, not simply detected). It also tends to fragment memory which can cause serious problems for long-running systems. And the vast majority of systems will simply restart the service anyway. They might log the seg-fault from the malware, but maybe 0.001% of system owners actually look at those logs.

    -Matt