{"id":"CVE-2026-70659","kind":"vulnerability","aliases":["CVE-2026-70659"],"related":[],"title":"stable-diffusion.cpp: crafted imatrix file corrupts heap during model conversion","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. 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.","summary":"stable-diffusion.cpp is a C/C++ library for running image diffusion models such as Stable Diffusion and Flux. A crafted .imatrix file loaded through the --imat-in conversion path can make the loader write past heap buffers, corrupting memory or crashing the process.","severity":"high","cvss":7.8,"epss":null,"exploited":false,"exploited_at":null,"products":[],"ecosystems":[],"tags":["ai-tooling","diffusion-models","ggml","stable-diffusion.cpp"],"not_affected_if":["no-imat-in-usage","trusted-imatrix-files-only"],"how_to_check":"- Check whether the build includes a version from `master-742-1a13107` up to but not including `master-763-4fcc6fe`\n- Check whether the conversion tool is run with `--imat-in` on any .imatrix file that is not trusted","fix":"- Move to `master-763-4fcc6fe` or later","status":"open","published_at":"2026-11-05T16:17:48+00:00","first_seen_at":"2026-11-05T16:40:03+00:00","triaged_at":"2026-11-05T16:41:28+00:00","updated_at":"2026-11-05T16:41:28+00:00","category":"ai-tooling","confidence":0.7,"triage":{"at":"2026-11-05T16:41:28Z","model":"claude-haiku-5-5","output":{"fix":"- Move to `master-763-4fcc6fe` or later","reach":"local","title":"stable-diffusion.cpp: crafted imatrix file corrupts heap during model conversion","impact":"high","summary":"stable-diffusion.cpp is a C/C++ library for running image diffusion models such as Stable Diffusion and Flux. A crafted .imatrix file loaded through the --imat-in conversion path can make the loader write past heap buffers, corrupting memory or crashing the process.","audience":"developers","category":"ai-tooling","nicknames":[],"who_cares":["stable-diffusion.cpp","diffusion-models","ggml"],"confidence":0.7,"fix_status":"available","needs_auth":"no","worst_case":"Attacker-controlled data corrupts heap memory, crashing the process or possibly more","analyst_note":"","how_to_check":"- Check whether the build includes a version from `master-742-1a13107` up to but not including `master-763-4fcc6fe`\n- Check whether the conversion tool is run with `--imat-in` on any .imatrix file that is not trusted","plain_action":"","needs_analyst":false,"not_affected_if":["no-imat-in-usage","trusted-imatrix-files-only"],"who_is_affected":"Teams that run stable-diffusion.cpp's conversion path with the --imat-in option on importance-matrix files they did not create or cannot verify. The sources describe a crash or heap corruption when such a file is loaded before any model is required. Teams that never use --imat-in or only load trusted imatrix files can skip it.","user_interaction":"yes","needs_special_setup":"yes","severity_if_unknown":"high"},"cost_usd":0.000735,"input_tokens":4464,"output_tokens":578,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-1':91C '-2026':11A,14A '-4':96C,198C '-70659':12A,15A '-742':90C '-763':95C,197C 'a13107':92C 'accumul':151C 'ai':17B 'ai-tool':16B 'attack':156C 'attacker-control':155C 'beyond':164C 'buffer':59B,167C 'c/c':27B,70C 'caus':149C 'control':157C 'convers':9A,50B,176C 'corrupt':5A,60B,179C 'count':107C 'craft':2A,41B 'crash':63B,183C 'cve':10A,13A 'diffus':20B,32B,37B,74C,77C 'diffusion-model':19B 'empti':123C 'entri':110C,136C,144C 'fcc6fe':97C,199C 'file':4A,43B,127C,170C 'first':135C 'fix':194C 'float':159C 'floating-point':158C 'flux':39B,78C 'ggml':22B 'heap':6A,58B,166C,181C 'imag':31B,81C,84C 'imat':48B,174C 'imat-in':47B,173C 'imatrix':3A,42B,100C,126C 'imatrixcollector':98C 'infer':87C 'integ':162C 'issu':192C 'larger':139C 'librari':28B,71C 'load':44B,99C,168C 'loader':55B 'loop':152C 'make':53B 'master':89C,94C,196C 'memori':61B 'model':8A,21B,33B,75C,188C 'name':115C,148C 'nval':132C,140C 'past':57B 'path':51B,177C 'point':160C 'process':65B,185C 'provid':129C 'pure':69C 'qwen':80C 'requir':190C 'resiz':117C 'reus':103C 'run':30B,73C 'second':143C 'small':131C 'src/runtime/imatrix.cpp':102C 'stabl':36B,76C 'stable-diffusion.cpp':1A,23B,24B,66C 'tensor':114C 'tool':18B 'untrust':125C 'valu':105C,163C 'vector':108C 'wan':79C 'write':56B,154C 'z':83C 'z-imag':82C","nicknames":[],"mitigations":[],"who_affected":"Teams that run stable-diffusion.cpp's conversion path with the --imat-in option on importance-matrix files they did not create or cannot verify. The sources describe a crash or heap corruption when such a file is loaded before any model is required. Teams that never use --imat-in or only load trusted imatrix files can skip it.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":[],"ptokens":[],"labels":["aitooling","diffusionmodels","ggml","high","stablediffusioncpp"],"campaign_type":null,"first_public_at":"2026-09-27T13:45:54+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","cvss_by":"security-advisories@github.com","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-70659","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-70659","severity":null,"published_at":"2026-11-05T16:17:48+00:00","modified_at":"2026-11-05T16:17:48+00:00","first_seen_at":"2026-11-05T16:40:03+00:00","fetched_at":"2026-11-05T16:40:03+00:00","note":null}],"documents":[{"id":77655,"url":"https://github.com/leejet/stable-diffusion.cpp/commit/4fcc6fef10c6f686801c6e257b22cd6a3deb906b","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":77656,"url":"https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-763-4fcc6fe","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release notes: github.com"},{"id":77657,"url":"https://github.com/leejet/stable-diffusion.cpp/security/advisories/GHSA-6q7q-2v9c-x8m7","title":"Vendor advisory: github.com","kind":"vendor","source":"nvd","publisher":"vendor","text":null,"published_at":"2026-09-27T13:45:54+00:00","relation":"advisory","confidence":null,"note":"Vendor advisory: github.com"}],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}