OpenSSL: Buffer overflow in EVP_EncodeBlock() (CVE-2026-121481, CVSS 9.8) github...
HN Best 30 @best30
OpenSSL: Buffer overflow in EVP_EncodeBlock() (CVE-2026-121481, CVSS 9.8) github.com · 290 points · 226 comments · HN thread
TL;DR A GitHub pull request in the OpenSSL repository fixes a buffer overflow in EVP_EncodeBlock() tracked as CVE-2026-121481, rated CVSS 9.8. The function overflows when input is so large that the base64 output length exceeds what fits in an int (roughly 1.5 GB on 32-bit int systems). The PR replaces undefined behavior with OPENSSL_assert() checks instead of new error returns, and also fixes a length check in an http_client.c base64 helper.
- EVP_EncodeBlock() writes past the output buffer when the input length is large enough that the base64 output length overflows a signed int, roughly inputs above about 1.5 GB.
- The PR adds OPENSSL_assert() checks for inputs that previously caused undefined behavior, rather than returning -1 or 0 on error, to avoid breaking existing third-party callers that ignore return values.
- The same guard is applied to EVP_DecodeBlock(), and the incorrect length check in base64encode() in http_client.c is corrected.
- The PR also updates the documentation and adds tests that pin down the existing behavior for zero-length inputs.
- Commenters note the vulnerable code only exists in OpenSSL 4.x, and the reviewer noted the function dates back to the first commit in 1998 with the bug in the 4.x line.
Discussion The thread is dominated by criticism of the C base64 API, with many commenters arguing that requiring callers to compute output buffer sizes invites exactly this kind of bug, and that OpenSSL's code quality is poor. A second strand disputes the 9.8 CVSS score, with several arguing the bug is only reachable when untrusted input of very large size reaches the function, and others arguing CVSS scores are generally meaningless. Some comments discuss the PR review itself, the choice between error returns and assertions, and whether the bug came from recently added LLM-assisted code. Mood is frustrated and sardonic, with a lot of fatigue about constant vulnerability patching, and mixed comments about Rust, LibreSSL, BoringSSL and alternatives.
- The C base64 API design is the root cause (many): Many commenters say the requirement that callers compute output buffer size, plus the NUL terminator and padding rules, makes misuse easy. They argue the API should take the output length or provide a helper for sizing.
- CVSS 9.8 is exaggerated for this bug (many): Several commenters say the bug only matters if untrusted input of gigabyte scale reaches the function, and that most callers with fixed-size protocol fields are unaffected. They argue the score misleads sysadmins.
- CVSS as a whole is not useful (some): A few commenters argue CVSS scores are essentially arbitrary and lack context about threat models, and call for a better, less malleable severity system.
- OpenSSL is low quality and should be avoided (some): Some commenters cite long-standing code quality and API complaints, pointing to the Heartbleed-era forks LibreSSL and BoringSSL as alternatives, though others note those forks have their own limits.
- Rust or memory-safe languages would prevent this (some): Several argue a memory-safe implementation would avoid this class of bug, while others counter that crypto libraries also need constant-time guarantees and that C-based libraries underlie many Rust crypto backends.
- Impact is limited because enterprise distros do not ship OpenSSL 4 yet (a few): A few commenters point out that OpenSSL 4 is mainly in bleeding-edge distributions like Arch and Fedora, so most enterprise systems are not affected yet.
Links from the comments
- Satirical series on memory-safety bugs in C, cited in response to the 'no way to prevent this' argument.
- Rusty Russell's 'How Do I Make This Hard to Misuse?' essay on API design.
- GitHub advisory whose CVSS values a commenter used to explain how the 9.8 score is computed.
- HAProxy article critiquing the state of OpenSSL's design and maintenance.
- A plain-language assessment of the CVE linked by a commenter.
#OpenSSL #CVE #bufferOverflow #cryptography #cSecurity #apiDesign