Hacker news

  • Top
  • New
  • Past
  • Ask
  • Show
  • Jobs

OpenSSL: Buffer overflow in EVP_EncodeBlock() (CVE-2026-121481, CVSS 9.8) (https://github.com)

192 points by JacobHenner about 6 hours ago | 144 comments | View on ycombinator

amluto about 5 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.

userbinator about 4 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.

ansipunk about 2 hours 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.

moezd about 2 hours 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.

VladVladikoff about 6 hours ago |

:/ I really need a day off from patching servers.

Panzerschrek about 4 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).

asveikau about 5 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.

shepherdjerred about 4 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

jerf about 5 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?

undefined about 5 hours ago |

undefined

sippingabonedry about 5 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?

globular-toast about 1 hour ago |

So what's the timeline here? About a week ago (damn UIs that don't easily let you see the actual date) someone submitted a PR, but only two days ago the CVE was public. The PR is still not merged. Was the team let know in advance but ran out of time to patch or something?

m00dy about 5 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.

vasco about 1 hour ago |

If the first replies I got from maintainers were those I'd tell them to fuck off then and keep having a broken library. They are like stackoverflow curmudgeons and it's not surprising other libraries appeared - who would want to deal with this.

charlie2agent about 1 hour ago |

[flagged]

yoy0721 about 4 hours ago |

[flagged]