VYPR
Moderate severityNVD Advisory· Published Feb 24, 2026· Updated Feb 26, 2026

ImageMagick vulnerable to Code injection via PostScript header in ps coders

CVE-2026-25797

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, the ps coders, responsible for writing PostScript files, fails to sanitize the input before writing it into the PostScript header. An attacker can provide a malicous file and inject arbitrary PostScript code. When the resulting file is processed by a printer or a viewer (like Ghostscript), the injected code is interpreted and executed. The html encoder does not properly escape strings that are written to in the html document. An attacker can provide a malicious file and injection arbitrary html code. 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.

ImageMagick before 7.1.2-15 and 6.9.13-40 allows PostScript and HTML code injection via unsanitized output in ps coders and html encoder.

Vulnerability

ImageMagick versions prior to 7.1.2-15 and 6.9.13-40 contain two injection vulnerabilities in its output handling. The ps coders, which generate PostScript files, do not sanitize input before writing it into the PostScript header, allowing arbitrary PostScript code injection [1][3]. Similarly, the HTML encoder fails to escape strings, enabling injection of arbitrary HTML into generated HTML documents [3].

Exploitation

An attacker can craft a malicious image file that, when processed by ImageMagick (e.g., via convert to PostScript or HTML format), embeds injected code into the output. For PostScript output, the injected code is executed when the file is opened by a printer or a viewer like Ghostscript. For HTML output, the injected code is interpreted when the HTML file is viewed in a browser, potentially leading to cross-site scripting (XSS) [2].

Impact

Successful exploitation allows an attacker to execute arbitrary PostScript or HTML code in the context of the user or service processing the output. This can lead to remote code execution (for PostScript) or XSS (for HTML). Attackers require no authentication if the service processes untrusted images [2][3].

Mitigation

The vulnerabilities are fixed in ImageMagick versions 7.1.2-15 and 6.9.13-40. The commit introducing sanitization functions (FilenameToTitle) ensures only printable ASCII and balanced parentheses are included in PostScript headers [2]. Users should update to the latest versions and consider restricting use of the ps and html coders until patched.

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.

PackageAffected versionsPatched versions
Magick.NET-Q16-AnyCPUNuGet
< 14.10.314.10.3
Magick.NET-Q16-HDRI-AnyCPUNuGet
< 14.10.314.10.3
Magick.NET-Q16-HDRI-OpenMP-arm64NuGet
< 14.10.314.10.3
Magick.NET-Q16-HDRI-OpenMP-x64NuGet
< 14.10.314.10.3
Magick.NET-Q16-HDRI-arm64NuGet
< 14.10.314.10.3
Magick.NET-Q16-HDRI-x64NuGet
< 14.10.314.10.3
Magick.NET-Q16-HDRI-x86NuGet
< 14.10.314.10.3
Magick.NET-Q16-OpenMP-x64NuGet
< 14.10.314.10.3
Magick.NET-Q16-OpenMP-x86NuGet
< 14.10.314.10.3
Magick.NET-Q16-arm64NuGet
< 14.10.314.10.3
Magick.NET-Q16-x86NuGet
< 14.10.314.10.3
Magick.NET-Q8-AnyCPUNuGet
< 14.10.314.10.3
Magick.NET-Q8-OpenMP-arm64NuGet
< 14.10.314.10.3
Magick.NET-Q8-OpenMP-x64NuGet
< 14.10.314.10.3
Magick.NET-Q8-arm64NuGet
< 14.10.314.10.3
Magick.NET-Q8-x64NuGet
< 14.10.314.10.3
Magick.NET-Q8-x86NuGet
< 14.10.314.10.3
Magick.NET-Q16-OpenMP-arm64NuGet
< 14.10.314.10.3

Affected products

2
  • ImageMagick/Imagemagickllm-fuzzy2 versions
    < 7.1.2-15 + < 6.9.13-40+ 1 more
    • (no CPE)range: < 7.1.2-15 + < 6.9.13-40
    • (no CPE)range: >= 7.0.0, < 7.1.2-15

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

5

News mentions

0

No linked articles in our index yet.