The Size That Wraps to One Byte

Site Admin · 3 Dec 2026 · Core Internet Infrastructure

CVE-2026-7383 in full: nchar << 2 wraps at 2^30, malloc(1), four gigabytes of write — Low severity, no protocol path, and a correction to the corpus.

A signed left shift, a character count near 2^30, and a one-byte allocation.
CVE-2026-7383 is a textbook size-calculation overflow — and a case study in
why severity is about reachability, not about how bad the crash sounds.

The advisory, in its own words

Issue summary: A signed integer overflow when sizing the destination buffer
for Unicode output in ASN1_mbstring_ncopy() can lead to a heap buffer
overflow.

Impact summary: A heap buffer overflow may lead to a crash or possibly
attacker controlled code execution or other undefined behaviour.

OpenSSL rated it Low and assigned CWE-787 (out-of-bounds write). NVD's
own base score is not provided; CISA-ADP carries a CVSS 3.1 vector of
AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H for 8.1. The gap is about who can
reach the function.

The arithmetic

ASN1_mbstring_ncopy() converts an input string in one ASN.1 encoding into
the smallest permitted output type. For BMPString and UniversalString it
computes the output size with a shift on the character count:

nchar  = len >> 1;   /* BMPString: UTF-16, 2 bytes per unit  */
outlen = nchar << 1;

nchar  = len >> 2;   /* UniversalString: UTF-32, 4 bytes per char */
outlen = nchar << 2;

nchar and outlen are int. When nchar reaches 0x40000000, nchar << 2
is not representable in a signed 32-bit integer. On the compiler and platform
in question the shift wraps to zero. The code then calls
OPENSSL_malloc(outlen + 1) — a one-byte allocation — and a second
traversal writes 4 * nchar bytes into it. That is four gigabytes past the
allocation.

The UTF-8 path has the same defect: out_utf8() sums one to four bytes per
code point into an int, and the sum overflows once the output exceeds
INT_MAX.

What the advisory says about reachability

OpenSSL is unusually explicit:

X.509 certificate processing routes through ASN1_STRING_set_by_NID(),
whose DIRSTRING_TYPE mask excludes UNIVERSALSTRING and whose per-NID size
limits cap the input length; no network protocol or certificate-handling
path in OpenSSL exercises the overflow.

Triggering it requires an application that calls ASN1_mbstring_copy() or
ASN1_mbstring_ncopy() directly, or registers a custom string type via
ASN1_STRING_TABLE_add(), with attacker-controlled input on the order of
half a gigabyte or more. That is why the project assigned Low. FIPS modules
are unaffected: the code is outside the validated boundary.

The correction to the corpus

The corpus carries two claims the primary record does not support.

First, the fixed versions and the date. The corpus says "fixed in OpenSSL
3.5.6 and 4.0.0 (February 2026)". In fact 3.5.6 (7 April 2026) and 4.0.0
(14 April 2026) are the last vulnerable releases. The fix shipped on
9 June 2026 in 3.5.7 and 4.0.1, with 3.6.3, 3.4.6 and 3.0.21 on the
same day. February 2026 is when the issue was reported (27 February, by
Zehua Qiao and Jinwen He), not when it was fixed.

Second, the reachability inference. The corpus reasoned that certificate
parsing is pre-authentication and CMS blobs could carry a large enough string.
The vendor's analysis says the opposite: the certificate path's string mask
and per-NID limits exclude the overflow, and no protocol path in OpenSSL
exercises it.

The fix

The upstream commit is d32350ae8ef7426718f5aa9e383d4b51398ee254 on the 4.0
branch, cherry-picked to the other supported lines. It is titled "Reject
oversized inputs in ASN1_mbstring_ncopy()", written by Viktor Dukhovni on
29 April 2026, merged 8 June. It adds three range checks:

It also fixes the UTF-8 error path. Twenty-eight insertions, three deletions,
one file.

Why it is the fundamental flaw

CVE-2026-7383 is not OpenSSL's most severe 2026 bug. It is the most
representative: a size in a signed int, a worst-case expansion assumed not
to overflow, a caller contract that pushes the input bound outside the
library. Reasonable assumptions, wrong in combination.

Next: Part 8 — the upgrade that was not the fix: why 3.5.6 and 4.0.0 were
current and vulnerable, and what the version sprawl looks like.