CVE-2025-55554

5.3 MEDIUM

📋 TL;DR

PyTorch v2.8.0 contains an integer overflow vulnerability in torch.nan_to_num-.long() that could allow memory corruption or denial of service. This affects users who process untrusted numerical data with this specific function. The vulnerability requires attacker-controlled input to trigger.

💻 Affected Systems

Products:
  • PyTorch
Versions: v2.8.0 specifically
Operating Systems: All platforms running PyTorch
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects code using torch.nan_to_num-.long() function with untrusted input.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Memory corruption leading to arbitrary code execution or complete system compromise if combined with other vulnerabilities.

🟠

Likely Case

Application crash or denial of service when processing malicious numerical inputs.

🟢

If Mitigated

Limited impact with proper input validation and sandboxing of PyTorch operations.

🌐 Internet-Facing: MEDIUM - Exploitable if application accepts user input for PyTorch processing, but requires specific function usage.
🏢 Internal Only: LOW - Typically requires direct access to processing pipelines or data ingestion systems.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires crafting specific numerical inputs to trigger integer overflow. No public exploit code available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: PyTorch v2.8.1 or later

Vendor Advisory: https://github.com/pytorch/pytorch/issues/151510

Restart Required: No

Instructions:

1. Update PyTorch using pip: pip install --upgrade torch 2. Verify installation with: python -c "import torch; print(torch.__version__)" 3. Ensure version is 2.8.1 or higher.

🔧 Temporary Workarounds

Input validation wrapper

all

Wrap torch.nan_to_num-.long() calls with input validation to prevent malicious values

# Python example:
def safe_nan_to_num_long(tensor, nan=0.0, posinf=None, neginf=None):
    # Add validation logic here
    return torch.nan_to_num(tensor, nan=nan, posinf=posinf, neginf=neginf).long()

🧯 If You Can't Patch

  • Avoid using torch.nan_to_num-.long() with untrusted user input
  • Implement strict input validation and sanitization for all numerical data processed by PyTorch

🔍 How to Verify

Check if Vulnerable:

Check PyTorch version: python -c "import torch; print('VULNERABLE' if torch.__version__ == '2.8.0' else 'NOT VULNERABLE')"

Check Version:

python -c "import torch; print(torch.__version__)"

Verify Fix Applied:

Verify PyTorch version is 2.8.1 or higher: python -c "import torch; print(torch.__version__)"

📡 Detection & Monitoring

Log Indicators:

  • Application crashes or segmentation faults when processing numerical data
  • Unexpected memory allocation errors in PyTorch logs

Network Indicators:

  • Unusual patterns of numerical data submission to PyTorch-based services

SIEM Query:

source="application.logs" AND ("segmentation fault" OR "memory corruption" OR "torch.nan_to_num")

🔗 References

📤 Share & Export