YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
ONNX Runtime LSTM/GRU Integer Overflow PoC
CWE-190 (Integer Overflow) → CWE-122 (Heap Buffer Overflow)
ONNX Runtime's CPU RNN operators (LSTM, GRU, AttnLSTM) compute buffer sizes using int32 arithmetic.
When operator dimensions cause the product to exceed INT32_MAX, the allocation wraps to a tiny value
while the subsequent GEMM write uses the true (non-overflowed) size — heap out-of-bounds write.
Reproduction
pip install onnxruntime==1.23.2 onnx numpy
python3 poc_lstm.py # LSTM variant — crashes with SIGSEGV
python3 poc_gru.py # GRU variant — crashes with SIGSEGV
Files
poc_lstm.py— LSTM integer overflow PoC (hidden_size=512, seq_length=2097153)poc_gru.py— GRU integer overflow PoC (hidden_size=512, seq_length=2796203)
Both PoCs generate a crafted ONNX model and run inference. The integer overflow in
AllocateBuffers() produces a critically undersized heap buffer (8 KiB). MlasGemm then
writes ~16 GiB into that buffer, causing SIGSEGV.
Affected Versions
- onnxruntime v1.23.2 (latest stable, March 2026)
- onnxruntime v1.21.0
- All prior versions with CPU RNN operator support
- Downloads last month
- 10