Technology1 min read

OpenSSL: Buffer overflow in EVP_EncodeBlock() (CVE-2026-121481, CVSS 9.8)

By · Published by Everything Blog

In short

The proposed mitigation for the critical flaw alters `EVP_EncodeBlock()` to return `-1` on invalid inputs, preventing memory corruption during base64 processing. Beyond this core change, the patch implements equivalent guards for `EVP_DecodeBlock()`, corrects length checks in `http_client.c`, and expands testing. Project maintainers are actively debating error-handling mechanics to ensure downstream applications do not mishandle negative values through improper type casting.

Key points

  • Developers must track OpenSSL updates carefully as changes to cryptographic return types…: Developers must track OpenSSL updates carefully as changes to cryptographic return types could break external application code.
  • Resolving the high-severity flaw requires balancing strict overflow prevention with compa…: Resolving the high-severity flaw requires balancing strict overflow prevention with compatibility for callers casting errors to unsigned types.
  • The comprehensive patch expands test suites and updates official documentation alongside…: The comprehensive patch expands test suites and updates official documentation alongside fixes to base64 encoding and decoding routines.

Sources checked by our analysis pipeline: 1

Repository navigation

Conversation

This fixes the buffer overflow in `EVP_EncodeBlock()` (CVE-2026-121481) by returning `-1` for invalid inputs. It also provides a similar guard for `EVP_DecodeBlock()`, and fixes the incorrect length check in the `base64encode()` function of `http_client.c`. Also updates the documentation and adds new tests.

b632810

to

efc46cb

Compare

jogme

left a comment

There was a problem hiding this comment.

This patch changes functions so they can fail. Can you please also ensure the call sites check the return value of this function?

The problematic places I found:

PEM_SignFinal()

NETSCAPE_SPKI_b64_encode()

Unless these callers can plausibly trigger the error conditions, I am not sure it needs to be done as part of this PR. It should definitely be a separate commit. |

|

||

/* Ensure the base64 output length does not overflow. */ | ||

if (dlen > (INT_MAX / 4) * 3) | ||

return -1; |

There was a problem hiding this comment.

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…

Technology