Discussion summary

OpenBSD has a use-after-free vulnerability that allows local privilege escalation. Discussions include the security of OpenBSD, the potential of Rust in kernel development, and the challenges of rewriting legacy code.

What the discussion says

  • OpenBSD's codebase is old but accepted as a trade-off for stability.
  • Some believe Rust could prevent such vulnerabilities, but it's not guaranteed.
  • OpenBSD's security is not inherently better, just less scrutinized.
  • Rewriting legacy code in new languages like Rust is complex and debated.
OpenBSD has a use-after-free vulnerability allowing privilege escalation.
Anonymous
Would Rust have made this issue impossible by construction?
poly2it

Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • Blasphemy
  • and yet...
    by znpy
  • Would Rust have made this issue impossible by construction? I know Linus has spoken about Rust's promises about memory safety not being equivalently applicable in the kernel domain, so I would be curious to hear any kernel developer's perspectives.
  • I often refrain from commenting about meta-issues on HN, but I'm particularly annoyed by the downvotes on this question of mine. What is this forum for, if not for this exchange between makers? I've noticed downvotes on questions are an oft occuring pattern. I think the comments on HN should house more than self-contained absolute statements.
  • The Rust ownership model prevents use after free. This type of a bug would not compile.
  • I’m not an OS programmer and have been dabbling with OpenBSD’s code for fun. But the fact is that Rust kinda lacks flexibility. Most of the OS is dedicated to building a beautiful lie for programs to run happily, and that’s where C shine.

    I shudder to think about the amount of work that it would take to convince the rust compiler that everything is all right. Most hardware interactions is “parse, don’t validate” which means you’ll be pinky-swearing to the compiler.

    And for my cursory glances at the code, most structures are handled well, that it’s mostly logic bug (from bad data) instead of bad memory access (which can happen).

  • Rust is designed to make this type of issue impossible, but that assumes that you can correctly encode object lifetimes in the kernel in a way that allows the compiler to check them.

    So I would say that any easy answer like “this would not compile” would just be a guess, because you would want to know more of the particulars in order to answer this question.

    I know that this is kind of a non-answer, but if you want to write a kernel in Rust you have to figure out boundaries for where unsafe {} are. In a kernel, there are probably large chunks of unsafe {} and the Rust compiler prevents certain bugs outside unsafe {} assuming there aren’t bugs inside unsafe {} that would prevent the type checker from doing its job correctly.

  • I'm not a kernel developer but I am an embedded firmware engineer.

    To be clear: I like Rust. It's great, I use it a lot. But, Rust's memory safety stuff can't really save you from the screwiness of ISRs. Here's a long-winded example:

    ST has a nifty double-buffer DMA mode for their ADCs, so you can give the ADC two different buffers, it'll fill one, fire an IRQ, you catch the IRQ and handle the data, meanwhile, it's filling the other buffer, and the IRQ fires again, you handle the data in the other buffer, rinse, repeat.

    This allows the ADC to run continuously, monotonically and at very high sample rates, without monopolizing CPU. It's really a terrific design. I used it for a DIY telephony project once to run continuous FFTs on several ADC channels at once.

    This is all fun, but the architecture introduces synchronization issues that aren't immediately solvable within Rust's data model.

    Okay, so I can't run the FFT from within the ISR, so I delegate that to a thread. Do I have the thread read the DMA buffer directly, and just pray that it does it fast enough that the ADC doesn't loop back around to that buffer until the thread is done?

    Or, do I have the ISR copy the buffer into a queue, mitigating the memory corruption risk? Well that seems good, but how do I make the queue visible to both the ISR and the thread? The ISR takes no arguments, it's just an address the CPU jumps to when a thing happens. Thus, the queue has to be global, which means more unsafe blocks and more very un-idiomatic Rust.

    side note: in my use case, it actually worked just fine with the thread reading straight from the DMA buffer, even with the risk of memory corruption. But you can imagine use cases where the risk would be more severe, like maybe decoding packets from a serial interface.

  • If this is a local privilege escalation to root, why can't I find anything on https://www.openbsd.org/security.html ?
  • OpenBSD has a reputation for being... selective about what they admit is a security-relevant bug.
  • Best guess, from the commit message alone[0]: It was fixed as a bug, at the time they didn't have evidence it could lead to LPE

    The AI security tool then, retroactively discovered that it could have been used for LPE.

    Again, just my guess I could be wrong.

    [0] https://github.com/openbsd/src/commit/1957873d2063db11dab780...

  • Can anyone find the mailing list thread on this topic (or does it not exist because @security are private mailing list)?

    I did find another use-after-free bug from a couple months ago on the mailing list:

    https://marc.info/?t=177581065500002&r=1&w=2

  • from the link:

    sys/kern/sysv_sem.c in OpenBSD through 7.9 has a use-after-free allowing local privilege escalation to root. This is a context switch use-after-free after tsleep in sys_semget().

    by gjvc
  • > Only two remote holes in the default install, in a heck of a long time!

    https://www.openbsd.org/

    https://en.wikipedia.org/wiki/OpenBSD#Security_record

  • LPE (to root) is serious, but it's not a remote hole.
  • OpenBSD's security stance being the stuff of legend, I'm curious how many vulns have been found over the last couple months while the big model companies are flaunting their ability to find exploits. It'd be super cool to see it remain tiny.
  • > OpenBSD's security stance being the stuff of legend,

    More so their marketing.

  • I think of it more as their attention to quality in their code:

    Given the 'quality' of most code, especially under commercial pressure, it's no surprise that much more effective tools will find many more vulnerabilities. Did OpenBSDs quality approach work in this respect?

  • The commit logs over the last few months have highlighted when an issue was found by a program. They usually name the submitter and the tool.
  • According to https://openai.com/index/patch-the-planet/

    Linux: 24 LPEs, plus many additional vulnerabilities.

    OpenBSD: 1 LPE.

    FreeBSD: 7 LPEs, plus many additional vulnerabilities.

    Not sure what that says, though. Perhaps the models are more likely to find Linux issues because of the training.

  • One bug found is a testament to the great diligence and culture around security of OpenBSD. Especially if you take into account the amount of resources they have been able to achieve this with.
  • one bug is all it takes
  • Exactly, the entire AI industry has been trying to create an AI powered security arm race. I am not necessarily blaming them.

    Hard to know how much has been thrown into this but I would bet a lot.

    So far I have been very surprised we haven't been flooded by those type of announcements. If you look you will always find something and OpenBSD is the top price.

  • While I agree, OpenBSD also doesn't fully implement features/functionality.

    If your operating system only does 20% of what another operating system can do, it's easier for you to have 80% less bugs.

    That's not a knock, it's a design philosophy of OpenBSD (which is to do the minimal needed, and no more, in the most simplistic way).

  • +1

    It is also a testament to solid engineering and attention to good security practices in general. These still work, also against fancy new AI attackers.

    When sophisticated attacks become cheaper to run, maybe it will (finally) be cheaper to do more solid engineering instead of doing it quick and dirty and ending up in indefinite bug-squashing mode.

  • Seems to be found as a part of Patch The Planet [0] which is basically OpenAI giving model access and Trail of Bits using them to find vulnerabilities in OSS projects.

    [0] https://openai.com/index/patch-the-planet/

  • neat, i'm a big fan of trail of bits but apparently missed this announcement. here's their post: https://blog.trailofbits.com/2026/06/22/introducing-patch-th... and a summary of week 1: https://gist.github.com/patch-the-planet/69fd1aa925c8e73edea...
  • Sidenote but... I read this on that link:

    dnsmasq: Codex Security independently identified vulnerable patterns corresponding to four of the six dnsmasq CVEs later fixed in 2.92rel2: CVE-2026-4890 (opens in a new window), CVE-2026-4891 (opens in a new window), CVE-2026-4892 (opens in a new window), and CVE-2026-517

    dnsmasq has had so many freaking security holes in 2025 and 2026 that atm I decided to just remove that thing from all my machines.