ONNX: Null pointer dereference in Upsample node leads to DoS
Overview
The Open Neural Network Exchange (ONNX) format, used for machine learning model interoperability, suffers from a critical denial of service vulnerability in versions prior to 1.22.0. Specifically, the `onnx.version_converter.convert_version()` function, when invoked to convert an ONNX model, can encounter a null pointer dereference. This occurs within the `Upsample_6_7::adapt_upsample_6_7()` function located in `onnx/version_converter/adapters/upsample_6_7.h`. The vulnerability is triggered when processing an untrusted ONNX model that contains an `Upsample` node configured with zero inputs. This malformed input leads to the null pointer dereference, crashing the converter process and resulting in an unrecoverable denial of service. Attackers can exploit this by submitting a specially crafted ONNX model to a system that utilizes the ONNX version converter, rendering the service unavailable. The issue is critical as it affects the integrity and availability of systems processing ONNX models.
Affected Systems
Testing Guide
1. Obtain or create a malicious ONNX model containing an `Upsample` node with zero inputs. 2. Attempt to convert this model using `onnx.version_converter.convert_version()` in an affected version of the `onnx` package. 3. Observe if the conversion process crashes or terminates unexpectedly, indicating a denial of service.
Mitigation Steps
* Upgrade the `onnx` package to version 1.22.0 or later. * Implement strict input validation for all ONNX models processed by the version converter. * Isolate the ONNX version conversion process in a sandboxed environment. * Monitor logs for conversion errors or crashes, and implement automated recovery mechanisms.
Patch Details
1.22.0