Executive brief
ExecuTorch is PyTorch's on-device inference framework used to deploy machine learning models on mobile and edge devices. A heap buffer overflow vulnerability in the method loading process can crash the runtime or allow attackers to execute arbitrary code on the device running the affected software.
Technical details
The vulnerability is a heap-based buffer overflow (CWE-122) in ExecuTorch's method loading mechanism, specifically in the calculate_nbytes function which was patched in commit 93b1a0c to add overflow checking. An attacker can craft a malicious ExecuTorch model file that triggers the overflow when loaded, overwriting adjacent heap memory. The attack requires user interaction (loading/executing a crafted model) but no special privileges, and can be delivered over the network. Successful exploitation can lead to information disclosure (confidentiality impact), denial of service (availability impact), and potentially remote code execution. The fix is available in ExecuTorch version 0.7.0 (pip), 0.7.0-rc1 (Maven/Swift), and all versions at or after the specified commit.
Affected products
- PyTorch ExecuTorch <= 0.6.0
Timeline
- 2025-07-11: disclosed: Vulnerability published to GitHub Advisory Database and NVD
- 2025-07-11: patched: Fix available in ExecuTorch 0.7.0 (pip), 0.7.0-rc1 (Maven/Swift)