Downloads · 30 days
0
tonydav41/armnn-poc-tensorinfo-dimspecificity-oob-2026-05-12
armnn-poc-tensorinfo-dimspecificity-oob-2026-05-12 is a machine learning model from tonydav41. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
PoC for huntr submission against Arm NN Flatbuffers – Arm.
Downloads · 30 days
0
Access
Public
Updated May 12, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md7.5 KB · 52%
From the Hugging Face model README
.armnn dimensionSpecificity Length Mismatch OOB PoCPoC for huntr submission against Arm NN Flatbuffers – Arm.
armnnDeserializer::ToTensorInfo() trusts the FlatBuffer dimensionSpecificity vector length without verifying it matches the dimensions vector length or that it stays within armnn::MaxNumOfTensorDimensions (5). FlatBuffer verification (VerifySerializedGraphBuffer) accepts mismatched vector lengths because each vector is individually well-formed. The deserializer then:
size variable with dimensionSpecificity->size()bool values into a fixed five-element stack array (stack OOB write if size > 5)TensorShape(size, outputDims.data(), dimensionsSpecificity) using the inflated size against outputDims.data() whose actual length is dimensions->size() — heap OOB readTwo verified variants:
dimensions entry, 5 dimensionSpecificity entries → TensorShape reads beyond outputDimsdimensions entry, 6 dimensionSpecificity entries → bool-array stack overflowBoth reproduced under AddressSanitizer with the canonical FlatBuffer verifier in the loop.
https://github.com/ARM-software/armnnf8beb5a9d50451dd06c804d6f7bbf8832f958125 (v26.01 release, "Update README for v26.01 Release (#818)")src/armnnDeserializer/Deserializer.cpp L743-L760TensorShape construction)AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H = ~7.1 (local-vector downgrade to ~5.5 if huntr scores as local file open)src/armnnDeserializer/Deserializer.cpp:
outputDims sized from dimensions->size()size overwritten with dimensionSpecificity->size(); bools copied into fixed bool dimensionsSpecificity[5] stack array — no upper bound checkTensorShape(size, outputDims.data(), dimensionsSpecificity) — uses inflated size against outputDims of smaller lengthPermalinks:
# Generate the malicious .armnn FlatBuffers
flatc -b -o tensorinfo-dimspecificity-oob \
ArmnnSchema.fbs \
bad-dimension-specificity.json
flatc -b -o tensorinfo-dimspecificity-oob \
ArmnnSchema.fbs \
bad-dimension-specificity-6.json
# Build the ASan harness against Arm NN's real TensorShape
c++ -std=c++17 -O1 -g -fsanitize=address \
-I<armnn-include> -I<armnn-src> -I<flatbuffers-include> \
repro.cpp \
<armnn-src>/Tensor.cpp \
<armnn-src>/Exceptions.cpp \
-o repro
# Run against either malicious file
./repro bad-dimension-specificity.armnn # heap OOB read
./repro bad-dimension-specificity-6.armnn # stack OOB write
Both files pass VerifySerializedGraphBuffer — the verifier does NOT catch the cross-vector length mismatch. The ASan trace in asan-output.txt shows the exact failure mode.
bad-dimension-specificity.armnn — heap OOB variant (236 B)bad-dimension-specificity.json — JSON source for the heap variantbad-dimension-specificity-6.armnn — stack OOB variant (236 B)bad-dimension-specificity-6.json — JSON source for the stack variantrepro.cpp — ASan harness that runs VerifySerializedGraphBuffer then the vulnerable ToTensorInfo logicasan-output.txt — captured ASan tracepoc-README.md — auditor's notes from /tmp/armnn-audit/poc/Any process or service that calls Arm NN's armnnDeserializer::Deserializer::ReadGraph() (or higher-level wrappers like armnn::INetworkPtr deserializer->CreateNetworkFromBinary(...)) on a user-supplied .armnn file:
Surfaces affected: Arm NN's reference runtime, any embedded inference SDK that vendors Arm NN (Arm's own NN SDK ships in Mali GPU drivers, mobile inference apps, IoT inference frameworks).
dimensionSpecificity length as constrained against dimensions length, so VerifySerializedGraphBuffer accepts itAdd semantic validation in ToTensorInfo() before consuming dimensionSpecificity:
if (dimensionSpecificity != nullptr) {
if (dimensionSpecificity->size() != dimensions->size()) {
throw ParseException("dimensionSpecificity length must equal dimensions length");
}
if (dimensionSpecificity->size() > armnn::MaxNumOfTensorDimensions) {
throw ParseException("dimensionSpecificity exceeds MaxNumOfTensorDimensions");
}
// ... existing copy loop ...
}
Defense in depth: extend the schema to add (required) annotation on the constraint, or add a validate_program()-style walker that checks all per-tensor invariants after VerifySerializedGraphBuffer succeeds.
Reported by lendtrain (huntr) / tonydav41 (HuggingFace). Filed 2026-05-12.