CVE-2026-63632: ONNX: Heap-Buffer-Overflow READ in Gemm Version Converter Adapter via Undersized Input Shape
Summary
Heap-buffer-overflow READ (16 bytes) in Gemm76::adaptgemm76() (onnx/versionconverter/adapters/gemm76.h:41) when ConvertVersion() processes a model with a Gemm node whose input tensors have fewer than 2 dimensions. The adapter accesses Bshape[1] without checking rank. On Release builds the OOB read is silent; ASan confirms 16-byte read past a 48-byte allocation.
Details
The Gemm 7→6 downgrade adapter reads input shapes without bounds checking: cpp // gemm76.h:26-42 const auto& Ashape = inputs[0]->sizes(); // May have < 2 elements const auto& Bshape = inputs[1]->sizes(); // May have < 2 elements
if (node->hasAttribute(ktransB) && node->i(ktransB) == 1) { MN.emplaceback(Bshape[0]); // OOB if B has 0 dims } else { MN.emplaceback(Bshape[1]); // OOB if B has < 2 dims ← CRASH }
The PoC has input B with shape [28] (1 dimension). Bshape has 1 element. Accessing Bshape[1] reads 16 bytes past the std::vector<Dimension> internal storage into adjacent heap memory.
The same unchecked pattern applies to Ashape[0] and Ashape[1] at lines 34 and 36.
Entry point: onnx.versionconverter.convertversion(model, 6) — different from the InferShapes bugs reported in separate advisories. This triggers during opset downgrade (7→6).
PoC python import base64 import onnx from onnx import versionconverter
pocb64 = "CAM6rwEKUQoBQQoBQgoBQRIBWSIER2VtbSoPCgVhbHBoYRUBAQA+oAEBKg4KBGJldGEVAAAAOqABASoNCgZ0dGZsc0EYAaABAioNCgZ0cmFuc0IYAKABAhIKb2Vpdl94bWZ2aFoTCgFBEg4KDAgBEggKAggCCgIIA1oTCgFCEg4KDAgBEggKAggcCgIIBFoPCgFCEgoKCAgBEgQKAggbYhMKAVkSDgoMCAESCAoCCAIKAggEQgQKABAH"
model = onnx.loadfromstring(base64.b64decode(pocb64))
Triggers heap-buffer-overflow in Gemm76 adapter versionconverter.convertversion(model, 6)
186-byte PoC. ASan confirms: heap-buffer-overflow READ of size 16 at gemm76.h:41, 0 bytes after 48-byte region allocated in tensorShapeProtoToDimensions at irpbconverter.cc:216.
Impact
Any application that uses onnx.versionconverter.convertversion() on untrusted models is vulnerable. This includes model conversion pipelines and tools that auto-downgrade opset versions for compatibility. On Release builds the OOB read is silent — the read value propagates into the converted model's output shape, potentially leaking heap data. On ASan builds it's detected as a heap-buffer-overflow. Could also cause crashes with different heap layouts.
Other sources
Open Neural Network Exchange (ONNX) is an open standard for machine learning interoperability. From 1.3.0 until 1.22.0, onnx.versionconverter.convertversion() can perform an out-of-bounds read in Gemm76::adaptgemm76() in onnx/versionconverter/adapters/gemm76.h when a Gemm node has input tensors with fewer than two dimensions because Bshape[1], Ashape[0], or Ashape[1] is accessed without a rank check, potentially causing a process crash during an opset 7 to 6 downgrade. This issue is fixed in version 1.22.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/onnxto a version that resolves this vulnerability.Fixed in 1.22.0 - Upgrade
Upgrade
onnx.version_converter.convert_versionto a version that resolves this vulnerability.Fixed in 1.22.0 - Compensating control
Do not run onnx.version_converter.convert_version() (opset 7→6 downgrade) on untrusted ONNX models; only process models from trusted sources to reduce exposure to out-of-bounds reads during Gemm_7_6::adapt_gemm_7_6() when input tensor rank is < 2.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-63632?
CVE-2026-63632 has a severity rating of low at 3.3.
What type of vulnerability is CVE-2026-63632?
CVE-2026-63632 is identified as a heap-buffer-overflow vulnerability.
How do I fix CVE-2026-63632?
To fix CVE-2026-63632, ensure that input tensors have at least 2 dimensions before accessing B_shape[1].
Which software is affected by CVE-2026-63632?
CVE-2026-63632 affects the pip package 'onnx'.
What components are involved in CVE-2026-63632?
CVE-2026-63632 involves the Gemm adapter in the version converter of the ONNX library.