Skip to main content

stable-diffusion.cpp EUVDEUVD-2026-117547

| CVE-2026-70660 MEDIUM
Out-of-bounds Read (CWE-125)
2026-11-05 GitHub_M
6.9
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft .safetensors with out-of-range data_offsets
  2. Delivery
    Deliver malicious model via untrusted source
  3. Exploit
    Victim loads model in stable-diffusion.cpp
  4. Execution
    Loader reads nbytes past mapped file bounds
  5. Impact
    Disclose adjacent process memory or crash

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, read limits
MITRE ATT&CK

1 technique across 1 tactic: Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the victim to load an attacker-controlled or third-party .safetensors model file through stable-diffusion.cpp's safetensors loader (src/model_io/safetensors_io.cpp); the malicious file must declare a tensor whose data_offsets [begin,end] satisfy nbytes == end - begin while end extends past the file's data section, which the pre-patch code never checks against file_size. No authentication or privileges are needed and default configurations are affected - any build that loads untrusted safetensors is vulnerable. The key limiting factor is user interaction (UI:P): the attack only fires when a user chooses to load the untrusted model, and the vector is local (AV:L), not remote network exposure. Versions prior to master-764-e22272e are affected; updating to master-764-e22272e is the fix.

Impact

This is a moderate, not emergency, priority. The signals are internally consistent: the vendor CVSS 4.0 vector (AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:H) scores 6.9 and correctly reflects a local attack surface gated by user interaction - the victim must load an attacker-supplied .safetensors model - with high confidentiality and availability impact but no integrity impact. The vuln.today decision label is 'this_month', i.e. a real issue to schedule but not drop-everything. It is NOT listed in CISA KEV, so there is no confirmed active exploitation, and no EPSS probability was supplied, so widespread automated exploitation cannot be estimated from the data. A detailed public proof-of-concept exists in the GHSA advisory (a 90-byte crafted file with an AddressSanitizer-confirmed heap-buffer-overflow READ), demonstrating the OOB read is real and trivially triggered, but it is a demonstration PoC rather than a packaged weaponized exploit. The practical ceiling on confidentiality is worth noting: the out-of-bounds read copies adjacent process memory into tensor buffers consumed by inference, so disclosure back to the attacker is not direct and depends on whether the application exposes model-derived output - the VC:H rating reflects potential, not guaranteed, exfiltration. Net: a genuinely valid vulnerability with a working PoC and a clear patch, whose real-world urgency is bounded by the local vector and the requirement that a user voluntarily load an untrusted model.

Exploit ScenarioDerived

An attacker publishes a crafted .safetensors model on a model-sharing hub or sends it to a target; because safetensors is promoted as the 'safe' alternative to pickle-based .ckpt files, the victim trusts and loads it with stable-diffusion.cpp. The tensor's data_offsets declare a byte range extending past the file's data section, so the loader reads an attacker-chosen length from beyond the mapped file, disclosing adjacent process memory into tensor buffers or crashing the process. A public PoC with ASan output exists in the GHSA advisory.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
No patch listed yet 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 05, 2026

Out-of-bounds read in stable-diffusion.cpp's safetensors loader (src/model_io/safetensors_io.cpp) lets a crafted .safetensors file make the model loader consume an attacker-chosen byte length from an unchecked offset past the end of the memory-mapped file, crashing the process and potentially copying adjacent process memory into tensor buffers. Every build prior to master-764-e22272e is affected, and the flaw fires only when a user chooses to load an untrusted or third-party model, making this a local, user-interaction-dependent attack rather than remote exposure. A proof-of-concept .safetensors file with an AddressSanitizer heap-buffer-overflow reproduction is documented in the vendor security advisory; there is no CISA KEV listing, so active exploitation is not confirmed, and the vulnerability is prioritized as this-month remediation work rather than an emergency.

RemediationAI

Update stable-diffusion.cpp to master-764-e22272e or later, which contains commit e22272ee631b742dab4440c18eb8fcafb0689402 and PR https://github.com/leejet/stable-diffusion.cpp/pull/1754; the patch adds a data_start check rejecting tensors where begin > end or end > file_size_ - data_start, and corrects the header-size comparison so an oversized header cannot slip through. Rebuild any binary, container image or downstream package pinned to an earlier master commit, since the project does not publish numbered releases and the fixed build is identified only by that tag. The vendor does not document a code-level workaround or configuration switch; the described exposure path is solely the loading of untrusted or third-party .safetensors files, so until the rebuild is deployed, restricting model provenance to files you produced or obtained from a trusted source removes the trigger (at the cost of blocking community model downloads), and running the loader under a memory-sanitized or sandboxed build limits the impact of the out-of-bounds read to a crash rather than memory disclosure. The advisory at https://github.com/leejet/stable-diffusion.cpp/security/advisories/GHSA-v2m4-h57v-fr6w is the authoritative reference for the fix and affected range.

Affected VersionsENISA

stable-diffusion.cpp < master-764-e22272e

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The safetensors format begins with an 8-byte little-endian header length, followed by a JSON header that declares, for each tensor, a dtype, a shape and a data_offsets pair [begin, end) relative to the start of the data section at offset 8 + header_size. In stable-diffusion.cpp, read_safetensors_file (src/model_io/safetensors_io.cpp, roughly lines 155-216) takes both offsets straight from the JSON as attacker-controlled size_t values and performs exactly one validation: that the tensor's computed nbytes equals end - begin. It never verifies that 8 + header_size + end is within file_size, and the earlier guards cover only the header length. The resulting TensorStorage offset, 8 + header_size + begin, is therefore unchecked, and the load path in src/model_loader.cpp (around lines 904-919) sets the destination pointer to mmap_data + tensor_offset and copies nbytes from it, reading past the end of the mapping. The root cause class is CWE-125 (out-of-bounds read); the concrete consequences are a process crash and possible disclosure of adjacent process memory into tensor buffers. The upstream fix (PR 1754, commit e22272ee631b742dab4440c18eb8fcafb0689402) introduces a data_start constant, tightens the header-size comparison to header_size_ > file_size_ - ST_HEADER_SIZE_LEN, and rejects tensors where begin > end or end > file_size_ - data_start, which also guards the end - begin subtraction against unsigned underflow. Notably, safetensors is the format users are directed to prefer over pickle-based .ckpt files for safety, so this bug sits directly on a trust boundary the project promotes.

Know when Stable Diffusion Cpp gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 6.9 MEDIUM
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N
vuln.today AI 7.1 HIGH

Loading a crafted file is local and needs user interaction (AV:L/UI:R) with no privileges; the OOB read can disclose adjacent memory (C:H) and crash the process (A:H), with no integrity impact.

3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H
4.0 AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

stable-diffusion.cpp is a pure C/C++ library for running diffusion model (Stable Diffusion, Flux, Wan, Qwen Image, Z-Image, and more) inference. Prior to master-764-e22272e, the safetensors loader in src/model_io/safetensors_io.cpp trusts each tensor's data_offsets after checking only that nbytes equals end - begin. A crafted .safetensors file can declare a byte range beyond the file's data section, causing src/model_loader.cpp to consume an attacker-chosen length from an unchecked mapped-file offset. Loading the model can read adjacent process memory into tensor buffers or crash the process. This issue is fixed in master-764-e22272e.

Threat Intelligence Overview

EPSS Score
0.1%
Top 97% exploitable
Prevalence
Low
niche open-source C/C++ AI inference library, enthusiast/developer footprint
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available No
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

34
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy