llamaCVEVulnerability Intelligence
/
Advisory · GitHub · crates.io · tract-nnef

GHSA-6FFW-F7M6-GPXJ

Unbounded allocation in tract-nnef NNEF tensor parser allows denial of service on untrusted model load (CWE-770)

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS 3.1
5.5
Media
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche3 versionesPrimer parche a -32 d de la divulgación
Exposición43 dDesde la divulgación, 9 oct 2026, 3:51 a. m.
Detección42 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Riesgo con buenos modales, atiéndela con calma.Sin drama: ventana de mantenimiento y listo.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 0.21.18 +1
Parche 0.23.7
Monitoreo
Detectada +1
7 sept 26
8 sept 26
9 oct 26
20 nov 26
21 nov 26
7 sept 26
26 sept 26
15 oct 26
3 nov 26
21 nov 26
FechaFaseEventoDetalle
Remediación Parche 0.21.18 tract-nnef · -32 d desde divulgación
Remediación Parche 0.22.4 tract-nnef · -32 d desde divulgación
Remediación Parche 0.23.7 tract-nnef · -31 d desde divulgación
Divulgación Publicada GHSA-6FFW-F7M6-GPXJ divulgada · CVSS 5.5 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

`tract_nnef::tensors::read_tensor` parses NNEF tensor data. For tensors of
`DatumType::String`, it reads a 32-bit length prefix `len: u32` directly from
the (untrusted) NNEF file and then allocates that many bytes **before reading
any of them**:

// nnef/src/tensors.rs — read_tensor, String branch (before fix)
let len: u32 = reader.read_u32::<LE>()?;
let mut bytes = Vec::with_capacity(len as usize);
#[allow(clippy::uninit_vec)]
unsafe {
    bytes.set_len(len as usize);
};
reader.read_exact(&mut bytes)?;      // <- only now are bytes actually read
*item = String::from_utf8(bytes)?;

Because the allocation is driven entirely by an attacker-controlled field and
happens *before* any data is consumed, a crafted NNEF file can declare a
multi-gigabyte string length (up to 4 GiB, the `u32` range) while supplying
only a handful of bytes. The parser performs the huge allocation first and only
then fails in `read_exact`.

Impact. Memory exhaustion / process abort (denial of service) whenever a
`tract-nnef` user loads an NNEF model from an untrusted source — for example a
model downloaded from a public model hub, received from a third party, or
supplied by an end user of a hosted service. In a service that accepts
user-supplied models, a single small request can exhaust host memory.

Measured. With a counting global allocator and a 3-byte crafted payload
declaring a 128 MiB string length:

| | max single allocation |
|---|---|
| vulnerable (`set_len` pre-allocation) | 134,217,728 bytes (128 MiB) |
| patched (bounded read + length check) | 102 bytes |

That is roughly a 4x10^7 amplification from a 3-byte input.

Fix. Read at most `len` bytes, growing the buffer from what actually
arrives, then verify the real length matches the declaration:

let mut bytes = Vec::new();
(&mut reader).take(len as u64).read_to_end(&mut bytes)?;
if bytes.len() != len as usize {
    bail!("NNEF string item declared {len} bytes but only {} readable", bytes.len());
}

As a side effect this also removes the `unsafe { set_len(..) }` block
(`clippy::uninit_vec`), eliminating the uninitialized-buffer pattern entirely.
No public API is changed.

Affected / patched. Introduced in `0.12.2` (2021-01-05); present through
`0.23.6`, including the latest releases on all three maintained lines
(`0.21.17`, `0.22.3`, `0.23.6`). Fixed on `main` by PR #2766; **not yet
released** — the fix will ship in the next release on each line.

Relation to RUSTSEC-2026-0217 / CVE-2026-55093. That advisory covers an
integer overflow in the shape/dimension handling of the same function, fixed in
0.23.1. This is a different weakness class (CWE-770 unbounded allocation in the
`String` branch) and is still reproducible on 0.23.6, so it is not covered by
that advisory.

Credits. Reported by Li Jinquan (github.com/li-jin-quan). Fixed by PR
#2766, merged 2026-09-03; backport and releases handled by the maintainer.

Severity note. Suggested `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H`
(6.5 Medium), consistent with the AV:L / UI:R treatment of RUSTSEC-2026-0217.
A service that accepts user-supplied models would be AV:N / UI:N (7.5 High).

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:L
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:R
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
6.4/ 10Medio
Vector 6.4 (fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
tract-nnef≥ 0.12.2 < 0.21.18
tract-nnef≥ 0.22.0 < 0.22.4
tract-nnef≥ 0.23.0 < 0.23.7
0.12.2
0.21.18
0.22.0
0.22.4
0.23.0
0.23.7
0.23.10
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
crates.iotract-nnef
Corregida 0.21.18, 0.22.4, 0.23.7 -32 d · -32 d · -31 d 0.23.10 no afectada
Versiones corregidas0.21.180.22.40.23.7
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/sonos/tract/security/advisories/GHSA-6ffw-f7m6-gpxj

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.