Views
No views yet
MeanDescriptor containing
an axis outside the input tensor rank. During normal graph optimization,
MeanLayer::InferOutputShapes() subtracts the number of serialized axes from
the output rank, but an out-of-range axis never matches an input dimension.
The layer writes all four retained dimensions into a three-element vector.2b61cecc9df7a43fca1463795062cf359e6be820IDeserializer::CreateNetworkFromBinary() then armnn::Optimize()CpuRefParseMean() copies the attacker-controlled axis vector without validating
each value against the input rank:1descriptor.m_Axis =
2 std::vector<unsigned int>(flatBufferAxis->begin(), flatBufferAxis->end());1outputRank = input.GetNumDimensions() -
2 armnn::numeric_cast<unsigned int>(m_Param.m_Axis.size());
3std::vector<unsigned int> dimSizes(outputRank, 1);100 never matches loop indexes zero through three, so all four input
dimensions take the unchecked branch:1dimSizes[outputIndex] =
2 armnn::numeric_cast<unsigned int>(input[i]);
3++outputIndex;./cyber/huntr-mfv/candidates/armnn-flatbuffers-mean-invalid-axis-output-shape-oob-write/reproduce.sh| Model | Result |
|---|---|
control-axis-2.armnn | exit 0, 0, 0 |
trigger-axis-100.armnn | ASan heap-buffer-overflow, exit 134, 134, 134 |
1ERROR: AddressSanitizer: heap-buffer-overflow
2WRITE of size 4
30 bytes after 12-byte region10x10d7c0 armnn::MeanLayer::InferOutputShapes(...) + 3384
20x10c418 armnn::MeanLayer::ValidateTensorShapesFromInputs() + 740
30x259960 armnn::Graph::InferTensorInfos() + 11600x02 becomes 0x64.1c173e99be9ca68671863274bcfed5212b6ba9f1350c9f552026ac0eb63181023 control-axis-2.armnn
2b4610241a7f2803cc03d23f85d6ed6ce588c1b61d5c14dc7d69b7921ca1badf0 trigger-axis-100.armnn.armnn model can corrupt heap memory and terminate an
Arm NN consumer during graph optimization, before inference.[0, input_rank) and reject duplicate axes
before output-rank calculation. Defensively bounds-check outputIndex during
shape construction.ReduceLayer.cpp; this occurrence has a different FlatBuffers schema layer,
parser function, descriptor type, source file, sink symbol, and fix site.