CVE-2026-115919: ONNX: Out-of-Bounds Read in RNN/GRU/LSTM Shape Inference (Old Opsets, Missing Rank Check)
ONNX up to 1.21.0 reads out of bounds during shape inference of old RNN, GRU and LSTM nodes (opsets 1 to 6) whose first input does not have rank three. A crafted model can crash any process that calls onnx.shape_inference.infer_shapes(). The result is denial of service. Fixed in ONNX 1.22.0.
Published Oct 28, 2026 · Analysis Nov 1, 2026
What an attacker can do
RNNShapeInference_opset1_to_6() checked that the first input had a shape, then read dim(0) and dim(1) without checking the rank. With a shape that has fewer than two dimensions, protobuf's repeated-field access reads outside the array. In release builds the observed result was SIGSEGV. Sanitizer and debug builds stopped on a protobuf bounds check instead.
The crafted model passes onnx.checker.check_model(), so a validation step before inference does not catch it. The attacker needs the target application to run shape inference on a model they supplied. That fits model hubs, upload-and-convert services, model scanners and inference pipelines that accept third-party ONNX files. No privileges or human interaction are needed once the model is processed.
The demonstrated impact is a crash, so availability only. No confidentiality or integrity impact was shown. The CVSS vector is local because ONNX is a library, but the advisory says applications that expose model processing over a network should rate the attack vector as network. A single crafted file can repeatedly take down a worker that handles uploads.
Who is affected
onnx through 1.21.0. The vulnerable schemas are RNN and LSTM at opsets 1 to 6 and GRU at opsets 3 to 6. The newer opset 7 to 13 and opset 14 and later paths already required rank three and are not affected. Check your version:
pip show onnxThe risk applies to code that calls shape inference on models from outside your trust boundary.
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"The fix, pull request 7879, adds a rank-three guard in onnx/defs/rnn/old.cc. A malformed node now raises InferenceError with the message First input tensor must have rank 3. The reporter retested the original malformed model on the published 1.23.2 wheel and it raises InferenceError. The advisory lists no other workaround. Run inference on untrusted models in a separate, restartable process until you upgrade.
How to tell if you were hit
Look for crashes of services that load ONNX models: segmentation faults in processes that call infer_shapes, and worker restarts that follow a model upload. Inspect suspect models for RNN, GRU or LSTM nodes at opsets 1 to 6 whose first input has a rank other than three. After upgrading, such models raise InferenceError, which you can log and alert on. The advisory gives no other signature.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
ONNX shape inference performed an out-of-bounds read when processing a malformed RNN, GRU, or LSTM node from opsets 1–6 whose first input had a rank other than three.
RNNShapeInference_opset1_to_6() checked whether the input shape was present but accessed dim(0) and dim(1) without first checking its rank. A crafted model could therefore terminate a process that called onnx.shape_inference.infer_shapes(). The model passed onnx.checker.check_model() before reaching the vulnerable path.
Technical details
The vulnerable code read dimensions unconditionally:
if (hasInputShape(ctx, 0)) {
const auto& first_input_shape = getInputShape(ctx, 0);
seq_length = first_input_shape.dim(0);
batch_size = first_input_shape.dim(1);
}For an undersized shape, protobuf's repeated-field access read outside the intended array in release builds. The observed result was SIGSEGV; sanitizer and debug builds terminated on a protobuf bounds check.
The newer opset 7–13 and opset 14+ inference paths already required the first input to have rank three and were not affected.
Impact
An application that performs shape inference on an untrusted model can be terminated, causing denial of service. Exploitation does not require privileges or human interaction once the model is processed. No confidentiality or integrity impact was demonstrated.
Affected versions
- Affected: ONNX through 1.21.0
- Patched: ONNX 1.22.0
The vulnerable schemas are limited to RNN and LSTM opsets 1–6 and GRU opsets 3–6.
Remediation
Upgrade to ONNX 1.22.0 or later. The fix validates that the first input has rank three before accessing its dimensions.
- Fix: onnx/onnx#7879
- Commit: `92e541266`
The original malformed model was also re-tested against the published ONNX 1.23.2 wheel and correctly raises InferenceError.
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 MinicoAI.
Questions
- Does onnx.checker.check_model() catch the malicious model?
No. The advisory says the crafted model passes the checker before it reaches the vulnerable shape inference path.
- Can this lead to code execution?
The advisory demonstrates only a crash (SIGSEGV) and says no confidentiality or integrity impact was shown.
- Is every ONNX model affected?
No. Only RNN and LSTM nodes at opsets 1 to 6 and GRU nodes at opsets 3 to 6 whose first input is not rank three reach the flaw.
References
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-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-115922
ONNX: Denial of service via unchecked expansion of packed sub-byte tensors in ONNX Python APIs
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
