PyTorch torchvision, Out-of-bounds Heap Read, CVE-2026-65918 (High) -DC-Aug2026-1751

Listen to this Post

CVE-2026-65918 is a memory corruption vulnerability affecting PyTorch torchvision, a popular computer vision library for Python. The flaw resides in the GIF decoder component, specifically within the `read_from_tensor` callback function. This function is responsible for reading GIF image data and converting it into PyTorch tensor objects for further processing.
The root cause of this vulnerability is improper input validation. When the GIF decoder parses a maliciously crafted or truncated GIF file, it extracts a length parameter from the GIF metadata. This length value is then passed directly to the `memcpy` function without any clamping or validation. Under normal circumstances, this length would be within the bounds of the allocated heap buffer. However, an attacker can manipulate the GIF file to contain an oversized or invalid length value.
When the decoder attempts to copy data using this unclamped length, `memcpy` tries to read beyond the boundaries of the allocated heap buffer. This out-of-bounds heap read triggers a segmentation fault, causing the application to crash and resulting in a denial of service. In some scenarios, the out-of-bounds read may also expose adjacent heap memory contents, potentially leaking sensitive information.
The vulnerability affects all PyTorch torchvision versions up to and including 0.28.0. The issue was addressed in commit 4e05dc2, which implements proper length clamping and validation before memory operations are performed. The patch ensures that all length parameters are properly validated, preventing both the denial of service conditions and the potential information disclosure risks.
The vulnerability is classified under CWE-125 (Out-of-bounds Read) and has been assigned a CVSS v3.1 base score of 7.1 (High). The attack vector is network-based, requires low attack complexity, no privileges, but does require user interaction. A proof-of-concept exploit is publicly available.

DailyCVE Form:

Platform: PyTorch torchvision
Version: ≤0.28.0
Vulnerability: OOB Heap Read
Severity: High (7.1)
date: 2026-07-23

Prediction: 2026-08-15

What Undercode Say:

The vulnerability arises from improper bounds checking in the GIF decoder’s `read_from_tensor` callback. The unclamped length parameter passed to `memcpy` allows out-of-bounds heap reads.

Check torchvision version
python -c "import torchvision; print(torchvision.<strong>version</strong>)"
Verify if vulnerable (≤0.28.0)
python -c "import torchvision; assert torchvision.<strong>version</strong> <= '0.28.0', 'Not vulnerable'"

Exploit: (Educational Purposes!)

Attackers craft a malicious GIF file with an oversized or invalid length value in its metadata. When this file is processed by the vulnerable GIF decoder, the unclamped length is passed to memcpy, triggering an out-of-bounds heap read. This results in a segmentation fault (DoS) or potential disclosure of adjacent heap memory contents.

PoC concept (educational only)
Craft a GIF with malformed length field
When decoded, unclamped length triggers OOB read in read_from_tensor

Protection:

  • Upgrade to torchvision version newer than 0.28.0 that includes commit `4e05dc2`
    – Implement input validation for GIF files before processing
  • Deploy additional monitoring around image processing components
  • Consider using memory-safe alternatives for image parsing where possible

Impact:

  • Denial of Service: Segmentation faults crash applications processing malicious GIFs
  • Information Disclosure: Out-of-bounds reads may expose adjacent heap memory contents
  • Widespread Exposure: Affects all torchvision versions ≤0.28.0
  • User Interaction Required: Attackers must convince users to process malicious GIF files
  • CVSS Score: 7.1 (High) with network attack vector and low complexity

🎯Let’s Practice Exploiting & Learn Patching For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

Sources:

Reported By: nvd.nist.gov
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top