GHSA-cfh4-9f7v-fhrc is a low-severity (CVSS 3.7) Out-of-bounds Read vulnerability in Magick.NET-Q16-AnyCPU. A fix is available for Magick.NET-Q16-AnyCPU — see the affected versions and patch details below.
ImageMagick has a Memory Leak in magick stream
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for GHSA-cfh4-9f7v-fhrc.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-cfh4-9f7v-fhrc plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 377,166 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
Magick.NET-Q16-AnyCPU.NETMagick.NET-Q16-HDRI-AnyCPU.NETMagick.NET-Q16-HDRI-OpenMP-arm64.NETMagick.NET-Q16-HDRI-OpenMP-x64.NETMagick.NET-Q16-HDRI-arm64.NETMagick.NET-Q16-HDRI-x64.NETMagick.NET-Q16-HDRI-x86.NETMagick.NET-Q16-OpenMP-arm64+10 moreReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects NuGet packages — download data is not available via public APIs for these ecosystems.
Description
Summary
In ImageMagick's magick stream command, specifying multiple consecutive %d format specifiers in a filename template causes a memory leak.
Details
- Vulnerability Type: Memory leak
- Affected Version: ImageMagick 7.1.1-47 (as of commit 82572afc, June 2025)
Reproduction
Tested Environment
- Operating System: Ubuntu 22.04 LTS
- Architecture: x86_64
- Compiler: gcc with AddressSanitizer (gcc version: 11.4.0)
Reproduction Steps
# Clone source
git clone --depth 1 --branch 7.1.1-47 https://github.com/ImageMagick/ImageMagick.git ImageMagick-7.1.1
cd ImageMagick-7.1.1
# Build with ASan
CFLAGS="-g -O0 -fsanitize=address -fno-omit-frame-pointer" CXXFLAGS="$CFLAGS" LDFLAGS="-fsanitize=address" ./configure --enable-maintainer-mode --enable-shared && make -j$(nproc) && make install
# Trigger crash
./utilities/magick stream %d%d a a
Output
$ magick stream %d%d a a
stream: no decode delegate for this image format `' @ error/constitute.c/ReadImage/746.
stream: missing an image filename `a' @ error/stream.c/StreamImageCommand/755.
=================================================================
==114==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 152 byte(s) in 1 object(s) allocated from:
#0 0x7fc4ebe58887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fc4eb563c5c in AcquireMagickMemory MagickCore/memory.c:559
#2 0x7fc4eb563c82 in AcquireCriticalMemory MagickCore/memory.c:635
#3 0x7fc4eb60c2be in AcquireQuantumInfo MagickCore/quantum.c:119
#4 0x7fc4eb6b6621 in StreamImage MagickCore/stream.c:1335
#5 0x7fc4eb09d889 in StreamImageCommand MagickWand/stream.c:292
#6 0x7fc4eaf1295d in MagickCommandGenesis MagickWand/magick-cli.c:177
#7 0x55a34f7c0a0c in MagickMain utilities/magick.c:153
#8 0x55a34f7c0cba in main utilities/magick.c:184
#9 0x7fc4ea38fd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Indirect leak of 64 byte(s) in 1 object(s) allocated from:
#0 0x7fc4ebe5957c in __interceptor_posix_memalign ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:226
#1 0x7fc4eb680e2f in AcquireSemaphoreMemory MagickCore/semaphore.c:154
#2 0x7fc4eb680f30 in AcquireSemaphoreInfo MagickCore/semaphore.c:200
#3 0x7fc4eb60d38d in GetQuantumInfo MagickCore/quantum.c:435
#4 0x7fc4eb60c30e in AcquireQuantumInfo MagickCore/quantum.c:121
#5 0x7fc4eb6b6621 in StreamImage MagickCore/stream.c:1335
#6 0x7fc4eb09d889 in StreamImageCommand MagickWand/stream.c:292
#7 0x7fc4eaf1295d in MagickCommandGenesis MagickWand/magick-cli.c:177
#8 0x55a34f7c0a0c in MagickMain utilities/magick.c:153
#9 0x55a34f7c0cba in main utilities/magick.c:184
#10 0x7fc4ea38fd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: 216 byte(s) leaked in 2 allocation(s).
Commits
Fixed in https://github.com/ImageMagick/ImageMagick/commit/fc3ab0812edef903bbb2473c0ee652ddfd04fe5c and https://github.com/ImageMagick/ImageMagick6/commit/d49460522669232159c2269fa64f73ed30555c1b
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| .NETNuGet | Magick.NET-Q16-AnyCPU | all versions | 14.7.0dotnet add package Magick.NET-Q16-AnyCPU --version 14.7.0 |
| .NETNuGet | Magick.NET-Q16-HDRI-AnyCPU | all versions | 14.7.0dotnet add package Magick.NET-Q16-HDRI-AnyCPU --version 14.7.0 |
| .NETNuGet | Magick.NET-Q16-HDRI-OpenMP-arm64 | all versions | 14.7.0dotnet add package Magick.NET-Q16-HDRI-OpenMP-arm64 --version 14.7.0 |
| .NETNuGet | Magick.NET-Q16-HDRI-OpenMP-x64 | all versions | 14.7.0dotnet add package Magick.NET-Q16-HDRI-OpenMP-x64 --version 14.7.0 |
| .NETNuGet | Magick.NET-Q16-HDRI-arm64 | all versions | 14.7.0dotnet add package Magick.NET-Q16-HDRI-arm64 --version 14.7.0 |
| .NETNuGet | Magick.NET-Q16-HDRI-x64 | all versions | 14.7.0dotnet add package Magick.NET-Q16-HDRI-x64 --version 14.7.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for Magick.NET-Q16-AnyCPU, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update Magick.NET-Q16-AnyCPU to 14.7.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-cfh4-9f7v-fhrc is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-cfh4-9f7v-fhrc can be triaged on real exposure rather than presence alone.
Tailored to GHSA-cfh4-9f7v-fhrc. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Frequently Asked Questions
Is GHSA-cfh4-9f7v-fhrc in your dependencies?
O3 Security finds GHSA-cfh4-9f7v-fhrc across NuGet dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.