GHSA-q69g-f4f5-v8m7: Medium severity pip/onnx vulnerability

Published Oct 28, 2026
·
Updated

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.numpyhelper.toarray() or constructed onnx.reference.ReferenceEvaluator with the model. The issue affected UINT2, INT2, UINT4, INT4, and FLOAT4E2M1 tensors stored in either rawdata or packed int32data.

Technical details

The vulnerable unpack2bit() and unpack4bit() 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.checkmodel() 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.

Affected Software

1 affected componentFixes available
pip/onnx<=1.21.0
1.22.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/onnx to a version that resolves this vulnerability.

    Fixed in 1.22.0
  2. Upgrade

    Upgrade ONNX to a version that resolves this vulnerability.

    Fixed in 1.22.0

Event History

Oct 28, 2026
Advisory Published
via GitHub·09:16 PM
Data Sourced
via GitHub·09:16 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed in practice?

Applications are exposed when they process attacker-controlled ONNX models and either call onnx.numpy_helper.to_array() or create an onnx.reference.ReferenceEvaluator from the model. The affected tensor encodings are UINT2, INT2, UINT4, INT4, and FLOAT4E2M1 stored in raw_data or packed int32_data.

2

What does an attacker need to trigger the issue?

An attacker needs to provide a crafted model with packed sub-byte tensor data that is smaller than the number of elements declared by TensorProto.dims. Exploitation occurs when the application materializes the tensor or initializes the reference evaluator; the described example used a 66-byte model to induce an allocation of about 700 MB.

3

Can normal ONNX model validation identify malicious models?

Not reliably. The reported crafted model passed onnx.checker.check_model() despite declaring a dimension that the packed payload could not represent, so passing that check does not establish that sub-byte tensor payloads match their declared dimensions.

4

What is the likely operational impact?

The issue can cause disproportionately large memory allocations and denial of service. The affected paths can allocate once while materializing an initializer and again while executing the reference evaluator.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203