ImageMagick has memory leak of watermark Image object in ReadSTEGANOImage on multiple error/early-return paths
Description
ImageMagick is free and open-source software used for editing and manipulating digital images. Prior to versions 7.1.2-15 and 6.9.13-40, in ReadSTEGANOImage() (coders/stegano.c), the watermark Image object is not freed on three early-return paths, resulting in a definite memory leak (~13.5KB+ per invocation) that can be exploited for denial of service. Versions 7.1.2-15 and 6.9.13-40 contain a patch.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A memory leak in ImageMagick's ReadSTEGANOImage (~13.5KB per call) allows denial of service; fixed in versions 7.1.2-15 and 6.9.13-40.
Vulnerability
CVE-2026-25796 is a memory leak in the ReadSTEGANOImage() function within coders/stegano.c. On three early-return paths, the watermark Image object is not freed, resulting in a definite memory leak of approximately 13.5 KB per invocation [2][4]. This affects ImageMagick versions prior to 7.1.2-15 and 6.9.13-40 [2].
Exploitation
An attacker can trigger the leak by providing a crafted steganographic image that forces ReadSTEGANOImage() to exit early on one of the vulnerable paths. No authentication or special privileges are needed; any application that processes user-supplied images—such as web upload services, email filters, or image processing pipelines using ImageMagick—is potentially exposed [1]. The attack is low-complexity and can be repeated to exhaust memory resources.
Impact
Repeated exploitation of this memory leak can progressively consume available memory, leading to denial of service for the ImageMagick process and possibly the host system. The leak accumulates per invocation, so a sustained series of crafted images can degrade or crash the service [2].
Mitigation
The issue is patched in ImageMagick versions 7.1.2-15 and 6.9.13-40 [2][4]. Users should upgrade to these or later releases. The fix adds DestroyImage(watermark) calls before each early return path, ensuring the watermark object is properly freed [4].
- GitHub - ImageMagick/ImageMagick: ImageMagick is a free, open-source software suite for creating, editing, converting, and displaying images. It supports 200+ formats and offers powerful command-line tools and APIs for automation, scripting, and integration across platforms.
- NVD - CVE-2026-25796
- Prevent memory leak in early exits (GHSA-g2pr-qxjg-7r2w) · ImageMagick/ImageMagick@93ad259
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
Magick.NET-Q16-AnyCPUNuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-HDRI-AnyCPUNuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-HDRI-OpenMP-arm64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-HDRI-OpenMP-x64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-HDRI-arm64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-HDRI-x64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-HDRI-x86NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-OpenMP-arm64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-OpenMP-x64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-OpenMP-x86NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-arm64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-x64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q16-x86NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q8-AnyCPUNuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q8-OpenMP-arm64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q8-arm64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q8-x64NuGet | < 14.10.3 | 14.10.3 |
Magick.NET-Q8-x86NuGet | < 14.10.3 | 14.10.3 |
Affected products
2<7.1.2-15 or <6.9.13-40+ 1 more
- (no CPE)range: <7.1.2-15 or <6.9.13-40
- (no CPE)range: >= 7.0.0, < 7.1.2-15
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
5- github.com/advisories/GHSA-g2pr-qxjg-7r2wghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-25796ghsaADVISORY
- github.com/ImageMagick/ImageMagick/commit/93ad259ce4f6d641eea0bee73f374af90f35efc3ghsaWEB
- github.com/ImageMagick/ImageMagick/security/advisories/GHSA-g2pr-qxjg-7r2wghsax_refsource_CONFIRMWEB
- github.com/dlemstra/Magick.NET/releases/tag/14.10.3ghsaWEB
News mentions
0No linked articles in our index yet.