The vulnerability is a heap-based buffer overflow in ExecuTorch's model loading process, as described in CVE-2025-54951. The root cause is the lack of validation on the rank (number of dimensions) of tensors within a model file. The provided commit cea9b23aa8ff78aff92829a466da97461cc7930c directly addresses this issue by introducing a check for the tensor dimension limit.
The analysis of the patch reveals that two functions, both named parseTensor but in different files (tensor_parser_aten.cpp and tensor_parser_portable.cpp), were modified to include this crucial validation. These functions are responsible for parsing tensor data from the model file. By not checking the number of dimensions, an attacker could craft a malicious model file with a tensor that has an extremely large rank. When parseTensor attempts to process this tensor, it would lead to a buffer overflow, potentially causing a denial of service or enabling arbitrary code execution.
The identified vulnerable functions, executorch::runtime::parseTensor, are the exact locations where the vulnerability existed and where the fix was applied. During exploitation, these functions would be on the call stack as they process the malicious tensor data, making them key indicators for runtime profiling and security monitoring.