CVE-2026-61858 Overview
CVE-2026-61858 is a policy bypass vulnerability in ImageMagick versions before 7.1.2-26. The flaw exists in the Animated Portable Network Graphics (APNG) encoder and external delegate handling. Missing validation checks allow attackers to write files to paths that ImageMagick's security policy is configured to disallow.
The vulnerability is tracked under [CWE-59] (Link Following). It stems from the encoder failing to enforce configured policy restrictions during the APNG encoding process. Local attackers with low privileges can leverage this weakness to escape the policy sandbox that administrators rely on to constrain ImageMagick file operations.
Critical Impact
Attackers with local access can bypass ImageMagick policy restrictions and write files to disallowed filesystem paths through crafted APNG encoding operations.
Affected Products
- ImageMagick versions prior to 7.1.2-26
- Applications and web services that expose ImageMagick conversion features to untrusted input
- Linux distributions and container images bundling vulnerable ImageMagick builds
Discovery Timeline
- 2026-07-11 - CVE-2026-61858 published to the National Vulnerability Database
- 2026-07-14 - Last updated in NVD database
Technical Details for CVE-2026-61858
Vulnerability Analysis
ImageMagick ships with a policy.xml file that administrators use to restrict which coders, delegates, and paths the library may access. This policy is a primary defense boundary for services that process user-supplied images. CVE-2026-61858 undermines that boundary by exposing a code path in the APNG encoder that does not consult policy checks before writing output.
The vulnerability is classified as an input validation and file-handling flaw related to link following [CWE-59]. When ImageMagick handles APNG encoding and invokes external delegates, missing path validation allows the output write to resolve to a location the policy would otherwise deny. According to the VulnCheck Advisory on ImageMagick, the issue was addressed in release 7.1.2-26.
Root Cause
The root cause is the absence of policy enforcement checks in the APNG encoder and its delegate pipeline. Path resolution is performed without confirming that the destination complies with the active policy.xml rules. Because delegates execute filesystem operations on behalf of ImageMagick, they inherit access that the policy is intended to constrain.
Attack Vector
Exploitation requires local access and low privileges, with no user interaction. An attacker supplies an image or command that triggers the APNG encoder with an output path targeting a disallowed location. The encoder writes the file, bypassing policy restrictions. See the GitHub Security Advisory for technical details on the affected code paths.
Detection Methods for CVE-2026-61858
Indicators of Compromise
- Unexpected files created by the ImageMagick process (convert, magick, identify) outside declared working directories
- APNG conversion commands referencing output paths under system directories or web root locations
- Delegate invocations spawning child processes that write to paths blocked by policy.xml
Detection Strategies
- Audit process execution logs for ImageMagick invocations that specify APNG (apng: prefix) as an output format from untrusted contexts
- Correlate magick or convert process activity with file-write events targeting sensitive paths
- Compare installed ImageMagick versions across the fleet against the fixed release 7.1.2-26
Monitoring Recommendations
- Enable filesystem auditing on directories that policy.xml is expected to protect
- Monitor for new or modified policy.xml files that may weaken the intended restrictions
- Track child processes spawned by ImageMagick delegates and alert on writes outside expected output directories
How to Mitigate CVE-2026-61858
Immediate Actions Required
- Upgrade ImageMagick to version 7.1.2-26 or later across all systems, containers, and base images
- Inventory applications embedding ImageMagick libraries (libMagickCore, libMagickWand) and rebuild them against the patched version
- Restrict local access to systems running ImageMagick where APNG encoding is exposed to lower-privileged users
Patch Information
The ImageMagick maintainers released the fix in version 7.1.2-26. Details are published in the GitHub Security Advisory GHSA-v3j6-27vc-7pw2. Distributions that backport patches should ensure the APNG encoder and delegate path validation changes are included.
Workarounds
- Disable the APNG coder in policy.xml by adding a rule such as <policy domain="coder" rights="none" pattern="APNG" />
- Disable external delegates that are not required for the application's workflow
- Run ImageMagick under a dedicated low-privilege user with filesystem access limited via mandatory access controls (SELinux, AppArmor) or container isolation
# Configuration example: restrict APNG coder in policy.xml
<policymap>
<policy domain="coder" rights="none" pattern="APNG" />
<policy domain="delegate" rights="none" pattern="*" />
<policy domain="path" rights="none" pattern="@*" />
</policymap>
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

