Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft .safetensors with out-of-range data_offsets
-
DeliveryDeliver malicious model via untrusted source
-
ExploitVictim loads model in stable-diffusion.cpp
-
ExecutionLoader reads nbytes past mapped file bounds
-
ImpactDisclose 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
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
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
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
More in Stable Diffusion Cpp
View allHeap buffer overflow in stable-diffusion.cpp versions prior to master-584-0a7ae07 allows attackers to corrupt memory and
Heap-based buffer overflow in stable-diffusion.cpp's pickle .ckpt parser allows attackers to corrupt memory and likely a
Heap buffer overflow in the leejet stable-diffusion.cpp pickle .ckpt parser allows arbitrary code execution when a user
Heap out-of-bounds write in the importance-matrix loader of stable-diffusion.cpp allows a crafted .imatrix file to corru
Out-of-bounds reads in stable-diffusion.cpp's PyTorch pickle checkpoint parser (versions prior to master-584-0a7ae07) al
EUVD-2026-117547
NVD
CVE.org
EPSS
GitHub
Exploit-DB