CVE-2026-25797
PostScript and HTML Injection in ImageMagick Enables Code Execution
Publication date: 2026-02-24
Last updated on: 2026-02-25
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| imagemagick | imagemagick | to 6.9.13-40 (exc) |
| imagemagick | imagemagick | From 7.0.0-0 (inc) to 7.1.2-15 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-94 | The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2026-25797 is a moderate severity code injection vulnerability in ImageMagick versions prior to 7.1.2-15 and 6.9.13-40.
The vulnerability occurs because the PostScript (ps) encoders do not properly sanitize input before embedding it into the PostScript header. This allows an attacker to supply a malicious file containing arbitrary PostScript code that gets injected into the output file.
When the resulting file is processed by a printer or viewer such as Ghostscript, the injected PostScript code is executed, potentially compromising the system.
Additionally, the HTML encoder in ImageMagick does not correctly escape strings written into HTML documents, enabling an attacker to inject arbitrary HTML code.
How can this vulnerability impact me? :
This vulnerability can lead to the execution of arbitrary PostScript code when a maliciously crafted file is processed by a printer or viewer like Ghostscript.
The impact includes potential compromise of system integrity and availability, as indicated by the CVSS metrics showing low integrity and availability impacts.
Since the attack vector is local and requires no privileges or user interaction, an attacker with local access can exploit this vulnerability to inject code.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
I don't know
How can this vulnerability be detected on my network or system? Can you suggest some commands?
I don't know
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, you should update ImageMagick to versions 7.1.2-15 or 6.9.13-40 or later, which contain patches addressing the issue.