CVE-2026-115922: ONNX: Denial of service via unchecked expansion of packed sub-byte tensors in ONNX Python APIs
ONNX up to 1.21.0 allocates memory from attacker-declared tensor dimensions when unpacking sub-byte tensors, so a tiny model can exhaust memory. It triggers in `onnx.numpy_helper.to_array()` and `onnx.reference.ReferenceEvaluator`. Applications that materialize tensors from untrusted models are exposed to denial of service. Upgrade to ONNX 1.22.0.
Published Oct 28, 2026 · Analysis Nov 1, 2026
What an attacker can do
The helpers _unpack_2bit() and _unpack_4bit() first build a small array from the packed bytes, then resize it to the shape in TensorProto.dims. They never checked that the payload held enough elements for that shape. The affected types are UINT2, INT2, UINT4, INT4 and FLOAT4E2M1, stored in raw_data or packed int32_data.
The reporter built a 66-byte model with one packed byte and a declared dimension of 700,000,000. It passes onnx.checker.check_model() and allocates about 700 MB when the initializer is materialized, and again when the reference evaluator runs. Loading, checking or running shape inference alone does not trigger it. Larger dimensions mean larger allocations, so a service that evaluates or converts user-supplied models can be taken down by one small file. No memory corruption or code execution was shown.
Who is affected
The onnx pip package up to and including 1.21.0. Only applications that call to_array() on tensors from an untrusted model, or build a ReferenceEvaluator from one, are exposed. Check your version:
pip show onnxTo test safely, install onnx==1.21.0 in an isolated environment and set a process memory limit first.
onnx
- Ecosystem
- PyPI
- Affected
- <= 1.21.0
- Fixed in
- 1.22.0
- Check
pip show onnx
How to fix it
Upgrade to ONNX 1.22.0 or later:
pip install --upgrade "onnx>=1.22.0"Pull request 8033 validates the logical element count with math.prod(dims) before resizing, and to_array() now raises ValueError for an undersized payload. Pull request 8038 adds a checker change that rejects such payloads before materialization. The reporter confirmed all five types and both storage formats are rejected on the 1.23.2 wheel. The sources give no other workaround, but a memory limit on the worker process contains the damage.
How to tell if you were hit
Watch for out-of-memory kills or sudden memory growth in processes that call to_array() or ReferenceEvaluator. Models with a very small file size but an initializer of type INT4, UINT4, INT2, UINT2 or FLOAT4E2M1 and a huge dims value are the signature. Compare the declared element count with the payload length.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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.
Credited to Zwique.
Questions
- Does loading or checking a malicious model trigger the allocation?
No. The advisory says loading, checking or shape inference alone does not. The tensor must be materialized through
to_array()or the reference evaluator.- Which tensor types are affected?
UINT2, INT2, UINT4, INT4 and FLOAT4E2M1, whether the data is in
raw_dataor in packedint32_data.- How small can the malicious model be?
The reporter's example was 66 bytes, with one packed byte and a declared dimension of 700,000,000, which allocated roughly 700 MB.
References
Read for this analysis:
- https://github.com/onnx/onnx/security/advisories/GHSA-q69g-f4f5-v8m7
- https://github.com/onnx/onnx/pull/8033
- https://nvd.nist.gov/vuln/detail/CVE-2026-115922
- https://github.com/onnx/onnx/pull/8038
- https://github.com/onnx/onnx/pull/8066
- https://github.com/onnx/onnx/commit/05c1bc3bceceb8d3cf11e9e7fc7f19f971c44988
- https://github.com/onnx/onnx/commit/8de2cf6aa47928e6515ac6d9e1a8b4758886a7df
- https://github.com/onnx/onnx/commit/dce5876d6cc6cc30157af7d26a752ef44976da8e
- https://github.com/onnx/onnx/releases/tag/v1.22.0
- https://github.com/advisories/GHSA-q69g-f4f5-v8m7
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-115919
ONNX: Out-of-Bounds Read in RNN/GRU/LSTM Shape Inference (Old Opsets, Missing Rank Check)
medium6.2Oct 28, 2026CVE-2026-115920
ONNX: Out-of-bounds read in ConvTranspose shape inference via undersized weight rank
medium6.2Oct 28, 2026CVE-2026-115921
ONNX: Null Pointer Dereference in ScanInferenceFunction Due to Missing Required Attribute
medium6.2Oct 28, 2026CVE-2026-63632
ONNX: Heap-Buffer-Overflow READ in Gemm Version Converter Adapter via Undersized Input Shape
low3.3Jul 24, 2026CVE-2026-44512
ONNX has Null Pointer Dereference in Upsample Version Converter Adapter (Zero Inputs)
medium5.5Jul 7, 2026CVE-2026-34445
ONNX: Malicious ONNX models can crash servers by exploiting unprotected object settings.
high8.6Apr 1, 2026
