CVE-2025-3121: PyTorch: memory corruption in JIT flatbuffer loader
MEDIUM PoC AVAILABLE CISA: TRACK*CVE-2025-3121 affects PyTorch 2.6.0's JIT module deserialization from FlatBuffer files, causing memory corruption that crashes the process (availability impact only). Local access and low privileges are required, limiting exposure primarily to shared ML platforms, Jupyter environments, and CI/CD pipelines where untrusted model files may be loaded. Audit who can supply model files to your PyTorch inference or training processes and restrict loading to trusted sources until an official patch is released.
What is the risk?
Medium severity (CVSS 5.5) with constrained real-world impact. The local attack vector significantly reduces exploitability in production cloud deployments, but raises risk in multi-tenant ML platforms, shared GPU clusters, and developer workstations where PyTorch 2.6.0 is installed. The exploit is public, complexity is low, and no authentication beyond OS-level user access is required. Impact is limited to denial-of-service (crash); no confidentiality or integrity breach. Risk elevates in environments where model files originate from external or unvalidated sources.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| PyTorch | pip | — | No patch |
Do you use PyTorch? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
Identify all systems running PyTorch 2.6.0 and inventory where JIT FlatBuffer models are loaded.
-
Restrict model file ingestion to verified, internally-signed artifacts only — treat model files as executable code.
-
Monitor PyTorch's GitHub issue #149800 and security advisories for an official patch; apply immediately when available.
-
For interim mitigation, avoid using torch.jit.jit_module_from_flatbuffer with models from untrusted or external sources.
-
In shared environments (JupyterHub, ML platforms), enforce filesystem ACLs to prevent users from supplying arbitrary model files to shared inference services.
-
Detection: alert on unexpected PyTorch process crashes or OOM signals in inference/training logs.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2025-3121?
CVE-2025-3121 affects PyTorch 2.6.0's JIT module deserialization from FlatBuffer files, causing memory corruption that crashes the process (availability impact only). Local access and low privileges are required, limiting exposure primarily to shared ML platforms, Jupyter environments, and CI/CD pipelines where untrusted model files may be loaded. Audit who can supply model files to your PyTorch inference or training processes and restrict loading to trusted sources until an official patch is released.
Is CVE-2025-3121 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2025-3121, increasing the risk of exploitation.
How to fix CVE-2025-3121?
1. Identify all systems running PyTorch 2.6.0 and inventory where JIT FlatBuffer models are loaded. 2. Restrict model file ingestion to verified, internally-signed artifacts only — treat model files as executable code. 3. Monitor PyTorch's GitHub issue #149800 and security advisories for an official patch; apply immediately when available. 4. For interim mitigation, avoid using torch.jit.jit_module_from_flatbuffer with models from untrusted or external sources. 5. In shared environments (JupyterHub, ML platforms), enforce filesystem ACLs to prevent users from supplying arbitrary model files to shared inference services. 6. Detection: alert on unexpected PyTorch process crashes or OOM signals in inference/training logs.
What systems are affected by CVE-2025-3121?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference, model registries, CI/CD model validation.
What is the CVSS score for CVE-2025-3121?
CVE-2025-3121 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.22%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0011.000 Unsafe AI Artifacts AML.T0029 Denial of AI Service Compliance Controls Affected
What are the technical details?
Original Advisory
A vulnerability classified as problematic has been found in PyTorch 2.6.0. Affected is the function torch.jit.jit_module_from_flatbuffer. The manipulation leads to memory corruption. Local access is required to approach this attack. The exploit has been disclosed to the public and may be used.
Exploitation Scenario
An adversary with local user access on a shared ML platform (e.g., a data scientist account on a GPU cluster) crafts a malformed FlatBuffer file and places it in a shared model repository or uploads it via an API endpoint that triggers model loading. When the inference service or validation pipeline calls torch.jit.jit_module_from_flatbuffer on the malicious file, memory corruption occurs and the process crashes. In a model-serving context, this results in a denial-of-service for downstream applications depending on that inference endpoint. In a CI/CD context, this silently kills model validation jobs, potentially allowing bad models to progress unchecked if crash handling is not properly monitored.
Weaknesses (CWE)
CWE-119 — Improper Restriction of Operations within the Bounds of a Memory Buffer: The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.
- [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer. Be wary that a language's interface to native code may still be subject to overflows, even if the language itself is theoretically safe.
- [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. Examples include the Safe C String Library (SafeStr) by Messier and Viega [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/pytorch/pytorch/issues/149800 Issue Vendor
- github.com/pytorch/pytorch/issues/149800 Issue Vendor
- vuldb.com Permissions Required VDB
- vuldb.com 3rd Party VDB
- vuldb.com Exploit 3rd Party VDB
- github.com/dylanleonard-1/ProcessUnity-3rd-Party-vendor-risk-lab Exploit
Timeline
Related Vulnerabilities
CVE-2024-5452 9.8 pytorch-lightning: RCE via deepdiff Delta deserialization
Same package: torch CVE-2023-43654 9.8 TorchServe: SSRF + RCE via unrestricted model URL loading
Same package: torch CVE-2022-45907 9.8 PyTorch: RCE via unsafe eval in JIT annotations
Same package: torch CVE-2022-0845 9.8 pytorch-lightning: code injection enables full RCE
Same package: torch CVE-2024-35198 9.8 TorchServe: URL bypass enables arbitrary model loading
Same package: torch