[NSF] [CVE-2026-121481] Buffer overflow in EVP_EncodeBlock() by nmouha · Pull Request #33652 · openssl/openssl


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.

@nmouha

nhorman

jogme

t8m

bob-beck

bob-beck

@nmouha

@nmouha

This fixes the buffer overflow in `EVP_EncodeBlock()` (CVE-2026-121481)
by calling `OPENSSL_assert()` for inputs that lead to undefined
behavior. The same fix is applied to `EVP_DecodeBlock()`, and the
incorrect length check in `base64encode()` of `http_client.c`
is fixed. Also updates the documentation and adds new tests to document
the existing behavior for zero-length inputs.
…ncodeBlock()

This fixes the buffer overflow in `EVP_EncodeBlock()` (CVE-2026-121481)
by calling `OPENSSL_assert()` for inputs that lead to undefined
behavior. The same fix is applied to `EVP_DecodeBlock()`, and the
incorrect length check in `base64encode()` of `http_client.c`
is fixed. Also updates the documentation and adds new tests to document
the existing behavior for zero-length inputs.

@nmouha

andrewkdinh

daedalus pushed a commit to daedalus/fuzzer that referenced this pull request

Nov 20, 2026
OpenSSL 4.x AVX2 encoder (openssl/openssl#33652 area) vs scalar via the
public API, toggling OPENSSL_ia32cap_P[2] bit 5; decode round trip as
second oracle. Mismatch raises SIGABRT (shim swallows abort()).

Vendor default 4.1.0, stale-tree guard, version in build stamp, asm
libcrypto variant, apps/include workaround for 4.1.0 Configure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XPHAxcmCVco7xEZjip8Axk

@jogme

atomchild411 added a commit to atomchild411/pkgsrc that referenced this pull request

Nov 20, 2026
Backport of the guards in openssl/openssl#33652
(head ad8169a9bb, not merged yet; advisory pending) to 3.6.5:

- EVP_EncodeBlock(): stop on a negative length or one whose base64
  encoding does not fit in an int (dlen > (INT_MAX / 4) * 3), where the
  output length overflowed; an empty input writes only the NUL.
- EVP_DecodeBlock(): 0 for an empty input, -1 for a negative length.
- http_client.c base64encode(): reject lengths whose encoding would not
  fit in an int, not only len > INT_MAX (reachable through a long
  s_client -proxy_pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

jogme

mattcaswell

…n EVP_EncodeBlock()

This fixes the buffer overflow in `EVP_EncodeBlock()` (CVE-2026-121481)
by returning 0 and raising `ERR_R_PASSED_INVALID_ARGUMENT` for inputs
that lead to undefined behavior. Also fixes `EVP_DecodeBlock()` and the
incorrect length check in `base64encode()` of `http_client.c`. Updates
the documentation and adds new tests to document the existing behavior
for zero-length inputs.

@nmouha

bob-beck

bob-beck

…rflow in EVP_EncodeBlock()

This fixes the buffer overflow in `EVP_EncodeBlock()` (CVE-2026-121481)
by returning 0 and raising `ERR_R_PASSED_INVALID_ARGUMENT` for inputs
that lead to undefined behavior. Also fixes `EVP_DecodeBlock()` and the
incorrect length check in `base64encode()` of `http_client.c`. Updates
the documentation and adds new tests to document the existing behavior
for zero-length inputs.