GHSA-7Q44-75HX-2X3H
Incomplete CVE-2026-55832 remediation: ONNX external_data follows symlinks outside the model directory
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 0.23.9 | tract-onnx · -1 d desde divulgación | |
| Divulgación | Publicada | GHSA-7Q44-75HX-2X3H divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Incomplete CVE-2026-55832 remediation: ONNX external data follows symlinks outside the model directory
Summary
The path check added for GHSA-h668-6x6g-f8r5 / CVE-2026-55832 is lexical. It rejects an absolute `external_data.location` and any `..` component, but it does not verify where the resulting path resolves on the filesystem. The default resolver subsequently calls `File::open`, which follows symlinks.
An attacker-supplied ONNX model bundle can therefore include a relative external-data path that names either:
- a symlink in an intermediate directory component;
- a final-component symlink with a relative target; or
- a final-component symlink with an absolute target.
All three cases read outside the model directory on tract 0.23.7. The selected bytes become a UINT8 initializer and are returned byte-for-byte through an Identity node's inference output.
The original `../...` path is rejected in the same run. This negative control establishes that the tested build contains the published fix and that the result is a post-fix filesystem-resolution bypass, not a reproduction against an unfixed release.
Relationship to the existing advisory
This report should preferably be handled as an incomplete remediation or post-fix variant of GHSA-h668-6x6g-f8r5 / CVE-2026-55832:
- the source is the same ONNX `external_data.location` field;
- the sink is the same default filesystem resolver;
- the impact is the same disclosure of process-readable file content through a model tensor; and
- the advisory's own suggested fix explicitly called for canonical containment and symlink rejection, neither of which is present in the shipped fix.
The precondition is stronger than the original path-string attack, so a separate identifier is also a defensible CNA choice. This report does not request or invent a new identifier; the maintainers can amend the existing advisory or assign a new one.
Affected versions tested or inspected
Runtime-confirmed:
- source tag v0.23.7, commit `c862487a17d7777bdd82d0f82db26948232bedba`;
- published crates.io packages `tract = 0.23.7` and `tract-onnx = 0.23.7`; and
- upstream main commit `4dec531d29688d15f27b4f15d39f33b1d35b0a7a`.
Source-inspected, not runtime-tested individually:
- v0.21.17 and v0.21.18;
- v0.22.3 and v0.22.4; and
- v0.23.2 through v0.23.6.
These releases contain the component filter but no canonical containment check, explicit symlink check, descriptor-relative secure open, or post-open identity verification. Please determine the final affected ranges across supported release lines.
Security impact
An application that accepts an untrusted ONNX model bundle and materializes attacker-authored symlinks can be made to read a process-readable file outside the intended model root. The model controls the target through the symlink plus the external-data location, and controls the selected byte range through `offset`, `length`, and tensor shape. The proof uses `offset=7` and `length=29` and returns the exact selected canary bytes in inference output.
This is a confidentiality impact only. No write, deletion, memory-unsafety, code-execution, or availability primitive is claimed.
Suggested severity: Medium, subject to the project's documented cap for hostile-model file access and with Attack Requirements present. No reporter-supplied CVSS score is asserted.
Relevant weaknesses: CWE-22 (path traversal / insufficient path restriction) and CWE-59 (improper link resolution before file access).
Preconditions and limitations
- A lone `.onnx` file cannot create the symlink. The attacker must supply a directory, repository, archive, or other multi-file bundle, and the application's delivery path must preserve the link.
- A controlled `bsdtar` create/extract round-trip was tested and preserved both relative symlinks, after which the facade-level read still succeeded. tract itself does not extract that archive; extractor policy belongs to the embedding application.
- Only macOS arm64 was runtime-tested. The behavior follows ordinary Unix symlink resolution, but Linux and Windows are not claimed as tested.
- The caller or another observable execution path must expose the affected tensor/output to the attacker for exfiltration.
- Blind reading of files with completely unknown size was not characterized. The demonstrated primitive reads an attacker-selected, known byte range from an attacker-selected process-readable target.
Reachable public entry point
The exploit path uses the supported Rust facade:
let runnable = tract::onnx()?
.load(&model_path)?
.into_model()?
.into_runnable()?;
let output = runnable.run(Vec::<tract::prelude::Tensor>::new())?;
let leaked = output[0].as_slice::<u8>()?;`tract_onnx` is used by the proof only to serialize a minimal protobuf fixture. Model loading, compilation, execution, and observation use `tract`.
Root cause
In `onnx/src/tensor.rs`, `get_external_resources` checks only the spelling of `location`:
let location_path = std::path::Path::new(location);
if location_path.components().any(|c| {
!matches!(c, std::path::Component::Normal(_) | std::path::Component::CurDir)
}) {
bail!("external data location must be a relative path inside the model directory");
}
let p = PathBuf::from(path).join(location_path);
provider.read_bytes_from_path(&mut tensor_data, &p, offset, length)?;On the non-Wasm default path, `MmapDataResolver::read_bytes_from_path` performs:
let file = File::open(p)?;
let mmap = unsafe { memmap2::Mmap::map(&file)? };Every model-controlled name remains a normal lexical component, while `File::open` resolves the link target. The error text promises in-directory resolution, but the code enforces only an in-directory spelling.
Safe proof of concept
The attached `poc` crate creates only controlled temporary data:
- `model/` is the intended model root.
- `outside-model-root/canary.bin` contains `PREFIX:TRACT-SYMLINK-BOUNDARY-CANARY:SUFFIX`.
- The model bundle contains an intermediate relative link, a final relative link, and a final link to the absolute canonical path of that controlled canary.
- Four minimal ONNX files select the original dot-dot control or one of the three link variants. Each external initializer requests offset 7 and length 29.
- The model is loaded and run through the public facade.
From the `poc` directory, choose a path that does not already contain the fixture and run:
cargo run -- /tmp/tract-onnx-symlink-pocExpected result on 0.23.7:
dotdot=REJECTED
directory_symlink=ACCEPTED
final_symlink=ACCEPTED
absolute_target_symlink=ACCEPTED
facade_output=TRACT-SYMLINK-BOUNDARY-CANARY
boundary_crossed=trueThe proof does not access a real secret, network service, or third-party target.
Vulnerable/fixed contrast
A local reference patch canonicalizes the model directory and candidate, then rejects the candidate unless it is component-wise below the canonical model directory. With that patch, the same harness reports:
dotdot=REJECTED
directory_symlink=REJECTED
final_symlink=REJECTED
absolute_target_symlink=REJECTED
boundary_crossed=falseThe attached patch is a proof of the missing control, not a production-ready fix.
Recommended remediation
At minimum:
- Keep the lexical absolute/parent check as defense in depth.
- Resolve the model root and candidate and verify component-wise canonical containment before reading.
- Enforce the invariant at the actual filesystem-open boundary or make it an explicit requirement of every `ModelDataResolver`.
- Add regression cases for an intermediate link, a relative final link, an absolute-target final link, and the existing absolute/parent paths.
For a race-resistant implementation, prefer an opened model-directory handle plus descriptor-relative resolution that refuses symlinks/reparse points, or open-then-verify the resulting handle. A `canonicalize`-then-`File::open` sequence has a TOCTOU window if an attacker can mutate the directory concurrently. Hardlinks are a separate residual question and are not claimed as demonstrated here.
Validation performed
- Vulnerable: source v0.23.7, published crates.io 0.23.7, and latest main.
- Fixed control: v0.23.7 plus the attached canonical-containment reference patch.
- Delivery control: local `bsdtar` round-trip preserving the two relative links.
- Relevant upstream tests: ONNX, NNEF, TensorFlow, TFLite, tract-data, public facade/C FFI, autobatch/lanes, packing properties, AArch64 depthwise, and Metal.
- AddressSanitizer: tract-data, NNEF, ONNX parser subset, TensorFlow parser subset, packing properties, and AArch64 depthwise. No sanitizer memory error was observed in the passing subsets.
Public duplicate search
The search found the two existing repository advisories, including the parent GHSA, and no public issue or pull request matching the recorded `external_data` or `external_data symlink` queries. Negative search results cannot detect private or differently worded reports and are not presented as proof of novelty.
Evidence package
A deterministic vendor-safe ZIP with the public-crate PoC, validation outputs, version analysis, and reference patch is retained and can be provided in this private advisory on request. SHA-256: `c4664d206a7b875917ebd829777769caf051744163fd786fa466612889d1c9ad`.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
crates.iotract-onnx |
Corregida | 0.23.9 | -1 d | 0.23.10 no afectada |
0.23.9Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/sonos/tract/security/advisories/GHSA-7q44-75hx-2x3hLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
