ImageMagick's Security Policy Bypass through config/policy-secure.xml via "fd handler" leads to stdin/stdout access
Date: 2026-02
Affected: nuget/Magick.NET-Q8-x86, nuget/Magick.NET-Q8-arm64, nuget/Magick.NET-Q8-OpenMP-x64
Attack vector: other
Category: vulnerability-disclosure
Severity: High
CVE: CVE-2026-25797
CVE-2026-25965
CVE-2026-25966
CWE: CWE-22
CWE-284
CWE-94
CVSS: 5.9 (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L)

The shipped “secure” security policy includes a rule intended to prevent reading/writing from standard streams: ```xml <policy domain="path" rights="none" pattern="-"/> ``` However, ImageMagick also supports fd:<n> pseudo-filenames (e.g., fd:0, fd:1). This path form is not blocked by the secure policy templates, and therefore bypasses the protection goal of “no stdin/stdout”. To resolve this, users can add the following change to their security policy. ```xml <policy domain="path" rights="none" pattern="fd:*"/> ``` And this will also be included in ImageMagick's more secure policies by default.


Mitigations:

Architectural layers (MAESTRO):