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

> Heap buffer overflow in stable-diffusion.cpp allows attackers to execute code or crash the application via crafted PyTorch checkpoint files.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 16 Jun 2026
- **Updated:** 16 Jun 2026
- **Also known as:** GHSA-2c29-5hxg-fv9g

## What is CVE-2026-47749?

CVE-2026-47749 is a high-severity memory corruption vulnerability in leejet stable-diffusion.cpp, published on 16 Jun 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official 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.

Weakness: CWE-787 (Out-of-bounds Write), CWE-122 (Heap-based Buffer Overflow)

## Which versions are affected by CVE-2026-47749?

It affects 1 product.


Products: Leejet Stable-Diffusion.cpp.

## How do I fix CVE-2026-47749?

No fix has been published for CVE-2026-47749 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-47749 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-47749 exists.

## Other vulnerabilities in leejet stable-diffusion.cpp

- [CVE-2026-47747](https://insights.sbomify.com/CVE-2026-47747/): stable-diffusion.cpp has a Heap-based Buffer Overflow (high 7.8)
- [CVE-2026-47750](https://insights.sbomify.com/CVE-2026-47750/): stable-diffusion.cpp: Heap buffer overflow in GLOBAL opcode parsing for PyTorch checkpoint files (high 7.8)
- [CVE-2026-47748](https://insights.sbomify.com/CVE-2026-47748/): stable-diffusion.cpp: Out-of-bounds reads in PyTorch checkpoint pickle opcode parsing (medium 5.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-47749 and fix it if it is affected.

What it is: CVE-2026-47749 is a high-severity memory corruption vulnerability in leejet stable-diffusion.cpp, published on 16 Jun 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-47749 exists.

Affected product: leejet stable-diffusion.cpp. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-47749/ (Markdown: https://insights.sbomify.com/CVE-2026-47749/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-47749
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-47749
- OSV: https://osv.dev/vulnerability/CVE-2026-47749

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-47749/
Summaries are generated and may contain mistakes; the official description above is the record.
