Description
Issue summary: Calling EVP_EncodeBlock() with an input length close to INT_MAX
may overflow the calculation of the encoded output size and write past the end
of the caller-supplied output buffer.
Impact summary: No path by which an attacker can trigger this has been
identified. An application that passes an input length near INT_MAX to
EVP_EncodeBlock() could suffer a heap buffer overflow, crashing or corrupting
its own memory, but it must itself supply such a length.
CWE: CWE-190: Integer Overflow or Wraparound
Description: EVP_EncodeBlock() base64-encodes a buffer of a caller-supplied
length into an output buffer that the caller allocates. The caller is expected
to reserve 4*((len+2)/3)+1 bytes. For input lengths close to INT_MAX, the
arithmetic that computes the encoded length overflows a signed integer, so the
function writes more data than the documented output size. The result is a
heap buffer overflow in the calling process.
Reaching this requires an application to pass an input length near INT_MAX to
EVP_EncodeBlock(). OpenSSL's TLS, QUIC and CMS implementations never encode
buffers of that size, and the command line tools cannot practically be made to
do so: the limits on reading a proxy password from a file and on bignum sizes
prevent it. An application that accepts an attacker-controlled length and
forwards it to EVP_EncodeBlock() without its own bound check is exposed.
The severity is Low because no attacker-controlled path to the overflow is
known. The caller must already hold a buffer of about two gigabytes before the
defect can be reached.
FIPS impact: no
The affected code is outside the FIPS module boundary.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| OpenSSL | OpenSSL | 4.1.0 – < 4.1.1, 4.0.0 – < 4.0.4 | 4.1.1 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | edk2 +2 | No fix yet | — |
| Ubuntu 26.04 LTS | edk2 +2 | No fix yet | — |
| Ubuntu 24.04 LTS | edk2 +1 | No fix yet | — |
| Ubuntu 22.04 LTS | edk2 +1 | No fix yet | — |
Show 14 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro FIPS 20.04 LTS | openssl | No fix yet | — |
| Ubuntu Pro FIPS 18.04 LTS | openssl | No fix yet | — |
| Ubuntu Pro FIPS 16.04 LTS | openssl | No fix yet | — |
| Ubuntu Pro FIPS-updates 24.04 LTS | openssl-fips | No fix yet | — |
| Ubuntu Pro FIPS-updates 22.04 LTS | openssl +1 | No fix yet | — |
| Ubuntu Pro FIPS-updates 20.04 LTS | openssl | No fix yet | — |
| Ubuntu Pro FIPS-updates 18.04 LTS | openssl | No fix yet | — |
| Ubuntu Pro FIPS-updates 16.04 LTS | openssl | No fix yet | — |
| Ubuntu Pro FIPS-preview 22.04 LTS | openssl +1 | No fix yet | — |
| Ubuntu Pro 22.04 LTS | nodejs | No fix yet | — |
| Ubuntu Pro 20.04 LTS | edk2 +1 | No fix yet | — |
| Ubuntu Pro 18.04 LTS | edk2 +3 | No fix yet | — |
| Ubuntu Pro 16.04 LTS | edk2 +2 | No fix yet | — |
| Ubuntu Pro 14.04 LTS | openssl | No fix yet | — |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | openssl-4.0-libssl +1 | No fix yet | — |
References
- Fix PR #33652 patch