10 comments

  • amluto 1 hour 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 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.

    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.

    • teunispeters 13 minutes 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.
    • vlovich123 47 minutes 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 41 minutes ago
        For those too young to remember 2014, Heartbleed led to both BoringSSL and LibreSSL being forked from OpenSSL.
    • userbinator 43 minutes 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.

      • mrheosuper 23 minutes 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.

    • kvuj 53 minutes 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.

      • td521534f12 15 minutes 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 49 minutes 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 7 minutes 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.

        • kvuj 45 minutes 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.

    • landr0id 36 minutes 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...

  • userbinator 28 minutes 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 26 minutes 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.

  • VladVladikoff 1 hour ago
    :/ I really need a day off from patching servers.
    • pixl97 1 hour 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.

  • shepherdjerred 26 minutes 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 24 minutes 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.

  • asveikau 1 hour 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.

    • daemonologist 1 hour 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 1 hour 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?
    • pixl97 1 hour 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.

  • sippingabonedry 37 minutes 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 33 minutes 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.
      • sippingabonedry 30 minutes 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.

    • bvttf 20 minutes ago
      I think the second, LibreSSL was forked before OpenSSL v3 and this only impacts OpenSSLv4.
  • m00dy 1 hour 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 20 minutes ago
      Be sure to let us know when your equivalent Rust crypto library is available.
      • m00dy 17 minutes 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.
        • td521534f12 13 minutes ago
          You'd probably need a second one for FIPS.
  • yoy0721 21 minutes ago
    [flagged]