GitHub Advisoryadvisory · PyPI
GHSA-q69g-f4f5-v8m7 ONNX: Denial of service via unchecked expansion of packed sub-byte tensors in ONNX Python APIs
MEDIUM
Official page ↗
- Aliases
- CVE-2026-115922
- Ecosystem
- PyPI
- Packages
- onnx
- Severity
- Moderate
- CVSS vector
- CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Weaknesses
- CWE-789
- Reviewed
- 2026-10-28
Affected packages
• PyPI onnx: < 1.22.0 → fixed in 1.22.0
Description
Summary
ONNX's Python tensor-materialization helpers could allocate memory according to attacker-controlled tensor dimensions without verifying that a packed sub-byte payload contained the declared number of elements.
A very small model could therefore cause a disproportionately large allocation when an application called `onnx.numpy_helper.to_array()` or constructed `onnx.reference.ReferenceEvaluator` with the model. The issue affected `UINT2`, `INT2`, `UINT4`, `INT4`, and `FLOAT4E2M1` tensors stored in either `raw_data` or packed `int32_data`.
Technical details
The vulnerable `_unpack_2bit()` and `_unpack_4bit()` paths first allocated a small array based on the available packed bytes, then resized it to the shape declared in `TensorProto.dims`. They did not first confirm that the payload encoded enough logical elements for that shape.
For example, the reporter demonstrated a 66-byte model containing one packed byte and a declared dimension of 700,000,000. The model passed `onnx.checker.check_model()` and allocated approximately 700 MB while materializing the initializer, followed by another large allocation when executing the reference evaluator.
Loading, checking, or running shape inference on the serialized model alone did not trigger the allocation. The vulnerable tensor had to be materialized.
Impact
An application that materializes packed tensors from an untrusted model can exhaust available memory, causing denial of service. Memory corruption and code execution were not demonstrated.
Affected versions
• Affected: ONNX through 1.21.0
• Patched: ONNX 1.22.0
Remediation
Upgrade to ONNX 1.22.0 or later.
The primary fix validates the logical element count before resizing the unpacked NumPy array. A complementary checker change rejects an undersized packed payload before materialization.
• Materialization fix: onnx/onnx#8033
• Checker defense-in-depth: onnx/onnx#8038
The five affected tensor types and both storage formats were re-tested against the published ONNX 1.23.2 wheel and are rejected before the oversized allocation.
To verify the behavior using a released vulnerable package in an isolated environment, install `onnx==1.21.0` with `python -m pip install "onnx==1.21.0"`. Run memory-exhaustion demonstrations only with an appropriate process memory limit.
Severity
The vulnerable ONNX component processes the malicious model through a local library API or file boundary and is not itself bound to a network stack. Applications that expose ONNX model processing over a network should calculate an Environmental score with Modified Attack Vector set to Network.
Related
Alias · CVE (1)
- CVE-2026-115922 Open Neural Network Exchange (ONNX) is an open standard for machine learning interoperability. vulnerability
Weakness · CWE (1)
- CWE-789 Memory Allocation with Excessive Size Value weakness
References
- https://github.com/onnx/onnx/security/advisories/GHSA-q69g-f4f5-v8m7 web
- https://nvd.nist.gov/vuln/detail/CVE-2026-115922 advisory
- https://github.com/onnx/onnx/pull/8033 web
- https://github.com/onnx/onnx/pull/8038 web
- https://github.com/onnx/onnx/pull/8066 web
- https://github.com/onnx/onnx/commit/05c1bc3bceceb8d3cf11e9e7fc7f19f971c44988 web
- https://github.com/onnx/onnx/commit/8de2cf6aa47928e6515ac6d9e1a8b4758886a7df web
- https://github.com/onnx/onnx/commit/dce5876d6cc6cc30157af7d26a752ef44976da8e web
- https://github.com/onnx/onnx package
- https://github.com/onnx/onnx/releases/tag/v1.22.0 web