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.
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).
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
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.
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?
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?
>>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.
[flagged]
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.