Skip to main content

stable-diffusion.cpp EUVDEUVD-2026-117546

| CVE-2026-70659 HIGH
Out-of-bounds Write (CWE-787)
2026-11-05 GitHub_M
7.8
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Access
    Craft .imatrix with duplicate tensor name (small then large nval)
  2. Delivery
    Deliver file via model/imatrix supply chain
  3. Exploit
    Victim loads it with --imat-in conversion path
  4. Execution
    Resize skipped, accumulation loop writes past both heap buffers
  5. Impact
    Heap 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.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.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

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

stable-diffusion.cpp < master-763-4fcc6fe

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

Vendor (GitHub_M) PRIMARY 7.8 HIGH
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
vuln.today AI 7.8 HIGH

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.

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

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

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

Why It Matters

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.

Business Impact: Medium
Compensating Controls

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

EPSS Score
0.1%
Top 98% exploitable
Prevalence
Low
niche open-source C/C++ diffusion-inference library, limited production 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 HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available No
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.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
Medium

Priority Score

39
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +39
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.

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.

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