☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2025-46148

CVE-2025-46148 Remote Code Execution in Pytorch
📅 PUBLISHED: 2025-09-25 00:00 UTC 🔄 UPDATED: 2026-09-23 20:40 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.40%
👁️
0.40% probability
10.1× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
SOON
PENDING NVD
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-46148 is a computational correctness vulnerability in PyTorch, affecting versions through 2.6.0. The flaw resides in the nn.PairwiseDistance(p=2) module when executed in eager mode, causing it to produce incorrect results for the L2 (Euclidean) distance calculation. This is not a memory corruption or remote code execution issue, but a logic error that leads to inaccurate pairwise distance computations. For applications relying on precise distance metrics—such as clustering, similarity search, or anomaly detection—this can result in flawed model outputs, degraded performance, or incorrect security decisions. The vulnerability has a CVSS score of 0.0, indicating no direct security impact, but its operational impact on data integrity and model reliability is significant.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

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.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

PyTorch is a widely used open-source machine learning framework distributed via PyPI, Conda, and source. This vulnerability affects all users of PyTorch versions up to 2.6.0 who utilize nn.PairwiseDistance in eager mode. Since the issue is in the core library, any downstream package or application that depends on PyTorch and uses this module is indirectly affected. Supply chain risk is moderate: while no malicious code is injected, the incorrect computation can propagate errors through ML pipelines, affecting model training, inference, and decision-making. Users should verify their usage of nn.PairwiseDistance and consider patching or replacing the function until an official fix is released.

CVSS Breakdown & Threat Level

  • CVSS Score: 0.0 (None)
  • Vector: UNKNOWN
  • Attack Vector: N/A (no remote exploitation)
  • Attack Complexity: N/A
  • Privileges Required: N/A
  • User Interaction: N/A
  • Scope: N/A
  • Confidentiality Impact: N/A
  • Integrity Impact: N/A
  • Availability Impact: N/A

Threat Level: Low (Operational). While the CVSS score is 0.0, the vulnerability has real-world consequences for data integrity and model accuracy. It is not exploitable for remote code execution or data theft, but it can cause silent data corruption in ML workflows.

Deep Dive & Mechanics

The nn.PairwiseDistance module computes pairwise distances between two sets of vectors. When p=2, it should compute the Euclidean distance: sqrt(sum((x - y)^2)). In PyTorch versions through 2.6.0, when running in eager mode (as opposed to JIT or TorchScript), the computation produces incorrect results due to a bug in the internal implementation.

The root cause is a logic error in the eager-mode kernel for nn.PairwiseDistance. Specifically, the function may incorrectly handle broadcasting or reduction operations, leading to off-by-one errors or incorrect axis summation. This results in distance values that are either too large, too small, or NaN in some edge cases. The bug does not affect JIT-compiled or TorchScript paths, only the default eager execution.

Technical Details:

  • Affected Function: torch.nn.PairwiseDistance(p=2)
  • Mode: Eager (default)
  • Impact: Incorrect Euclidean distance computation
  • Example: For two vectors [1, 2, 3] and [4, 5, 6], the correct Euclidean distance is sqrt(27) ≈ 5.196. The bug may produce a different value, e.g., sqrt(9) = 3 or NaN.

Vulnerable vs. Patched Code

Vulnerable Code (PyTorch <= 2.6.0, eager mode):

import torch
import torch.nn as nn

# Incorrect computation in eager mode
dist = nn.PairwiseDistance(p=2)
x = torch.tensor([[1.0, 2.0, 3.0]])
y = torch.tensor([[4.0, 5.0, 6.0]])
result = dist(x, y)  # May produce incorrect value

Patched Code (Hypothetical fix):

import torch
import torch.nn as nn

# Correct computation using manual implementation or JIT
dist = nn.PairwiseDistance(p=2)
x = torch.tensor([[1.0, 2.0, 3.0]])
y = torch.tensor([[4.0, 5.0, 6.0]])

# Workaround: use torch.cdist for correct results
result = torch.cdist(x, y, p=2)  # Correct Euclidean distance

Workaround: Until an official patch is released, users can replace nn.PairwiseDistance(p=2) with torch.cdist(x, y, p=2) or implement a manual Euclidean distance function.

Exploitation & Lab Setup

Red Team (Adversarial Simulation)

This vulnerability is not exploitable for remote code execution or privilege escalation. However, an adversary could leverage it to degrade ML model performance or cause incorrect outputs in security-critical applications (e.g., anomaly detection, facial recognition). The attack vector is limited to scenarios where the attacker can influence input data to a model using nn.PairwiseDistance.

Lab Setup:

  1. Install PyTorch 2.6.0: pip install torch==2.6.0
  2. Create a script to demonstrate the bug:
import torch
import torch.nn as nn

# Demonstrate incorrect computation
dist = nn.PairwiseDistance(p=2)
x = torch.tensor([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
y = torch.tensor([[7.0, 8.0, 9.0], [10.0, 11.0, 12.0]])
result = dist(x, y)
print("Incorrect result:", result)

# Compare with correct computation
correct = torch.cdist(x, y, p=2)
print("Correct result:", correct)
  1. Observe the discrepancy. The bug may produce values that are off by a factor or completely wrong.

Blue Team (Defensive Detection)

Detection Strategy:

  • Monitor for usage of nn.PairwiseDistance in PyTorch codebases.
  • Alert on any model outputs that show unexpected distance values (e.g., NaN, negative distances).
  • Use static analysis to flag calls to nn.PairwiseDistance(p=2) in eager mode.

Mitigation:

  • Replace nn.PairwiseDistance with torch.cdist or a manual implementation.
  • Use JIT compilation (torch.jit.script) to bypass the bug.
  • Update to a patched version when available.

Indicators of Compromise (IOCs)

  • File Hashes: N/A (no malicious files)
  • Network Indicators: N/A (no network exploitation)
  • Behavioral Indicators:
    • Model outputs containing NaN or infinite values for distance metrics.
    • Unexpected clustering or similarity results in ML pipelines.
    • Logs showing nn.PairwiseDistance usage in eager mode.
  • Registry/Config: N/A

Detection Engineering

YARA Rule

rule Detect_PyTorch_PairwiseDistance_Bug {
    meta:
        description = "Detects usage of nn.PairwiseDistance in PyTorch code that may be affected by CVE-2025-46148"
        author = "Valters IT"
        date = "2025-04-10"
        cve = "CVE-2025-46148"
    strings:
        $s1 = "nn.PairwiseDistance" ascii wide nocase
        $s2 = "PairwiseDistance" ascii wide nocase
    condition:
        any of them
}

Sigma Rule

title: PyTorch PairwiseDistance Bug Usage
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects usage of nn.PairwiseDistance in PyTorch code that may be affected by CVE-2025-46148
author: Valters IT
date: 2025-04-10
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        Image|endswith: '\python.exe'
        CommandLine|contains: 'nn.PairwiseDistance'
    condition: selection
falsepositives:
    - Legitimate usage of PairwiseDistance with p!=2 or in JIT mode
level: low

Suricata Rule

alert http any any -> any any (msg:"CVE-2025-46148 PyTorch PairwiseDistance Bug"; content:"nn.PairwiseDistance"; classtype:attempted-recon; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate Workaround: Replace nn.PairwiseDistance(p=2) with torch.cdist(x, y, p=2) or a manual Euclidean distance function.
  2. Code Review: Audit all codebases using PyTorch for calls to nn.PairwiseDistance and replace them.
  3. JIT Compilation: Use torch.jit.script to compile models, as the bug only affects eager mode.
  4. Monitor for Patches: Track PyTorch releases for an official fix (expected in version > 2.6.0).
  5. Validation: Add unit tests to verify distance computations against known correct values.

Long-term: Consider using alternative distance functions or libraries (e.g., SciPy) for critical applications until PyTorch releases a patch.


Valters IT
DevSecOps & Cyber Threat Intelligence
Report generated for CVE-2025-46148

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-46148/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.