Views
No views yet
.armnn dimensionSpecificity Length Mismatch OOB PoCarmnnDeserializer::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 readdimensions entry, 5 dimensionSpecificity entries → TensorShape reads beyond outputDimsdimensions entry, 6 dimensionSpecificity entries → bool-array stack overflowhttps://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 length1# Generate the malicious .armnn FlatBuffers
2flatc -b -o tensorinfo-dimspecificity-oob \
3 ArmnnSchema.fbs \
4 bad-dimension-specificity.json
5flatc -b -o tensorinfo-dimspecificity-oob \
6 ArmnnSchema.fbs \
7 bad-dimension-specificity-6.json
8
9# Build the ASan harness against Arm NN's real TensorShape
10c++ -std=c++17 -O1 -g -fsanitize=address \
11 -I<armnn-include> -I<armnn-src> -I<flatbuffers-include> \
12 repro.cpp \
13 <armnn-src>/Tensor.cpp \
14 <armnn-src>/Exceptions.cpp \
15 -o repro
16
17# Run against either malicious file
18./repro bad-dimension-specificity.armnn # heap OOB read
19./repro bad-dimension-specificity-6.armnn # stack OOB writeVerifySerializedGraphBuffer — 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/armnnDeserializer::Deserializer::ReadGraph() (or higher-level wrappers like armnn::INetworkPtr deserializer->CreateNetworkFromBinary(...)) on a user-supplied .armnn file:dimensionSpecificity length as constrained against dimensions length, so VerifySerializedGraphBuffer accepts itToTensorInfo() before consuming dimensionSpecificity:1if (dimensionSpecificity != nullptr) {
2 if (dimensionSpecificity->size() != dimensions->size()) {
3 throw ParseException("dimensionSpecificity length must equal dimensions length");
4 }
5 if (dimensionSpecificity->size() > armnn::MaxNumOfTensorDimensions) {
6 throw ParseException("dimensionSpecificity exceeds MaxNumOfTensorDimensions");
7 }
8 // ... existing copy loop ...
9}(required) annotation on the constraint, or add a validate_program()-style walker that checks all per-tensor invariants after VerifySerializedGraphBuffer succeeds.lendtrain (huntr) / tonydav41 (HuggingFace). Filed 2026-05-12.