Email me

Rust advisories / tract-nnef

Vulnerability MediumRUSTSEC-2026-0217 · tract-nnef

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

Short answerA security vulnerability in the tract-nnef crate: Integer overflow in tract-nnef NNEF tensor parser leads to out-of-bounds read on model load. Medium severity (CVSS 6.1). Fixed in 0.21.16, 0.22.2, 0.23.1: update to a fixed version.

Cratetract-nnef
TypeVulnerability (memory-exposure, denial-of-service)
Affected versionsBefore 0.21.16; from 0.22.0 before 0.22.2; from 0.23.0 before 0.23.1.
Fixed in0.21.16, 0.22.2, 0.23.1
SeverityMedium, CVSS 6.1
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H
Published2026-06-18
Last changed2026-10-12
Also known asCVE-2026-55093, GHSA-x5mv-8wgw-29hg
Affected functionstract_nnef::tensors::read_tensor

What to do

  1. See which version you have: cargo tree -i tract-nnef (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p tract-nnef. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example tract-nnef = "0.23.1") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

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-size guard; the dense DatLoader path was missed.

Mitigation

Upgrade to 0.21.16, 0.22.2, or 0.23.1. The fix computes the shape product and byte size with checked_mul and rejects the tensor on overflow (commit 34c7df2).

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ