CVE-2026-47749

stable-diffusion.cpp: Heap buffer overflow in SHORT_BINUNICODE parsing for PyTorch checkpoint files

Published Jun 16, 2026 CVSS 3.1 · 7.8 High EPSS < 1% KEV · Not listed
Description
stable-diffusion.cpp is a pure C/C++ library for running diffusion model (Stable Diffusion, Flux, Wan, Qwen Image, Z-Image, and more) inference. Versions prior to master-584-0a7ae07 are vulnerable to heap buffer overflow in SHORT_BINUNICODE parsing for PyTorch checkpoint files. The pickle .ckpt parser in src/model.cpp contained a heap buffer overflow vulnerability in the SHORT_BINUNICODE opcode handler. The issue was caused by sign confusion on the opcode length field. A crafted .ckpt file could trigger memcpy with a very large length derived from a negative signed value, causing immediate heap corruption. Any application using affected stable-diffusion.cpp releases to load untrusted .ckpt model files could be vulnerable. A malicious checkpoint file could cause heap corruption through memcpy with an attacker-controlled length. This may lead to process crash and could potentially be leveraged for code execution depending on heap layout. The attack requires the victim or application to load a .ckpt file from an untrusted source, such as a downloaded model from a model sharing site. The issue has been resolved in version master-584-0a7ae07. If developers are unable to immediately update their applications they can work around this issue by not loading .ckpt checkpoint files from untrusted sources, and referring to trusted model sources and safer formats such as .safetensors where possible.

Analysis

AI-generated

Technical impact

A heap buffer overflow exists in the SHORT_BINUNICODE opcode handler of the PyTorch checkpoint parser in stable‑diffusion.cpp. The overflow is caused by sign confusion on the opcode length field, allowing a crafted .ckpt file to trigger memcpy with a very large length derived from a negative signed value, resulting in immediate heap corruption. This weakness can crash the process and, depending on the heap layout, may be leveraged for arbitrary code execution. The flaw corresponds to CWE‑122 and CWE‑787.

Affected Systems

All releases of the stable‑diffusion.cpp library prior to master‑584‑0a7ae07 are affected. Any application that uses this library to load PyTorch checkpoint files from an untrusted source is vulnerable, regardless of the diffusion model being run.

Risk and Exploitability

The CVSS score of 7.8 indicates high severity, but the EPSS score of less than 1% suggests a low probability of exploitation at present. The vulnerability is not listed in CISA’s KEV catalog. The attack requires an adversary to supply a malicious .ckpt file to an application that loads it, which is a practical and readily achievable scenario for consumers downloading models from model sharing sites. Once a vulnerable application processes such a file, it may experience a crash or, if the heap state is favorable, could allow arbitrary code execution.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade stable‑diffusion.cpp to master‑584‑0a7ae07 or later
  • Avoid loading .ckpt checkpoint files from untrusted sources
  • Prefer using .safetensors format when possible

Generated by OpenCVE AI on June 17, 2026 at 21:27 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Leejet
Leejet stable-diffusion.cpp
Vendors & Products Leejet
Leejet stable-diffusion.cpp
Type Values Removed Values Added
Description stable-diffusion.cpp is a pure C/C++ library for running diffusion model (Stable Diffusion, Flux, Wan, Qwen Image, Z-Image, and more) inference. Versions prior to master-584-0a7ae07 are vulnerable to heap buffer overflow in SHORT_BINUNICODE parsing for PyTorch checkpoint files. The pickle .ckpt parser in src/model.cpp contained a heap buffer overflow vulnerability in the SHORT_BINUNICODE opcode handler. The issue was caused by sign confusion on the opcode length field. A crafted .ckpt file could trigger memcpy with a very large length derived from a negative signed value, causing immediate heap corruption. Any application using affected stable-diffusion.cpp releases to load untrusted .ckpt model files could be vulnerable. A malicious checkpoint file could cause heap corruption through memcpy with an attacker-controlled length. This may lead to process crash and could potentially be leveraged for code execution depending on heap layout. The attack requires the victim or application to load a .ckpt file from an untrusted source, such as a downloaded model from a model sharing site. The issue has been resolved in version master-584-0a7ae07. If developers are unable to immediately update their applications they can work around this issue by not loading .ckpt checkpoint files from untrusted sources, and referring to trusted model sources and safer formats such as .safetensors where possible.
Title stable-diffusion.cpp: Heap buffer overflow in SHORT_BINUNICODE parsing for PyTorch checkpoint files
Weaknesses CWE-122
CWE-787
References
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jun 16, 2026, 7:31 PM
Reserved
May 19, 2026, 10:16 PM
Status
Analyzed
Published
Jun 16, 2026, 7:16 PM
Modified
Oct 25, 2026, 11:10 PM