13 comments

  • amluto 3 hours ago
    On a very very quick read, the bug is that EVP_EncodeBlock malfunctions if the input is larger than ~1.5GB. EVP_EncodeBlock is a function that encodes base64.

    https://docs.openssl.org/1.0.2/man3/EVP_EncodeInit/

    As a seasoned C programmer, I can immediately observe that the whole API is bad: the caller is expected to calculate the buffer length on their own, using a nontrivial formula, and the caller does not pass in the output buffer length, so the implementation cannot validate it. But apparently OpenSSL 4 also implemented it wrong and wrote (possibly far) past the end of the buffer.

    You should probably assume that, if you are running anything that can be convinced to use this API to encode a very long blob as base64, then you are in trouble. I don’t know why a modern server would do this.

    BTW, OpenSSL seems to be a rather low quality implementation of a very low quality set of APIs. Stay away.

    edit: Fixed my size threshold, hopefully. I was thinking of unsigned ints, but this is a signed int. I have not looked at the code, just the description.

    • socketcluster 5 minutes ago
      > BTW, OpenSSL seems to be a rather low quality implementation of a very low quality set of APIs.

      Fully agree with your assessment above that line, but damn, this is a strong statement for a library this ubiquitous. You wonder; how could this happen? And yet, as an open source developer myself, I know how little people care about code quality.

      • Gigachad 2 minutes ago
        We have known this since at least heartbleed. The answer was that basically no one funds the project and it had only one developer.

        All these trillion dollar tech companies have been leaching off open source for free and never contributed back to the projects they rely on.

    • vlovich123 3 hours ago
      > BTW, OpenSSL seems to be a rather low quality implementation of a very low quality set of APIs. Stay away.

      We’ve known this for well over two decade since heartbleed yet for some reason Linux distros haven’t migrated off of it

      • dcrazy 3 hours ago
        For those too young to remember 2014, Heartbleed led to both BoringSSL and LibreSSL being forked from OpenSSL.
        • stock_toaster 50 minutes ago
          And also led to Amazon's s2n-tls and libcrypto being released around 2015 too as I call.

          EDIT: found the release announcement - June 2015 - https://aws.amazon.com/blogs/security/introducing-s2n-a-new-...

        • morkalork 2 hours ago
          TIL it's 2036
          • wahern 1 hour ago
            To be fair, frustrations with OpenSSL long preceded Heartbleed. Heartbleed was just the final straw for those who forked libressl and BoringSSL.

            And to be fair to OpenSSL, it was one of the first widely used crypto libraries, along with Netscape's NSS. Setting aside the reasonablebess of the initial choices, the rapid uptake meant those choices were difficult if not impossible to completely unwind, particularly the style and typing of parameters and error reporting. Even today debates rage about signed vs unsigned, etc, in C and other languages. (But suffice it to say there are still alot of unforced errors, IMO, such as implicit output buffer sizes.)

      • DANmode 1 hour ago
        Not breaking userspace is more important than security………
      • CrimsonCape 22 minutes ago
        I just don't get it; this is a task to hand to an LLM, "go rebuild OpenSSL, use Rust (no mistakes)" and have it churn through a greenfield implementation. Then open a PR =). Why hasn't this happened yet? The fact that the LLM will write tests and deal with all the compiler errors probably puts it lightyears ahead.
        • b112 8 minutes ago
          LLMs have a bottleneck, human review. And human review is absolutely required at this stage (the future is unknown). A rust built LLM only reviewed SSL library would be a recipe for disaster.

          Beyond that, when it comes to exceptionally complex APIs, forward thinking implementation, and revising the 'way things are done'? These are weak points for LLMs. If you don't know how to write OpenSSL(or its replacement), and don't understand all its quirks, and the entire industry surrounding it, you cannot be the human driving the LLM successfully.

          There is no way for a human to catch all the design mistakes an LLM will make, otherwise.

          People seem to get upset, when I say this, for reasons I cannot fathom. However, we need to have a mental model of how we trust LLM output, and the 'new junior' is great for that. Especially considering that every day, is a new day for an LLM, its context window always loses yesterday.

          So consider LLMs as an eager, intelligent, incredibly well read junior, just out of college. And on their third day of work.

          Zero real world experience. Constant review required.

          Would you want that junior to design, build, and write test scripts for a library to underpin the entire internet?

        • fock 1 minute ago
          you don't get credit for that because it is clear you are not very skillful at what AI-bros value most, namely manipulating other nerds...

          if you lok at the commit history of OpenSSL, you can easily notice how a lot of people started contributing once their clanker got up to speed. They are very happy to rip out weird C and replace it with assembler or intrinsics. Rip out lists of characters formatted as a single string and replace them with array syntax, each char quoted.

    • teunispeters 2 hours ago
      I like to declare that industry coding standards such as MISRA exist precisely because code bases like OpenSSL (specifically) exist, as it's such a good example of breaking every sensible rule in the standards.
    • gspr 1 minute ago
      > BTW, OpenSSL seems to be a rather low quality implementation of a very low quality set of APIs. Stay away.

      Well sure, but the world doesn't seem to be able to agree on, or put resources into, a strong contender.

      I'm usually for heterogeneity and diversity in the software ecosystem, but for cryptography I'd be happy with a single high-quality "anointed path". Because cryptography.

    • kvuj 3 hours ago
      > EVP_EncodeBlock() encodes a full block of input data in f and of length dlen and stores it in t. For every 3 bytes of input provided 4 bytes of output data will be produced. If dlen is not divisible by 3 then the block is encoded as a final block of data and the output is padded such that it is always divisible by 4. Additionally a NUL terminator character will be added. For example if 16 bytes of input data is provided then 24 bytes of encoded data is created plus 1 byte for a NUL terminator (i.e. 25 bytes in total). The length of the data generated without the NUL terminator is returned from the function.

      My god, you only see this type of horrendous API in C don't you.

      • cesarb 1 hour ago
        > My god, you only see this type of horrendous API in C don't you.

        This is the appropriate place to put a link to this pair of classics on API design:

        "How Do I Make This Hard to Misuse?" https://ozlabs.org/~rusty/index.cgi/tech/2008-03-30.html

        "What If I Don't Actually Like My Users?" https://ozlabs.org/~rusty/index.cgi/tech/2008-04-01.html

      • td521534f12 2 hours ago
        "No way to prevent this" say users of only language where this regularly happens

        https://xeiaso.net/blog/series/no-way-to-prevent-this/

      • userbinator 3 hours ago
        What's "horrendous"? I don't see anything which stands out as being wrong. It specifies exactly the lengths of input and output.

        gets(), on the other hand, that is "horrendous".

        • amluto 2 hours ago
          Even in C, if you have a function that takes an input buffer and output buffer of differing lengths, the right API has the caller pass both lengths.

          But yes, gets is worse.

          • userbinator 1 hour ago
            takes an input buffer and output buffer of differing lengths, the right API has the caller pass both lengths.

            If there is no fixed relationship between the two, then that makes sense; but in this case there is a very simple and well-defined relationship between them. But to specify two lengths which must always agree; and if not, then what? You've effectively invented an additional artificial error condition, an additional branch, and burdened all the callers up the chain to do something, which is a treacherous path to complexity and the production of even more bugs.

            Or are you just preaching the same mindless idiocy that lead to Microsoft's memcpy_s() (the "s" is for "stupid")?

        • kvuj 3 hours ago
          Perhaps I'm just used to having programmed in C# professionally for a little bit, but these sorts of APIs where you have to do a calculation to determine the destination buffer size make me feel like a caveman. A minuscule typo and you get a CVE like this.

          I know, I know, C is low level and high performance, but surely in the year of our lord 2026, we could have come out with something simpler.

          Horrendous is a strong word, you're right.

          • uecker 41 minutes ago
            One can abstract buffer handling away in C just fine, eliminating all those problems. I don't know why programmers insist on open-coding low-level buffer management.
            • eptcyka 19 minutes ago
              Yes, of course, this isn’t C, this is just another case of people writing C wrong.
          • JSR_FDED 58 minutes ago
            You should be comparing with assembly language, not C#.
    • landr0id 3 hours ago
      >As a seasoned C programmer, I can immediately observe that the whole API is bad: the caller is expected to calculate the buffer length in their own, using a nontrivial formula, and the caller does not pass in the output buffer length, so the implementation cannot validate it. But apparently OpenSSL 4 also implemented it wrong and wrote (possibly far) past the end of the buffer.

      Many such cases.

      I expect we'll see some fun libyuv bugs soon in applications which decode media. The APIs are begging for misuse.

      https://chromium.googlesource.com/libyuv/libyuv/+/refs/heads...

    • octoberfranklin 2 hours ago
      This is really embarrassing because this isn't even ancient code.

      OpenSSL has been around a long time and has a lot of legacy code, but this is in OpenSSL 4.x only -- stuff that was written in the last ~year.

      If they don't have the manpower to write new code safely they should just stick to maintaining what they've already written.

    • userbinator 3 hours ago
      if the input is larger than ~1.5GB.

      ...on a system where ints are 32 bits. The bottom line is that this doesn't appear to be easily exploitable and IMHO it should be the callers of EVP_EncodeBlock which need to be inspected to determine the actual risk.

      using a nontrivial formula

      It's base64. 4/3 expansion; round it up and add padding. What's "nontrivial" about that?

      and the caller does not pass in the output buffer length, so the implementation cannot validate it

      Not necessary, because the caller is responsible for allocation.

      • sweetjuly 1 hour ago
        I am confused why you make out 32 bit int as being rare. Almost all devices that you'd reasonably connect to the internet at this point have int as 32 bits
      • mrheosuper 2 hours ago
        The question can be reduce to "who do the length validation".

        In my case, if i write a public-facing API, i never trust the caller will do the correct thing, thus the caller must provide all the critical parameters, and i must validate all of them.

        • userbinator 1 hour ago
          The question can be reduce to "who do the length validation".

          At the boundary where untrusted input becomes trusted. This is commonly known as the sanitisation/validation layer.

      • amluto 1 hour ago
        > It's base64. 4/3 expansion; round it up and add padding. What's "nontrivial" about that?

        If you mean ceil(inlen * 4/3) + 1 (even if you use exact arithmetic), then you are passing too small a buffer and you will overflow. Maybe your “add padding” part fixes it? In any case, I think that the fact that this confusion is even possible proves my point.

        You should not need to read the manpage of a function you are calling in order to determine whether you have passed a large enough buffer to avoid overflow.

        Reading the manpage to get the function to not return an error would be a different story.

        • userbinator 1 hour ago
          If you mean ceil(inlen * 4/3) + 1 (even if you use exact arithmetic), then you are passing too small a buffer and you will overflow.

          If you let untrusted input reach inlen and overflow that computation, you have already failed:

          https://news.ycombinator.com/item?id=50570319

  • userbinator 2 hours ago
    I think CVSS 9.8 is exaggerated. This is not remotely anywhere near as serious as Heartbleed. It's an internal function which will fail if its input is far too long, but exploitability rests on how untrusted input can reach it; the key word being "untrusted". E.g. if you operate a base64 encoding service on the Internet that just reads all the data into memory at once and calls EVP_EncodeBlock(), that's exploitable. If you have a protocol that involves a block of data with a 16-bit length field which is passed to EVP_EncodeBlock(), that's 100% safe.

    For those wondering about TLS: speaking as someone who has written a TLS implementation, AFAIK neither base64 encoding nor decoding occurs in the protocol itself, and the longest length field is 24 bits (Hello stream). Certificate processing involves ASN.1 which does support arbitrarily-long integers, but that's a big hint to check that they're within a sensical range.

    • tptacek 2 hours ago
      (I'm a broken record on this so I'll keep it brief). The problem here is that the CVSS score is in the headline, as if it meant anything. But CVSS doesn't mean anything. It's a Ouija board; VR people jack it up to get attention, vendors nerf it to chill their customers out.

      Someone should design something better, and less malleable.

      • csnover 2 hours ago
        A few years ago I participated in a study[0] about CVSS and apparently was very much in the minority in feeling that these scores are essentially useless. I have no idea what would actually shift the majority’s opinion on this, but I will at least echo your sentiment that everyone deserves something better.

        [0] https://arxiv.org/abs/2308.15259

        • tptacek 2 hours ago
          It's not an out-there opinion among vulnerability researchers, though.
      • userbinator 1 hour ago
        I think tiny pieces of isolated code like this function simply cannot be assigned CVSS scores, because it's missing all the context and threat model around how it is used.

        Then again, given that I once had to respond to a report which assigned a similar amount of severity to the strlen() function claiming that it will read beyond its bounds if its input is missing a null terminator (DUH!), I'm not surprised at the lack of critical thought among a certain population in this industry.

      • solyin 1 hour ago
        At the end of the day, sysadmins care about "how fucked am I" from an email subject line. A replacement system would be "let me run a daemon on your network telling me what you run" with vendors telling me about the vulnerabilies and I'll tell you if you (the sysadmin) give a shit. Technically that's trivial, but who's gonna trust me to run a daemon like that on their network. Maybe you'd have luck with your public history, but that seems like quite the uphill battle.
  • moezd 5 minutes ago
    The more I see these posts, the more I'm convinced that "never reinvent the wheel" mentality we had so far in software engineering basically covered up a lot of lazy engineering, and we just pretended everything was fine. It's like these findings cross-pollinate.
    • stellalo 0 minutes ago
      Not reinventing the wheel is fine. But one should change tires every now and then!
  • ansipunk 57 minutes ago
    I am not a system administrator, but I am getting a serious vulnerability fatigue, every single day there's at least two new vulnerabilities in major pieces of software, I'm just tired of seeing that everywhere and hearing that everywhere. Fellow system administrators must be having it much worse.
    • wry_xy 7 minutes ago
      I see bugs being patched, and software improving. Bring em on.
  • Panzerschrek 2 hours ago
    That's why it's recommended to use size_t for passing sizes of buffers. It's unlikely to get overflow with it. In this particular case input buffer needs to have size larger than half of address space in order to trigger overflow, which isn't possible (64-bit systems usually have only 48 bits of actual address space, 32-bit systems don't allow allocating so large blocks).
    • wahern 1 hour ago
      Not everybody recommends size_t. There's a sizeable community of people absolutely convinced most integers, including length and capacity integers, should be signed. And they stick to their guns even for C and C++. They have some very compelling logical arguments on their side, but IMO in languages like C and C++ they're just fatally unrealistic.
      • uecker 43 minutes ago
        Why unrealistic? I was in the unsigned camp a long time ago and switched to signed types for indexing and sizes, and this made many problems go a way.

        There was just a nginx issue that highlights how problematic the use of unsigned is in this context: CVE -2026-123007

    • m00dy 2 hours ago
      never say never :)
  • VladVladikoff 4 hours ago
    :/ I really need a day off from patching servers.
    • staplehorse6553 36 minutes ago
      If you stopped patching servers, you wouldn't be affected. Always use trusted, 5-10+ years old code.
    • pixl97 3 hours ago
      Sorry buddy, back to the server mines for you!

      And yea, I'd really like a day where I'm not writing an email to customers about what they do and don't need to update regarding our software.

    • txdv 1 hour ago
      call in the agents
  • asveikau 3 hours ago
    Seems like only OpenSSL 4 is impacted? What distros and systems use that?

    I feel like in the post heartbleed era, a lot of people are not including new features of upstream openssl as much as they used to.

    • agilob 1 minute ago
      Arch

          pacman -Q  | grep openssl
          openssl 4.1.0-1
          openssl-3 3.5.9-2
    • daemonologist 3 hours ago
      Well, Fedora 45 (with which I am composing this message).

      Fortunately it doesn't look like I need to patch anything at work though.

  • jerf 3 hours ago
    So, uh, like, any word on what the "9.8" actually means? Is this "an obscure feature nobody has on could with a bit of luck and a cosmic ray strike allow arbitrary code execution if you're one of the few people using it" or is this "if you have a socket with OpenSSL exposed to the internet you're already compromised" or what?
    • fulafel 32 minutes ago
      This was possibly a rhetorical question but apparently it goes something like this - just a simple formula someone came up with that tries to model badness:

        # Hardcoded weights for AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
        attack_vector = 0.85        # Network
        attack_complexity = 0.77    # Low
        privileges_required = 0.85  # None
        user_interaction = 0.85     # None
       
        confidentiality = 0.56      # High
        integrity = 0.56            # High
        availability = 0.56         # High
      
        impact_sub_score = 1 - (1 - confidentiality) \* (1 - integrity) \* (1 -  availability)  # -> 0.91 
        impact = 6.42 \* impact_sub_score                                                       # -> 5.87
      
        exploitability = (
          8.22 \* attack_vector \* attack_complexity \* privileges_required \* user_interaction)  # -> 3.88
      
        score = impact + exploitability                      # -> 9.76
      
      (using Github's values from https://github.com/advisories/GHSA-83xj-7xh4-4p7x)

      Interesting that the impact calculation treats C, I, A as equal. And of course a lot of those inputs are just human(?) supplied vibes and/or context dependent in your use case.

    • pixl97 3 hours ago
      So this might be very similar to Java4shell, though will need to be verified.

      This is another base64 encoder where it takes a blob and coverts it to base64. I'm assuming an attacker control bit of data could be passed to the function which then overflows. Not sure if it can attempt to control a valid address or not, but unlocked AI likely could pretty quick.

  • shepherdjerred 2 hours ago
    It feels to me the only way to beat LLMs finding vulnerabilities is to have LLMs (or LLMs paired with other AI methods) constantly monitor your infrastructure, traffic, database, etc. to ensure that nothing out of the ordinary is happening
    • tptacek 2 hours ago
      I think so too; I think apart from pushing vulnerability research forward (which is important on its own merits just for computer science reasons), the major engineering challenge of this moment is figuring out how to make platforms resilient without rewriting everything; that could be better live-patching, it could be some weird monitoring thing, it could be automatic segregation and workload isolation.

      It's not "just keep up with the patches". That's going to be a losing strat.

    • fauchletenerum 52 minutes ago
      I'm not sure how cost effective or even viable that option would be. I think the only practical defense is some kind of baseline hardening at the OS or application level. Something like eBPF rules i.e. what Cilium Tetragon policies provide. Basically it seems like there's no way to guarantee that your application code can't be exploited in some novel way so your best option is to restrict them as much as possible.
  • sippingabonedry 3 hours ago
    I see the OpenBSD guys are all over the PR (deservedly) shitting all over the proposed fixes so I assume LibreSSL may be impacted? Or are they just providing free advice and color commentary?
    • collinfunk 3 hours ago
      I'm not really involved in OpenSSL, aside from a few tiny changes and commenting on a few things that affected GNU coreutils. However, I have seen Bob, whom I assume you are referring to based on the profile picture, participate in many discussions. I wouldn't infer too much from it.
      • bentley 1 hour ago
        Bob is a member of the Engineering & Standards team at the OpenSSL Corporation.

        https://openssl-corporation.org/leadership.html

      • sippingabonedry 3 hours ago
        Do the projects collaborate closely since the split? My history is admittedly fuzzy.

        Sometimes the fix can be worse than the bug. Like patching a hole in the wall.

        • wahern 1 hour ago
          Yes, they collaborate. BoringSSL and libressl especially, which IIRC share some of the same developers. But OpenSSL has it's own priorities and vision, which sometimes (often?) clashes with the sensibilities of the BoringSSL and libressl developers. Because OpenSSL is still the de facto standard bearer and developer target, it can get frustrating for the libressl and BoringSSL developers, especially when they zig and OpenSSL decides to zag.
    • bvttf 2 hours ago
      I think the second, LibreSSL was forked before OpenSSL v3 and this only impacts OpenSSLv4.
  • m00dy 3 hours ago
    >>I am really worried about the negative return value being added. Existing third party callers might not be ready to handle this correctly (i.e. if they cast the return to size_t without checking). Could we instead return 0? (In all the added error returns in this PR.)

    Rust fixes it.

    • sippingabonedry 2 hours ago
      Be sure to let us know when your equivalent Rust crypto library is available.
      • m00dy 2 hours ago
        we don't need many crypto libraries, maybe just one for the whole world, written in Rust and then all functions are math-proofed.
        • _ache_ 5 minutes ago
          It's not just "math-proofed". You need a lot more to be a crypto library.

          Like time-constant, and it's hard to be time-constant in a performance optimised language like Rust. LLVM is doing some magic, and you don't want any magic in a crypto library.

        • td521534f12 2 hours ago
          You'd probably need a second one for FIPS.
        • staplehorse6553 33 minutes ago
          Does the alpha-stage WIP code you call 'Rust' compile for 32-bit yet? No? Ok.
      • cyberax 2 hours ago
  • yoy0721 2 hours ago
    [flagged]