Skip to content
Heist/ feed
Back to feed
MediumFix available

Integer overflow in tract-nnef NNEF tensor parser leads to out-of-bounds read on model load

Type: advisorySources: OSV

`tract_nnef::tensors::read_tensor` builds a tensor shape from attacker-controlled 32-bit dimensions and computes both the element count `product(shape)` and the byte allocation `product(shape) * size_of(dt)` with **unchecked `usize` arithmetic**. In release builds (no `overflow-checks`) both products wrap modulo 2^64. A crafted NNEF `.dat` tensor can choose dimensions whose wrapped products collapse to a small value that satisfies the header size-consistency check, while the true element count stays astronomically large. `read_tensor` then returns a `Tensor` whose reported `len` (e.g. `2^61 + 7`) far exceeds its backing heap allocation (e.g. 56 bytes). The unchecked accessor `as_slice_unchecked` (`slice::from_raw_parts(ptr, self.len())`) subsequently yields a slice spanning ~18 EiB over the small buffer. The out-of-bounds read fires automatically during model build (no inference required), reachable through the default `DatLoader` resource loader via the public `tract_nnef::nnef().model_for_path` / `model_for_read` API when the const-folding `as_uniform` fast-path materializes the over-long constant. The always-on primitive is a bounded adjacent-heap over-read (information disclosure); access further past the mapped region SIGSEGVs (denial of service). No out-of-bounds write or code execution was demonstrated. Affected: every release line prior to the backported fixes — `< 0.21.16`, `0.22.0`–`0.22.1`, and `0.23.0`. The block-quant path had already received an analogous blob-s

Products
tract-nnef
Affected versions
Not specified
Fixed versions
0.21.16, 0.22.2, 0.23.1
CVEs
CVE-2026-55093
Confirmed fixed CVEs
Not specified
Updated in this feed
30 Oct 2026, 08:44 UTC · Revision 1

Source evidence

Integer overflow in tract-nnef NNEF tensor parser leads to out-of-bounds read on model load

core-osv · Original source

Published 18 Jun 2026, 12:00 UTC

`tract_nnef::tensors::read_tensor` builds a tensor shape from attacker-controlled 32-bit dimensions and computes both the element count `product(shape)` and the byte allocation `product(shape) * size_of(dt)` with **unchecked `usize` arithmetic**. In release builds (no `overflow-checks`) both products wrap modulo 2^64. A crafted NNEF `.dat` tensor can choose dimensions whose wrapped products collapse to a small value that satisfies the header size-consistency check, while the true element count stays astronomically large. `read_tensor` then returns a `Tensor` whose reported `len` (e.g. `2^61 + 7`) far exceeds its backing heap allocation (e.g. 56 bytes). The unchecked accessor `as_slice_unchecked` (`slice::from_raw_parts(ptr, self.len())`) subsequently yields a slice spanning ~18 EiB over the small buffer. The out-of-bounds read fires automatically during model build (no inference required), reachable through the default `DatLoader` resource loader via the public `tract_nnef::nnef().model_for_path` / `model_for_read` API when the const-folding `as_uniform` fast-path materializes the over-long constant. The always-on primitive is a bounded adjacent-heap over-read (information disclosure); access further past the mapped region SIGSEGVs (denial of service). No out-of-bounds write or code execution was demonstrated. Affected: every release line prior to the backported fixes — `< 0.21.16`, `0.22.0`–`0.22.1`, and `0.23.0`. The block-quant path had already received an analogous blob-s

osv:RUSTSEC-2026-0217

tract-nnef

Fixed versions: 0.21.16, 0.22.2, 0.23.1

Complete source record
{
  "id": "ea2fb911a607843512f07a59b6e15682715e858b22806bd3777954d77d036574",
  "url": "https://osv.dev/vulnerability/RUSTSEC-2026-0217",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Integer overflow in tract-nnef NNEF tensor parser leads to out-of-bounds read on model load",
    "summary": "`tract_nnef::tensors::read_tensor` builds a tensor shape from attacker-controlled 32-bit dimensions and computes both the element count `product(shape)` and the byte allocation `product(shape) * size_of(dt)` with **unchecked `usize` arithmetic**. In release builds (no `overflow-checks`) both products wrap modulo 2^64. A crafted NNEF `.dat` tensor can choose dimensions whose wrapped products collapse to a small value that satisfies the header size-consistency check, while the true element count stays astronomically large. `read_tensor` then returns a `Tensor` whose reported `len` (e.g. `2^61 + 7`) far exceeds its backing heap allocation (e.g. 56 bytes). The unchecked accessor `as_slice_unchecked` (`slice::from_raw_parts(ptr, self.len())`) subsequently yields a slice spanning ~18 EiB over the small buffer. The out-of-bounds read fires automatically during model build (no inference required), reachable through the default `DatLoader` resource loader via the public `tract_nnef::nnef().model_for_path` / `model_for_read` API when the const-folding `as_uniform` fast-path materializes the over-long constant. The always-on primitive is a bounded adjacent-heap over-read (information disclosure); access further past the mapped region SIGSEGVs (denial of service). No out-of-bounds write or code execution was demonstrated. Affected: every release line prior to the backported fixes — `< 0.21.16`, `0.22.0`–`0.22.1`, and `0.23.0`. The block-quant path had already received an analogous blob-s",
    "evidence": "osv:RUSTSEC-2026-0217",
    "products": [
      {
        "name": {
          "value": "tract-nnef",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "0.21.16",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "0.22.2",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "0.23.1",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "RUSTSEC-2026-0217",
      "aliases": [
        "CVE-2026-55093",
        "GHSA-x5mv-8wgw-29hg",
        "RUSTSEC-2026-0217"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0.0.0-0"
                },
                {
                  "fixed": "0.21.16"
                },
                {
                  "introduced": "0.22.0"
                },
                {
                  "fixed": "0.22.2"
                },
                {
                  "introduced": "0.23.0"
                },
                {
                  "fixed": "0.23.1"
                }
              ]
            }
          ],
          "package": {
            "name": "tract-nnef",
            "purl": "pkg:cargo/tract-nnef",
            "ecosystem": "crates.io"
          },
          "database_specific": {
            "cvss": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H",
            "source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0217.json",
            "categories": [
              "memory-exposure",
              "denial-of-service"
            ],
            "informational": null
          },
          "ecosystem_specific": {
            "affects": {
              "os": [],
              "arch": [],
              "functions": [
                "tract_nnef::tensors::read_tensor"
              ]
            },
            "affected_functions": null
          }
        }
      ],
      "modified": "2026-10-12T18:00:14.308668573Z",
      "provider": "osv",
      "references": [
        "https://crates.io/crates/tract-nnef",
        "https://rustsec.org/advisories/RUSTSEC-2026-0217.html",
        "https://github.com/sonos/tract/commit/34c7df2c9bd2a36583e09b52f3e6319bf23102e8"
      ],
      "provider_metadata": {
        "license": "CC0-1.0"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-55093",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 306458,
  "published_at": "2026-06-18T12:00:00+00:00"
}