Executive Summary
CVE-2026-140359 describes a heap-based buffer overflow located in ImageMagick's ShearRotateImage method. When the function receives a specifically crafted argument, it writes past the boundaries of a heap-allocated buffer, corrupting adjacent heap structures and crashing the application. The defect affects ImageMagick releases on both the legacy 6.x line and the current 7.x line, and has been fixed in 6.9.13-61 and 7.1.2-36 respectively. The vulnerability carries a CVSS base score of 2.5, is reachable only through the ImageMagick API rather than standard image-decoding flows, is not listed on the CISA KEV catalog, and has no public exploitation evidence attached to it.
Technical Details
The vulnerable code resides inside ShearRotateImage, a routine that performs image rotation by way of a shearing transform. Under the conditions described by the advisory, an input argument causes the function's memory bookkeeping to miscalculate the destination region of a heap buffer that backs the intermediate image data. The resulting write extends beyond the buffer's allocated extent, corrupting neighboring heap objects or allocator metadata. The observable effect reported in the advisory is heap corruption followed by application termination.
Two design characteristics of the bug constrain its practical reachability:
- API-only entry point. The advisory states that
ShearRotateImageis only reachable through the ImageMagick API. A direct invocation from the standard command-line tool or a typical file-format decoder is not part of the documented trigger path; instead, a host application, library caller, or wrapper must pass a crafted argument into this function.
- Local/restricted attack vector. The risk framing reflects an AV:L/P component, indicating that reaching the vulnerable code expects local or otherwise restricted caller privileges rather than an unauthenticated remote trigger.
Affected Systems
- ImageMagick 6.x: all releases before 6.9.13-61
- ImageMagick 7.x: all releases before 7.1.2-36
The fixed branches are 6.9.13-61 and later on the 6.x line, and 7.1.2-36 and later on the 7.x line. Earlier major versions and any sub-releases prior to those fixes are treated as affected under the terms of the advisory.
Exploitability and Real-World Impact
The combination of a CVSS base score of 2.5, API-only reachability, absence from the CISA KEV catalog, and lack of recorded exploitation pushes the practical risk profile down. The observable consequence is a denial-of-service condition through application crash; while memory corruption primitives can occasionally be escalated to code execution, the advisory frames the immediate outcome as corruption plus crash rather than arbitrary code execution.
Environments most exposed are those that embed ImageMagick and accept attacker-controlled rotation parameters through their own API surface or chained wrappers; pure command-line or web-upload image conversion pipelines that never reach ShearRotateImage through user input face minimal exposure beyond the underlying memory-safety defect itself.
Mitigation
Patch path.
- Upgrade ImageMagick to 6.9.13-61 or later on the 6.x branch.
- Upgrade ImageMagick to 7.1.2-36 or later on the 7.x branch.
Workarounds when immediate patching is not feasible.
- Block or sanitize caller paths that invoke
ShearRotateImagewith externally supplied rotation arguments.
- Avoid exposing the ImageMagick API directly to untrusted input sources; restrict it to trusted internal pipelines.
- Where the code uses
ShearRotateImagedirectly, consider replacing or wrapping the call with an alternative rotation routine whose parameters are bounded, until the upgrade is applied.
Detection.
- Monitor for unexpected crashes and heap-corruption signals (such as SIGSEGV, SIGABRT from glibc or malloc detected-corruption checks, or AddressSanitizer/Valgrind reports) in processes that perform ImageMagick transformations.
- In embedded use cases, enable hardening options such as ASLR and
FORTIFY_SOURCEin production builds, and use AddressSanitizer or equivalent allocator instrumentation in non-production environments to surface any out-of-bounds writes tied to this code path.
Conclusion
CVE-2026-140359 is a Low-severity heap buffer overflow in ImageMagick's ShearRotateImage, affecting 6.x before 6.9.13-61 and 7.x before 7.1.2-36, reachable only through the API, with no public exploitation reported and no CISA KEV listing. Operational priority hinges on whether the surrounding environment exposes this rotation code path to untrusted callers; in any case, closing the defect through an upgrade to the fixed versions is the recommended hygiene step.