/

CVE-2026-34445

Severity:

HIGH RISK

(8.6)

Improper Input Validation in ONNX

CVE-2026-34445

Analyzed

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20, CWE-400, CWE-915

Impact:

Integrity and Control-Flow Manipulation via Malicious Model Files

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

ONNX's ExternalDataInfo class previously loaded metadata fields (such as file paths and data lengths) from model files using Python's setattr() without validating the input keys.

A crafted ONNX model could supply unexpected keys that overwrite internal object properties, potentially altering program control flow or corrupting how external data is referenced when the model is loaded.

Affected context

This vulnerability affects environments that:

  • Load ONNX models which reference external data via the ExternalDataInfo class
  • Accept model files from semi-trusted or untrusted sources (e.g., user uploads, shared repositories, or CI artifacts)
  • Parse model metadata and external data descriptors automatically as part of model loading or preprocessing

The risk is most pronounced where ONNX model loading occurs in security-sensitive services, automated pipelines, or multi-tenant platforms that do not strictly control who can provide model files.

Exploit preconditions

  • Attack surface: ONNX model loading functionality, specifically handling of external data metadata.
  • Required access: Ability to supply or influence an ONNX model file that will be parsed by a vulnerable ONNX runtime or tooling.
  • Trigger point: Deserialization/loading of the ONNX model where ExternalDataInfo reads metadata and applies setattr() with attacker-controlled keys.
  • Why exploitation is possible: The loader trusted metadata keys from the model file and used them directly with setattr(), allowing arbitrary attributes of the ExternalDataInfo instance to be overwritten without validation or constraint.

Why this happens

The core issue is improper input validation (CWE-20) combined with dynamic attribute setting.

ExternalDataInfo used Python's setattr() to assign values for metadata fields (e.g., location, length, checksum) using keys taken directly from the model file, without checking that:

  • The keys corresponded to a known, allowed set of attributes, and
  • No sensitive or internal attributes were being targeted.

This pattern effectively turned model metadata into a free-form attribute map, enabling a malicious model to override internal state or configuration fields on the object. The behavior also relates to CWE-915 (Improperly Controlled Modification of Object Prototype Attributes), in that attacker-controlled keys influence object structure and properties in an uncontrolled way, and to CWE-400 when such uncontrolled attribute growth or manipulation can cause excessive processing or resource misuse.

Potential impact

  • Malicious modification of internal ExternalDataInfo fields that control how external tensor data is resolved or interpreted.
  • Corruption of model-loading logic, potentially causing misrouting of file paths or incorrect buffer sizes and offsets.
  • Unexpected behavior in downstream processing pipelines, including crashes, undefined behavior, or silent data integrity issues.
  • Increased risk of chaining with other weaknesses (e.g., path handling or deserialization bugs) where overwritten attributes may unlock more severe impacts.

General mitigation guidance

Effective mitigation focuses on constraining what metadata keys can do and reducing trust in model-provided structures:

  • Enforce an explicit allowlist of valid metadata keys when processing ExternalDataInfo or similar objects; ignore or reject any unknown or unexpected keys.
  • Avoid using generic dynamic attribute setters (e.g., direct setattr() from untrusted data); instead, map known keys to fields through explicit, typed assignment.
  • Introduce strict schema validation for ONNX model metadata and external data descriptors before they are used to construct runtime objects.
  • Separate internal control fields from user-influenced metadata, ensuring that critical properties cannot be overwritten based solely on file contents.
  • Run model-loading components with the principle of least privilege and in isolation where feasible, so that unexpected attribute modification has limited blast radius.

How teams detect issues like this

Organizations can spot and control similar issues using:

  • Static analysis and linting: Rules to detect direct use of setattr(), __dict__ manipulation, or other reflection-based APIs where attribute names are derived from untrusted inputs.
  • Code review practices: Security-focused reviews for model-deserialization and metadata-handling code, checking for:
  • Missing allowlists for keys or fields
  • Unvalidated mappings from file metadata to object attributes
  • Schema and contract checks: Automated validation of ONNX models against expected metadata schemas as part of CI/CD, rejecting files that contain unexpected keys or structures.
  • Runtime monitoring: Logging and anomaly detection around model-loading operations, including warnings when unknown metadata fields are encountered or object attributes change in atypical ways.

Sources

SourceLink
github.comgithub.com/onnx/onnx/commit/e30c6935d67cc3eca2fa284e37248e7c0036c46b
github.comgithub.com/onnx/onnx/pull/7751
github.comgithub.com/onnx/onnx/security/advisories/GHSA-538c-55jv-c5g9

Frequently asked

questions

It can be, if a system exposes a remote interface that accepts ONNX models (for example, an upload API, a model registry, or a multi-tenant inference platform). In such cases, a remote attacker could submit a malicious model that the backend then parses with a vulnerable ONNX version.

The attacker must be able to supply or influence an ONNX model file that will be loaded by the affected code. This could involve direct file uploads, pushing models into a shared repository, or compromising a pipeline that produces or transforms models.

The safest approach is to never trust metadata keys from model files blindly: enforce a strict allowlist of known keys, explicitly assign them to typed fields, and ignore or reject anything unexpected. Removing generic setattr() calls that operate on untrusted key names is central to the fix.

Treat model files and metadata as untrusted input, apply strong schema validation, avoid reflection-based updates from user-controlled values, and incorporate automated security checks for deserialization and metadata-handling code into your development and review process.

Find out what's already
exploitable in your codebase.