CVE-2025-55552
Executive Summary
CVE-2025-55552 is a security advisory affecting PyTorch v2.8.0, where unexpected behavior occurs when the components torch.rot90 and torch.randn_like are used together. The vulnerability has a CVSS score of 0.0, indicating no current severity assessment, and no EPSS score, suggesting low exploitation likelihood. No public proof-of-concept (PoC) or patch details are available. The issue may lead to undefined behavior or memory corruption, potentially impacting model integrity or system stability.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the PyTorch Python package (PyPI ecosystem). Users should verify package integrity via checksums and monitor for updates. The lack of patch details increases supply chain risk, as malicious actors could exploit the behavior in unpatched environments.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (No severity assigned)
- CVSS Vector: UNKNOWN
- Attack Vector: UNKNOWN
- Attack Complexity: UNKNOWN
- Privileges Required: UNKNOWN
- User Interaction: UNKNOWN
- Scope: UNKNOWN
- Confidentiality Impact: UNKNOWN
- Integrity Impact: UNKNOWN
- Availability Impact: UNKNOWN
- Threat Level: Low (based on no public exploits or active exploitation)
Deep Dive & Mechanics
The vulnerability arises from an interaction between torch.rot90 (which rotates a tensor by 90 degrees) and torch.randn_like (which generates a random tensor with the same shape as an input). When used together, the combination may cause unexpected behavior, such as:
- Incorrect tensor shapes or strides
- Memory corruption due to improper handling of rotated dimensions
- Potential for out-of-bounds reads/writes
The root cause likely involves a bug in the underlying C++/CUDA implementation where rot90 modifies tensor metadata (e.g., strides) that randn_like does not correctly account for, leading to undefined behavior.
Vulnerable vs. Patched Code
Vulnerable Code (PyTorch v2.8.0):
import torch
# Example that triggers unexpected behavior
x = torch.randn(3, 4, 5)
y = torch.rot90(x, k=1, dims=[0, 1])
z = torch.randn_like(y) # May produce incorrect shape or crash
Patched Code (Hypothetical):
import torch
# Ensure rot90 output is contiguous before using randn_like
x = torch.randn(3, 4, 5)
y = torch.rot90(x, k=1, dims=[0, 1]).contiguous()
z = torch.randn_like(y) # Works correctly
The patch would involve ensuring rot90 returns a contiguous tensor or that randn_like handles non-contiguous inputs properly.
Exploitation & Lab Setup
Red Team
Lab Setup:
- Install PyTorch v2.8.0:
pip install torch==2.8.0 - Use a Python environment with CUDA (optional)
Exploitation:
- Create a script that repeatedly calls
torch.rot90andtorch.randn_liketo trigger memory corruption. - Monitor for crashes or unexpected behavior.
- If memory corruption occurs, attempt to leverage it for arbitrary code execution (theoretical).
Example Script:
import torch
import sys
def trigger_bug():
for _ in range(1000):
x = torch.randn(10, 10, 10)
y = torch.rot90(x, k=1, dims=[0, 1])
z = torch.randn_like(y)
if z.shape != y.shape:
print("Shape mismatch detected")
sys.exit(1)
if __name__ == "__main__":
trigger_bug()
Blue Team
Detection:
- Monitor for crashes in PyTorch processes.
- Use memory analysis tools to detect out-of-bounds access.
- Implement input validation to avoid using
rot90withrandn_likein production.
Mitigation:
- Upgrade to a patched version when available.
- Use
contiguous()afterrot90as a workaround. - Restrict usage of these functions in untrusted environments.
Indicators of Compromise (IOCs)
- File Hashes: None available
- Network Indicators: None
- Behavioral: Unexpected crashes in PyTorch when using
torch.rot90andtorch.randn_liketogether - Logs: Python tracebacks indicating shape mismatch or memory errors
Detection Engineering
YARA Rule
rule CVE_2025_55552_PyTorch_Rot90_RandnLike
{
meta:
description = "Detects PyTorch code using rot90 and randn_like together"
author = "Valters IT"
date = "2025-01-01"
cve = "CVE-2025-55552"
strings:
$rot90 = "torch.rot90"
$randn_like = "torch.randn_like"
condition:
all of them
}
Sigma Rule
title: CVE-2025-55552 PyTorch Rot90 and RandnLike Usage
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects usage of torch.rot90 and torch.randn_like in Python scripts
logsource:
category: process_creation
product: windows
detection:
selection:
CommandLine|contains:
- 'torch.rot90'
- 'torch.randn_like'
condition: selection
falsepositives:
- Legitimate usage in research
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-55552 PyTorch Rot90 and RandnLike Usage"; flow:to_server,established; content:"torch.rot90"; http_uri; content:"torch.randn_like"; http_uri; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Workaround: Add
.contiguous()aftertorch.rot90before usingtorch.randn_like. - Upgrade: Monitor PyTorch releases for a patch and upgrade to a fixed version.
- Input Validation: Avoid using these functions together in production code.
- Monitoring: Implement detection rules to alert on usage of these functions.
- Supply Chain: Verify package integrity and use trusted sources.
Valters IT
Securing Digital Frontiers