Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft .imatrix with duplicate tensor name (small then large nval)
-
DeliveryDeliver file via model/imatrix supply chain
-
ExploitVictim loads it with --imat-in conversion path
-
ExecutionResize skipped, accumulation loop writes past both heap buffers
-
ImpactHeap corruption, crash, or controlled-write toward code execution
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, write limits
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Privilege Escalation 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 untrusted .imatrix file through the conversion path (e.g. 'sd-cli -M convert --imat-in <file>'); no model file is required because the imatrix loads first. The crafted file must contain at least two entries sharing the same tensor name - the first with a small nval, the second with a larger nval - so that IMatrixCollector::load_imatrix sizes the values/counts vectors to the first entry but iterates over the second entry's larger nval, writing past both heap buffers. Limiting factors that reduce realistic risk: the vector is local (AV:L) and demands user interaction (UI:R) - a user must voluntarily process the attacker-supplied file - and only versions from master-742-1a13107 up to the master-763-4fcc6fe fix are affected. No privileges or authentication are needed (PR:N). |
| Impact | Signals point to a moderate, scoped priority rather than a mass-exploitation emergency. The CVSS 3.1 vector (AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H, base 7.8) describes a local, low-complexity flaw that needs no privileges but DOES require user interaction (UI:R) - the victim must load an attacker-supplied .imatrix file. There is no CISA KEV entry and no EPSS score in the supplied data, so there is no evidence of active or widespread exploitation; the vuln.today decision label is 'this_week', consistent with prompt but non-emergency handling. Working against that lower-urgency read: the GHSA advisory documents a confirmed, reproduced PoC (standalone driver producing 'double free or corruption' and a gdb-pinned SIGSEGV, plus a real sd-cli crash) and the primitive is a heap out-of-bounds WRITE with attacker-controlled value, written integer, and OOB length - a controlled-write primitive the reporter notes 'may be exploitable further,' which raises impact above a simple crash. The realistic risk hinges on delivery: imatrix files are shared like models, so a supply-chain/social-engineering vector is credible even though the attack vector is local. Net: treat as a genuine fix-this-week memory-corruption bug, not a drop-everything internet-facing issue; its severity is real but gated by the requirement that a user voluntarily process an untrusted imatrix file. |
| Exploit ScenarioDerived | An attacker publishes or shares a malicious .imatrix file (distributed alongside models in the AI supply chain). A victim runs the conversion path, e.g. 'sd-cli -M convert --imat-in poc.imatrix -o out.gguf', and the loader writes attacker-controlled data past two heap buffers, corrupting the heap or crashing the process before any model is even loaded. A confirmed PoC exists in the GHSA advisory and reproduces both heap corruption and a direct SIGSEGV; the write is attacker-controlled in value and range, so escalation beyond a crash may be possible. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 05, 2026
Heap out-of-bounds write in the importance-matrix loader of stable-diffusion.cpp allows a crafted .imatrix file to corrupt the heap and crash the process, and provides a controlled-write primitive that may be exploitable further. Builds from master-742-1a13107 up to the fix in master-763-4fcc6fe are affected; the flaw is reached by pointing the conversion path at an untrusted file (for example 'sd-cli -M convert --imat-in poc.imatrix -o out.gguf'), and no model file is required because the imatrix is parsed first. The vendor advisory includes a proof-of-concept that the reporter reproduced as a SIGSEGV in a real sd-cli build; there is no CISA KEV entry or other confirmation of active exploitation, and the assessed vector (AV:L/UI:R) reflects a user voluntarily processing an attacker-supplied file.
RemediationAI
Update to master-763-4fcc6fe (commit 4fcc6fef10c6f686801c6e257b22cd6a3deb906b, released as tag master-763-4fcc6fe), which adds the missing check in IMatrixCollector::load_imatrix: when a repeated tensor name arrives with a value count that differs from the already-sized entry, the loader logs an error, clears stats_ and returns false instead of writing past the buffers. The vendor advisory is at https://github.com/leejet/stable-diffusion.cpp/security/advisories/GHSA-6q7q-2v9c-x8m7 and the patch is in PR https://github.com/leejet/stable-diffusion.cpp/pull/1750. If upgrading is not immediately possible, avoid feeding untrusted .imatrix files to the --imat-in conversion path - these files are shared like model weights, so treat them as untrusted input - and pre-screen them for duplicate tensor names or entries whose nval differs from the first occurrence of the same name; rejecting such files before invocation prevents the crash at the cost of manual validation of every file, and running the conversion of untrusted inputs in a disposable, resource-limited process contains heap corruption to that process.
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
IMatrixCollector::load_imatrix in src/runtime/imatrix.cpp stores per-tensor statistics in a std::unordered_map<std::string, IMatrixStats> keyed by tensor name, and reads a binary .imatrix layout of int32 n_entries followed by, per entry, int32 len, an len-byte name, int32 ncall, int32 nval and nval float32 values. The values and counts vectors for an entry are resized only when they are empty, so a file containing two entries with the same tensor name - the first with a small nval, the second with a larger nval - collapses onto a single map entry: the vectors stay sized to the first nval while the accumulation loop iterates over the second, larger nval, writing floats and ints past the end of both heap buffers. The written float, the written int and the out-of-bounds length are all attacker-controlled. This is CWE-787 (out-of-bounds write) arising from CWE-1284 (improper validation of a specified quantity), and the advisory notes it is an oversight rather than by design: the sibling collect_imatrix function performs the missing consistency check against the tensor's ne[0], while load_imatrix omits it.
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
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
File-borne local trigger via the conversion path gives AV:L and UI:R with PR:N; the attacker-controlled heap OOB write primitive supports high C/I/A as it may escalate beyond a crash.
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. From master-742-1a13107 until master-763-4fcc6fe, IMatrixCollector::load_imatrix in src/runtime/imatrix.cpp reuses the values and counts vectors for entries with the same tensor name but resizes them only when they are empty. An untrusted .imatrix file can provide a small nval for the first entry and a larger nval for a second entry with the same name, causing the accumulation loop to write attacker-controlled floating-point and integer values beyond both heap buffers. Loading the file through the --imat-in conversion path can corrupt the heap or crash the process before a model is required. This issue is fixed in master-763-4fcc6fe.
Technical POC Analysis
CWE-787 out-of-bounds write, with CWE-1284 improper validation of a specified quantity.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
A heap corruption vulnerability in stable-diffusion.cpp, an open-source inference tool, could allow an attacker-supplied .imatrix file to crash the application and potentially enable further compromise. Teams using affected builds to process untrusted model conversion inputs are exposed, requiring user interaction to open a malicious file. Leadership should prioritize remediation because exploitation could disrupt AI model pipelines and, in worst case, allow code execution on developer or production hosts.
No vendor-released patch identified at time of analysis; restrict processing of .imatrix files to trusted sources, run conversions in isolated environments with minimal privileges, and monitor for crashes or anomalous behavior in stable-diffusion.cpp processes.
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.
Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.
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
Out-of-bounds read in stable-diffusion.cpp's safetensors loader (src/model_io/safetensors_io.cpp) lets a crafted .safete
Out-of-bounds reads in stable-diffusion.cpp's PyTorch pickle checkpoint parser (versions prior to master-584-0a7ae07) al
EUVD-2026-117546
NVD
CVE.org
EPSS
GitHub
Exploit-DB